Skip to content

Add Error.isError() to ESNext lib #60787

Open
@dirkluijk

Description

⚙ 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions