-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Add Error.prototype.cause
#47020
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Error.prototype.cause
#47020
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general, but there are failing tests that need to be addressed.
Agree, thanks, this all looks good to me too |
I want to have this in place to implement [1] which satisfies a need we ourselves have[2]. This is needed because the cause property is only availble in the es2022 TS profile[3]. [1] vultix#34 [2] vultix#48 [3] microsoft/TypeScript#47020
I want to have this in place to implement [1] which satisfies a need we ourselves have[2]. This is needed because the cause property is only availble in the es2022 TS profile[3]. [1] vultix#34 [2] vultix#48 [3] microsoft/TypeScript#47020
@@ -1,8 +1,55 @@ | |||
interface ErrorOptions { | |||
cause?: Error; | |||
cause?: Error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cause
should be typed as unknown
(or any
in a less strict way) as the value being thrown in JavaScript can be arbitrary values.
Fixes #47019