FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add top-level await for esnext and system modules by rbuckton · Pull Request #35813 · microsoft/TypeScript · GitHub

Add top-level await for esnext and system modules - #35813

Merged
Ron Buckton (rbuckton) merged 1 commit into
masterfrom
topLevelAwait
Dec 22, 2019
Merged

Add top-level await for esnext and system modules#35813
Ron Buckton (rbuckton) merged 1 commit into
masterfrom
topLevelAwait

Conversation

Ron Buckton (rbuckton) commented Dec 21, 2019
edited
Loading

Copy link
Copy Markdown
Contributor

This removes our restriction around using an await expression at the top level of a file when the following conditions are met:

  • The containing file is an external module (or --isolatedModules is provided)
  • The --target is >= ScriptTarget.ES2017 (minimum version required for await keyword)
  • The --module is either esnext or system.

This is not currently supported for earlier script targets (e.g., ES2016, ES2015, ES5, ES3) as the system transform currently happens after async functions and generators have been transformed, so it is too late to transform the async function that is created as part of the system module transform. This also ensures it is consistent with --target es5 --module esnext, as there would be no way to down-level the await in that context either.

Fixes #25988, #32793

Ron Buckton (rbuckton) merged commit 114dad7 into master Dec 22, 2019
Ron Buckton (rbuckton) deleted the topLevelAwait branch December 22, 2019 21:24

Copy link
Copy Markdown

Thank you, Ron Buckton (@rbuckton). I'm looking forward to using this!

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Top Level Await

3 participants


Back | FazBrowse Home | New Git URL