Skip to content

Add Error.isError() to ESNext lib #60787

Closed
@dirkluijk

Description

@dirkluijk

⚙ Compilation target

ESNext

⚙ Library

ESNext

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

Metadata

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