Skip to content

Add Error.prototype.cause - #47020

Merged
Orta Therox (orta) merged 3 commits into
microsoft:mainfrom
saschanaz:es2022-errorcause
Jan 7, 2022
Merged

Orta Therox (orta) merged 3 commits into
microsoft:mainfrom
saschanaz:es2022-errorcause

Conversation

@saschanaz

Copy link
Copy Markdown
Contributor

Fixes #47019

@typescript-bot TypeScript Bot (typescript-bot) added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Dec 4, 2021
@typescript-bot TypeScript Bot (typescript-bot) added For Backlog Bug PRs that fix a backlog bug and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Dec 16, 2021

@rbuckton Ron Buckton (rbuckton) left a comment

Copy link
Copy Markdown
Contributor

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.

@orta

Copy link
Copy Markdown
Contributor

Agree, thanks, this all looks good to me too

@orta
Orta Therox (orta) merged commit 363e3a7 into microsoft:main Jan 7, 2022
@saschanaz
Kagami Sascha Rosylight (saschanaz) deleted the es2022-errorcause branch January 7, 2022 14:59
Jakub Stasiak (jstasiak) added a commit to lune-climate/ts-results-es that referenced this pull request Mar 29, 2022
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
Jakub Stasiak (jstasiak) added a commit to lune-climate/ts-results-es that referenced this pull request Mar 29, 2022
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
Comment thread src/lib/es2022.error.d.ts
@@ -1,8 +1,55 @@
interface ErrorOptions {
cause?: Error;
cause?: Error;

Copy link
Copy Markdown

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.

@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Error.prototype.cause is still missing with es2022/esnext

6 participants