Closed
Description
(1.8.0-dev.20151201)
interface Foo<T> { prop: T; }
declare function lift<U>(value: U | Foo<U>): Foo<U>;
function unlift<U>(value: U | Foo<U>): U {
return lift(value).prop; // error TS2322: Type '{}' is not assignable to type 'U'.
}
In 1.6 and 1.7 lift
's generic is correctly inferred as U
, so prop
is of type U
as expected. In 1.8 it's inferred as {}
Explicitly specifying the generic with lift<U>(value).prop
works.