Skip to content

Commit 553dfef

Browse files
committed
fix(46149): Add specific top level await error messages
1 parent c89c9c3 commit 553dfef

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/baselines/reference/awaitInNonAsyncFunction.errors.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ tests/cases/compiler/awaitInNonAsyncFunction.ts(30,9): error TS1103: 'for await'
1212
tests/cases/compiler/awaitInNonAsyncFunction.ts(31,5): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
1313
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.
1414
tests/cases/compiler/awaitInNonAsyncFunction.ts(35,5): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
15-
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.
16-
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.
15+
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'.
16+
tests/cases/compiler/awaitInNonAsyncFunction.ts(40,1): error TS1378: The 'module' setting 'ES2015' does not support top-level 'await' expressions. Consider switching to 'ES2022'.
1717

1818

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

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

0 commit comments

Comments
 (0)