-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: 3.0.0-dev.20180630
Search Terms:
TS2510 "Base constructors must all have the same return type" allowJs
Code
/**
* @extends {Set<number>}
*/
class MySet extends Set {}
var x = new MySet();
for (const n of x) {
console.log(n);
}
tsc file.js --allowJs --checkJs --noEmit --lib es2017
Expected behavior:
It should compile fine and infer the type of n
to number
.
Actual behavior:
It errors with:
file.js:4:21 - error TS2510: Base constructors must all have the same return type.
class MySet extends Set {}
but at least infers n
to number.
Playground Link:
Playground doesn't support allowJs
Related Issues:
#23551 similar error message, also allowJs, but not using @extends
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue