Skip to content

Commit

Permalink
fix(46149): Add specific top level await error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthv96 committed Oct 23, 2021
1 parent c89c9c3 commit 553dfef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/baselines/reference/awaitInNonAsyncFunction.errors.txt
Expand Up @@ -12,8 +12,8 @@ tests/cases/compiler/awaitInNonAsyncFunction.ts(30,9): error TS1103: 'for await'
tests/cases/compiler/awaitInNonAsyncFunction.ts(31,5): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
tests/cases/compiler/awaitInNonAsyncFunction.ts(34,7): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
tests/cases/compiler/awaitInNonAsyncFunction.ts(35,5): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
tests/cases/compiler/awaitInNonAsyncFunction.ts(39,5): error TS1432: Top-level 'for await' loops 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.
tests/cases/compiler/awaitInNonAsyncFunction.ts(40,1): 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.
tests/cases/compiler/awaitInNonAsyncFunction.ts(39,5): error TS1432: The 'module' setting 'ES2015' does not support top-level 'for await' loops. Consider switching to 'ES2022'.
tests/cases/compiler/awaitInNonAsyncFunction.ts(40,1): error TS1378: The 'module' setting 'ES2015' does not support top-level 'await' expressions. Consider switching to 'ES2022'.


==== tests/cases/compiler/awaitInNonAsyncFunction.ts (16 errors) ====
Expand Down Expand Up @@ -97,7 +97,7 @@ tests/cases/compiler/awaitInNonAsyncFunction.ts(40,1): error TS1378: Top-level '

for await (const _ of []);
~~~~~
!!! error TS1432: Top-level 'for await' loops 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.
!!! error TS1432: The 'module' setting 'ES2015' does not support top-level 'for await' loops. Consider switching to 'ES2022'.
await null;
~~~~~
!!! 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.
!!! error TS1378: The 'module' setting 'ES2015' does not support top-level 'await' expressions. Consider switching to 'ES2022'.

0 comments on commit 553dfef

Please sign in to comment.