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

Error on extended class #1876

Closed
2beers opened this issue Jul 7, 2016 · 1 comment
Closed

Error on extended class #1876

2beers opened this issue Jul 7, 2016 · 1 comment

Comments

@2beers
Copy link

2beers commented Jul 7, 2016

The following js code from mozilla classes documentation https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes returns an error:

SEVERE: main.js:14: ERROR - The class in an extends clause must be a qualified name.
class Bar extends CalculatorMixin(RandomizerMixin(Foo)) { }

Here is the code I used:

var CalculatorMixin = Base => class extends Base {
  calc() {
    console.log("calc");
  }
};

var RandomizerMixin = Base => class extends Base {
  randomize() {
    console.log("randomize");
  }
};

class Foo { }
class Bar extends CalculatorMixin(RandomizerMixin(Foo)) { }

var bar=new Bar();
bar.randomize();
@MatrixFrog
Copy link
Contributor

For transpilation, we only support patterns that we can analyze and typecheck, which is the reason for this restriction. Eventually the compiler will support ES6 "natively" (without transpiling down) and then this pattern might work (but will probably still be difficult to typecheck)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants