-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptES6Relates to the ES6 SpecRelates to the ES6 SpecFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
The ES6 designates some native objects as subclassable, e.g. Object, Boolean, Error, Map, Promise ..etc. The way these constructs are modeled in lib.d.ts makes is impossible to subclass, as they are defined as a pair of a var and an interface.
From the ES6 spec section19.5.1:
The Error constructor is designed to be subclassable. It may be used as the value of an extends clause of a class declaration. Subclass constructors that intended to inherit the specified Error behavior should include a super call to the Error constructor to initialize subclass instances.
Currently this would result in "A class can only extend another class" error:
class NotImplementedError extends Error {
constructor() {
super("Not Implemented");
}
}
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptES6Relates to the ES6 SpecRelates to the ES6 SpecFixedA PR has been merged for this issueA PR has been merged for this issue