Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allowJs/JsDoc: Extending classes with template argument #25362

Closed
sokra opened this issue Jul 2, 2018 · 1 comment
Closed

allowJs/JsDoc: Extending classes with template argument #25362

sokra opened this issue Jul 2, 2018 · 1 comment
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@sokra
Copy link
Contributor

sokra commented Jul 2, 2018

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

@ghost ghost added the Bug A bug in TypeScript label Jul 2, 2018
@mhegazy mhegazy self-assigned this Jul 2, 2018
@mhegazy mhegazy added Salsa Fixed A PR has been merged for this issue labels Jul 2, 2018
@mhegazy mhegazy added this to the TypeScript 3.0 milestone Jul 2, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Jul 2, 2018

@sokra give typescript@next a try tomorrow and let us know if you are still running into issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

2 participants