Skip to content

SuppressedError constructor should not have Error constructor overloads #55674

Closed
@Jamesernator

Description

@Jamesernator

⚙ Compilation target

esnext

⚙ Library

esnext

Missing / Incorrect Definition

The SuppressedError constructor inherits the ErrorConstructor:

interface SuppressedErrorConstructor extends ErrorConstructor {
    new (error: any, suppressed: any, message?: string): SuppressedError;
    (error: any, suppressed: any, message?: string): SuppressedError;
    readonly prototype: SuppressedError;
}
declare var SuppressedError: SuppressedErrorConstructor;

however this spuriously adds overload signatures from ErrorConstructor which should not be allowed for SuppressedError.

Sample Code

This overload inherited from ErrorConstructor should not be allowed for SuppressedError:

const supressedError = new SuppressedError(`This should not be an allowed signature`)

Documentation Link

The spec for SuppressedError is here.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptEffort: CasualGood issue if you're already used to contributing to the codebase. Harder than "good first issue".Fix AvailableA PR has been opened for this issueHelp WantedYou can do this

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions