Files

15 lines
651 B
Plaintext

awaitAndYield.ts(3,15): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
awaitAndYield.ts(4,15): error TS1163: A 'yield' expression is only allowed in a generator body.
==== awaitAndYield.ts (2 errors) ====
async function* test(x: Promise<number>) {
enum E {
foo = await x,
~~~~~
!!! error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
baz = yield 1,
~~~~~
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
}
}