-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
Milestone
Description
π Search Terms
class extends null interface
π Version & Regression Information
- This is the behavior in every version I tried (at least up until 3.3, which is the oldest build in the playground).
β― Playground Link
π» Code
interface Base {
}
class C extends null {
constructor() {
}
}
interface C extends Base {}
π Actual behavior
Reports the following error:
Class static side 'typeof C' incorrectly extends base class static side 'null'.
π Expected behavior
No error. inteface Base
does not describe the static side of anything, and reopening a class using something like interface C extends Base {}
is common practice for shims.
Additional information about the issue
I ran into this when implementing a class that utilizes return
override in a constructor when combined with class extends null
while experimenting with the Shared Structs origin trial (whose constructors produce objects with a null
prototype). Though native extends null
has some issues in ES2015+, it still works fine with explicit return
override in a constructor in any engine:
class C extends null {
constructor() {
return {};
}
}
new C(); // works just fine.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone