Closed
Description
Identical conditional types are not assignable to each other.
TypeScript Version: 2.8.0-dev.20180208
Code
type Foo<T> = T extends string ? boolean : number;
type Bar<T> = T extends string ? boolean : number;
const convert = <T>(value: Foo<T>): Bar<T> => value; // this fails
type Baz<T> = Foo<T>;
const convert2 = <T>(value: Foo<T>): Baz<T> => value; // this passes
Expected behavior:
no errors
Actual behavior:
TypeScript $ ./node_modules/.bin/tsc --noEmit test.ts
test.ts(4,47): error TS2322: Type 'Foo<T>' is not assignable to type 'Bar<T>'.
Type 'number | boolean' is not assignable to type 'Bar<T>'.
Type 'number' is not assignable to type 'Bar<T>'.