-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
SyntaxError: 'super' keyword unexpected here #375
Comments
Babel handles this by creating hoisted super property getter functions and then replacing super property access: class Hello extends Base {
async create() {
console.log("Hello Create");
super.create();
}
}
// is transformed into:
class Hello extends Base {
create() {
var _superprop_getCreate = () => super.create,
_this = this;
return _asyncToGenerator(function* () {
console.log("Hello Create");
_superprop_getCreate().call(_this);
})();
}
} ESBuild doesn't currently lower arrow functions, so it could probably do something a bit simpler (not needing to handle context), for example: class Hello extends Base {
create() {
let _superprop_getCreate = () => super.create;
return __async(this, null, function* () {
console.log("Hello Create");
_superprop_getCreate().call(this);
});
}
} |
Yes, I'm planning to do something similar. I'm planning to use |
The fix was just released in version 0.6.33. |
Hi @evanw
First of all thank you for such an amazing project!
I was trying to use esbuild with my existing typescript codebase but I encountered an error with super keyword
To reproduce the issue:
create a test.ts file
Now run esbuild on it with
Now try to run
node ./build/test.js
. You would getI believe this is happening since
transpiled
build/test.js
looks like thisand it breaks because the generator function of
__async
wrapper is not a member function ?The text was updated successfully, but these errors were encountered: