-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
4.5 nightly nodenext does not allow top-level await (anymore?) #46869
Comments
@rbuckton this looks like something we'll need to patch |
Why patch? It's not part of TypeScript 4.5, it's just something that would go into the nightly, right? |
(feel free to re-milestone if I'm wrong!) |
Oops, I misread the version being tested |
@simllll: I cannot repro this. Is your project configured correctly? Top-level In 4.7 we changed the error message to |
I should note, I tested against the following TS versions:
All supported top-level |
@simllll Is this still an issue for you? As I mentioned a few months ago, I haven't been able to repro this. I'm going to close this, but I'll reopen if you have a repro against a recent version of the compiler. |
Bug Report
I just switched to 4.5 nightly due to the change in the release of 4.5 with node12 and nodenext and tried to work on my esm branch to get things running again, but somehow 4.5 nightly ( "typescript": "^4.6.0-dev.20211119") does not allow top-level await anymore, even though it says:
error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
my ts config has
it also does not work with node12 (obviously) or other target settings. It does work with module esnext though
🔎 Search Terms
nodenext, top-level await
🕗 Version & Regression Information
I'm not 100% sure, but I believe it worked in the ts4.5 alpha already.
🙁 Actual behavior
cannot compile something like this
in top-level code.
🙂 Expected behavior
should compile
The text was updated successfully, but these errors were encountered: