-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
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.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue