Skip to content
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.isError() to ESNext lib #60787

Open
dirkluijk opened this issue Dec 17, 2024 · 0 comments · May be fixed by #60788
Open

Add Error.isError() to ESNext lib #60787

dirkluijk opened this issue Dec 17, 2024 · 0 comments · May be fixed by #60788
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this
Milestone

Comments

@dirkluijk
Copy link
Contributor

⚙ Compilation target

ESNext

⚙ Library

ESNect

Missing / Incorrect Definition

interface ErrorConstructor {
    /**
     * Indicates whether the argument provided is a built-in Error instance or not.
     */
    isError(error: unknown): error is Error;
}

Sample Code

try {
  // ...
} catch (e) {
  if (Error.isError(e)) {
    // ...
  }
}

Documentation Link

See https://github.com/tc39/proposal-is-error

@dirkluijk dirkluijk changed the title Add Error.isErrorO() to ESNext lib Add Error.isError() to ESNext lib Dec 17, 2024
@dirkluijk dirkluijk linked a pull request Dec 17, 2024 that will close this issue
@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this labels Dec 17, 2024
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Dec 17, 2024
@RyanCavanaugh RyanCavanaugh added the Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants