microsoft / microsoft/TypeScript

Add a stable module target for top-level await

Offen
#37,709 4 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@rbuckton arbeitet bereits daran.

Seit 28.10.2022.

Needs Investigation
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.4k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

TypeScript Version:
3.9-beta

Search Terms:
top level await es2020 module

tsconfig.json
"target":"es2020"
"module":"es2020"

Code

await 1;

Expected behavior:

OK if "module":"esnext" in tsconfig.json
OK if "module":"es2020" in tsconfig.json

Actual behavior:

OK if "module":"esnext" in tsconfig.json
KO if "module":"es2020" in tsconfig.json <----- :'(

Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. ts(1378)

Playground Link:

"module":"es2020" is not available on Typescript playground.
"module":"es2020" is not available in documentation.

Related Issues:

https://github.com/microsoft/TypeScript/pull/35813 - Add top-level await for esnext and system modules

Basically, just add "es2020" to the list.
Easy to fix, bro.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.