microsoft / microsoft/TypeScript

Add a stable module target for top-level await

オープン
#37,709 コメント 4 件 リアクション 0 件 担当者 1 名 GitHub で見る

@rbuckton がすでに取り組んでいます。

2022年10月28日 から。

Needs Investigation
主要言語
Go
スター
111k
フォーク
14.4k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。