-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Description
This is fine:
const x = await 1;
This is not:
const x = await (1 + 2);
It exits with: error TS2304: Cannot find name 'await'.
$ deno -v
deno: 0.24.0
v8: 8.0.192
typescript: 3.7.2
The above is the most minimal example that shows this.
More realistic use case - if I have a promise p
like this:
const p = Promise.resolve({ x: Promise.resolve(1) });
I cannot get to the value 1
in one step:
const val = await (await p).x;
It exits with: error TS2304: Cannot find name 'await'.
I have to do it in two steps:
const tmp = (await p).x;
const val = await tmp;
I suppose that those are the parentheses (maybe the compiler thinks it is a function call?) but I can be wrong here.
brainkim, krzkaczor and jgoc
Metadata
Metadata
Assignees
Labels
No labels