TypeScript Version: 3.6.0-dev.20190807 (worked up to 3.6.0-dev.20190804)
Search Terms: await type promise
Code
constcontainsPromises: unique symbol=Symbol();typeDeepPromised<T>={[containsPromises]?: true}&{[TKeyinkeyofT]: T[TKey]|DeepPromised<T[TKey]>|Promise<DeepPromised<T[TKey]>>};asyncfunctionfun<T>(deepPromised: DeepPromised<T>){constdeepPromisedWithIndexer:
DeepPromised<{[name: string]: {}|null|undefined}>=deepPromised;for(constvalueofObject.values(deepPromisedWithIndexer)){constawaitedValue=awaitvalue;if(awaitedValue)awaitfun(awaitedValue);}}(Compile with --strict!)
Expected behavior:
No compile error as in TS 3.5.3.
Actual behavior:
TypeScriptIssueNext.ts:21:23 - error TS2345: Argument of type '{} | ({ [containsPromises]?: true | undefined; } & {})' is not assignable to parameter of type 'DeepPromised<{ [containsPromises]?: undefined; }>'.
Types of property '[containsPromises]' are incompatible.
Type 'true | undefined' is not assignable to type '(true & Promise<never>) | undefined'.
Type 'true' is not assignable to type '(true & Promise<never>) | undefined'.
21 await fun(awaitedValue);
~~~~~~~~~~~~
Playground Link:Here
BTW: Please update the libs in the playground, Object.values() (ES2017) isn't available.
Related Issues: -
TypeScript Version: 3.6.0-dev.20190807 (worked up to 3.6.0-dev.20190804)
Search Terms: await type promise
Code
(Compile with
--strict!)Expected behavior:
No compile error as in TS 3.5.3.
Actual behavior:
Playground Link:Here
BTW: Please update the libs in the playground,
Object.values()(ES2017) isn't available.Related Issues: -