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

Classes transpiled down to es5 can't extend native es6 classes #31509

Closed
fabiospampinato opened this issue May 21, 2019 · 2 comments
Closed

Classes transpiled down to es5 can't extend native es6 classes #31509

fabiospampinato opened this issue May 21, 2019 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@fabiospampinato
Copy link

TypeScript Version: 3.4.1

Search Terms: extend class transpiled es5

Code

// Part 1
function extender ( myClass ) {
  return class extends myClass { }
}

// Part 2
const Extended = extender ( class {} );
new Extended ();

The following code:

  • Works, if transpiled to es6+
  • Works, if transpiled to es5 too
  • Doesn't work, if the first part gets transpiled to es5 while the second part is still using es6. The first part may very well be a class decorator exported by some third-party package. The problem is that when transpiled down to es5 classes can't extend native classes.

Playground Link: N/A, the playground is too limited for this

@DanielRosenwasser
Copy link
Member

I believe this is a duplicate of #17088.

@fabiospampinato
Copy link
Author

It looks like it is, thanks.

@DanielRosenwasser DanielRosenwasser added the Duplicate An existing issue was already created label May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants