TypeScript/tests/cases/compiler/errorConstructorSubtypes.ts
Nathan Shively-Sanders 8da3eff7b0
Subtypes of ErrorConstructor extend it (#35549)
Previously subtypes of Error extended Error, but the matching subtypes
of ErrorConstructor did not extend ErrorConstructor. The members in
es5.d.ts are identical, so there's no need except for allowing interface
merging into ErrorConstructor to affect subtypes as well.
2020-01-29 13:26:00 -08:00

12 lines
308 B
TypeScript

// @lib: es5,dom
// In Node, ErrorConstructor is augmented with extra properties. Excerpted below.
interface ErrorConstructor {
captureStackTrace(targetObject: Object, constructorOpt?: Function): void;
}
declare var x: ErrorConstructor
x = Error; // OK
x = RangeError;
new x().message
x.captureStackTrace