TypeScript Version: 3.1.0-dev.20180801
(works in 3.1.0-dev.20180731)
Code
Simplified from the compile error in DefinitelyTyped/types/ember:
typeComputedPropertyGetters<T>={[KinkeyofT]: ComputedProperty<T[K]>|T[K]};declareclassComputedProperty<T>{t: T;}interfaceArray<T>{get<T,KextendskeyofT>(this: ComputedPropertyGetters<T>,key: K): T[K];firstObject: ComputedProperty<T|undefined>;}constn: number|undefined=[0].get("firstObject");Expected behavior:
No error.
Actual behavior:
src/a.ts:10:7 - error TS2322: Type 'ComputedProperty<number | undefined>' is not assignable to type 'number'.
10 const n: number | undefined = [0].get("firstObject");
The intention was for the following type arguments to be inferred:
[0].get<{firstObject: number|undefined},"firstObject">("firstObject");The code still works when the above type is explicitly provided.
I think this change is due to #26063 (CC Anders Hejlsberg (@ahejlsberg)).
TypeScript Version: 3.1.0-dev.20180801
(works in 3.1.0-dev.20180731)
Code
Simplified from the compile error in
DefinitelyTyped/types/ember:Expected behavior:
No error.
Actual behavior:
The intention was for the following type arguments to be inferred:
The code still works when the above type is explicitly provided.
I think this change is due to #26063 (CC Anders Hejlsberg (@ahejlsberg)).