Add Error.prototype.cause (#47020)

* Add `Error.prototype.cause`

Fixes #47019

* Update test baselines
This commit is contained in:
Kagami Sascha Rosylight
2022-01-07 15:58:58 +01:00
committed by GitHub
parent e46f3baec1
commit 363e3a78f4
20 changed files with 531 additions and 38 deletions

View File

@@ -627,7 +627,8 @@ namespace ts {
Float64Array: ["at"],
BigInt64Array: ["at"],
BigUint64Array: ["at"],
ObjectConstructor: ["hasOwn"]
ObjectConstructor: ["hasOwn"],
Error: ["cause"]
}
};
}

View File

@@ -1,8 +1,55 @@
interface ErrorOptions {
cause?: Error;
cause?: Error;
}
interface Error {
cause?: Error;
}
interface ErrorConstructor {
new(message?: string, options?: ErrorOptions): Error;
(message?: string, options?: ErrorOptions): Error;
new (message?: string, options?: ErrorOptions): Error;
(message?: string, options?: ErrorOptions): Error;
}
interface EvalErrorConstructor {
new (message?: string, options?: ErrorOptions): EvalError;
(message?: string, options?: ErrorOptions): EvalError;
}
interface RangeErrorConstructor {
new (message?: string, options?: ErrorOptions): RangeError;
(message?: string, options?: ErrorOptions): RangeError;
}
interface ReferenceErrorConstructor {
new (message?: string, options?: ErrorOptions): ReferenceError;
(message?: string, options?: ErrorOptions): ReferenceError;
}
interface SyntaxErrorConstructor {
new (message?: string, options?: ErrorOptions): SyntaxError;
(message?: string, options?: ErrorOptions): SyntaxError;
}
interface TypeErrorConstructor {
new (message?: string, options?: ErrorOptions): TypeError;
(message?: string, options?: ErrorOptions): TypeError;
}
interface URIErrorConstructor {
new (message?: string, options?: ErrorOptions): URIError;
(message?: string, options?: ErrorOptions): URIError;
}
interface AggregateErrorConstructor {
new (
errors: Iterable<any>,
message?: string,
options?: ErrorOptions
): AggregateError;
(
errors: Iterable<any>,
message?: string,
options?: ErrorOptions
): AggregateError;
}