未验证 提交 ae26a9c7 编写于 作者: R Ryan Dahl 提交者: GitHub

Support top-level-await in TypeScript (#3024)

上级 5f7ab488
......@@ -567,3 +567,8 @@ itest!(top_level_await {
args: "--allow-read top_level_await.js",
output: "top_level_await.out",
});
itest!(top_level_await_ts {
args: "--allow-read top_level_await.ts",
output: "top_level_await.out",
});
const buf: Uint8Array = await Deno.readFile("hello.txt");
const n: number = await Deno.stdout.write(buf);
console.log(`\n\nwrite ${n}`);
......@@ -539,6 +539,9 @@ window.compilerMain = function compilerMain(): void {
diagnostics = ts.getPreEmitDiagnostics(program).filter(
({ code }): boolean => {
// TS1308: 'await' expression is only allowed within an async
// function.
if (code === 1308) return false;
// TS2691: An import path cannot end with a '.ts' extension. Consider
// importing 'bad-module' instead.
if (code === 2691) return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册