-
Notifications
You must be signed in to change notification settings - Fork 53
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
Creating state fails in Node #123
Comments
It looks like the issue comes down to the fact that babel can't properly extend native classes. In Babel 7, they introduced a wrapper that can be applied to built-in classes. Source: https://medium.freecodecamp.org/were-nearing-the-7-0-babel-release-here-s-all-the-cool-stuff-we-ve-been-doing-8c1ade684039TypeScript has a proposal to introduce a helper to improve interop with ES5/ES6. To work around this issue, the users have to either use native classes or babel classes. Which means that if we transpile classes in our library then app classes have to be transpiled. On the flip side, if native ES6 classes are used, then our library has to provide native ES6 classes. To do this, we can distribute There is another alternative which is to remove class from the mechanism that stabilizes classes but I don't know how to achieve the same stable instances without the mechanism that we have. |
Is this still open? |
closing unless it's still a problem /cc @taras |
create(class Foo {}, {}).state
throwsTypeError: Class constructor Foo cannot be invoked without 'new'
. This can be seen in this runkit. The problem seems to stem from the fact that babel can't correctly extend native es6 classes.This can be easily reproduced by trying microstates in Node.js.
The text was updated successfully, but these errors were encountered: