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

__awaiter is not defined #46

Open
bigant63 opened this issue Nov 15, 2019 · 3 comments
Open

__awaiter is not defined #46

bigant63 opened this issue Nov 15, 2019 · 3 comments

Comments

@bigant63
Copy link

I keep getting greenlet.m.js:1 Uncaught (in promise) ReferenceError: __awaiter is not defined. In our project. I've tried changing the complier option values:
"importHelpers": true,
"noEmitHelpers": true,

in our tsconfig file. Has anyone experienced this problem and fixed it?

I'm just trying this in one of our modules

const getPost = greenlet(async () => {
  const url = `https://jsonplaceholder.typicode.com/posts`;
  const res = await fetch(url);
  return await res.json();
});

console.log('func======', getPost());

Thanks
Anthony

@slo-cap3
Copy link

slo-cap3 commented Nov 18, 2019

same problem here. Using greenlet in an angular project and getting "ReferenceError: __awaiter is not defined" errors.

I assume that it has something todo with typescript compilation and the emitted helper functions not available in the web-worker module.

@slo-cap3
Copy link

@bigant63 You have to up your compilation target to at least es2017 to get this to work. The greenlet Worker module does not have the emitted helper functions, nor the tslib import. So you have to make sure, that the async/await code is not transpiled down to <=es2016 code.

@bigant63
Copy link
Author

Thanks You! Changing the target to es2017 tsconfig.json worked

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