mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
97 lines
5.9 KiB
Plaintext
97 lines
5.9 KiB
Plaintext
awaitInNonAsyncFunction.ts(4,7): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
|
awaitInNonAsyncFunction.ts(5,10): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
|
|
awaitInNonAsyncFunction.ts(9,7): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
|
awaitInNonAsyncFunction.ts(10,10): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
|
|
awaitInNonAsyncFunction.ts(14,7): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
|
awaitInNonAsyncFunction.ts(15,3): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
|
|
awaitInNonAsyncFunction.ts(19,7): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
|
awaitInNonAsyncFunction.ts(20,10): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
|
|
awaitInNonAsyncFunction.ts(24,7): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
|
awaitInNonAsyncFunction.ts(25,9): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
|
|
awaitInNonAsyncFunction.ts(30,9): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
|
awaitInNonAsyncFunction.ts(31,5): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
|
|
awaitInNonAsyncFunction.ts(34,7): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
|
awaitInNonAsyncFunction.ts(35,5): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
|
|
|
|
|
|
==== awaitInNonAsyncFunction.ts (14 errors) ====
|
|
// https://github.com/Microsoft/TypeScript/issues/26586
|
|
|
|
function normalFunc(p: Promise<number>) {
|
|
for await (const _ of []);
|
|
~~~~~
|
|
!!! error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
|
!!! related TS1356 awaitInNonAsyncFunction.ts:3:10: Did you mean to mark this function as 'async'?
|
|
return await p;
|
|
~~~~~
|
|
!!! error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
|
|
!!! related TS1356 awaitInNonAsyncFunction.ts:3:10: Did you mean to mark this function as 'async'?
|
|
}
|
|
|
|
export function exportedFunc(p: Promise<number>) {
|
|
for await (const _ of []);
|
|
~~~~~
|
|
!!! error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
|
!!! related TS1356 awaitInNonAsyncFunction.ts:8:17: Did you mean to mark this function as 'async'?
|
|
return await p;
|
|
~~~~~
|
|
!!! error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
|
|
!!! related TS1356 awaitInNonAsyncFunction.ts:8:17: Did you mean to mark this function as 'async'?
|
|
}
|
|
|
|
const functionExpression = function(p: Promise<number>) {
|
|
for await (const _ of []);
|
|
~~~~~
|
|
!!! error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
|
!!! related TS1356 awaitInNonAsyncFunction.ts:13:7: Did you mean to mark this function as 'async'?
|
|
await p;
|
|
~~~~~
|
|
!!! error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
|
|
!!! related TS1356 awaitInNonAsyncFunction.ts:13:7: Did you mean to mark this function as 'async'?
|
|
}
|
|
|
|
const arrowFunc = (p: Promise<number>) => {
|
|
for await (const _ of []);
|
|
~~~~~
|
|
!!! error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
|
!!! related TS1356 awaitInNonAsyncFunction.ts:18:19: Did you mean to mark this function as 'async'?
|
|
return await p;
|
|
~~~~~
|
|
!!! error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
|
|
!!! related TS1356 awaitInNonAsyncFunction.ts:18:19: Did you mean to mark this function as 'async'?
|
|
};
|
|
|
|
function* generatorFunc(p: Promise<number>) {
|
|
for await (const _ of []);
|
|
~~~~~
|
|
!!! error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
|
!!! related TS1356 awaitInNonAsyncFunction.ts:23:11: Did you mean to mark this function as 'async'?
|
|
yield await p;
|
|
~~~~~
|
|
!!! error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
|
|
!!! related TS1356 awaitInNonAsyncFunction.ts:23:11: Did you mean to mark this function as 'async'?
|
|
}
|
|
|
|
class clazz {
|
|
constructor(p: Promise<number>) {
|
|
for await (const _ of []);
|
|
~~~~~
|
|
!!! error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
|
await p;
|
|
~~~~~
|
|
!!! error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
|
|
}
|
|
method(p: Promise<number>) {
|
|
for await (const _ of []);
|
|
~~~~~
|
|
!!! error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
|
!!! related TS1356 awaitInNonAsyncFunction.ts:33:3: Did you mean to mark this function as 'async'?
|
|
await p;
|
|
~~~~~
|
|
!!! error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
|
|
!!! related TS1356 awaitInNonAsyncFunction.ts:33:3: Did you mean to mark this function as 'async'?
|
|
}
|
|
}
|
|
|
|
for await (const _ of []);
|
|
await null; |