TypeScript Version: 2.5.3 and 2.7.0-dev.20171101
Code
type T1 = { t: 1 };
type T2 = { t: 2 };
function isT1(x: any): x is T1 {
return x.t === 1;
}
function isT2(x: any): x is T2 {
return x.t === 2;
}
function f(p: typeof isT1 | typeof isT2) {
}
f(isT1);
f(isT2); // fails
Playground link
Expected behavior:
It compiles
Actual behavior:
Fails to compile:
Argument of type '(x: any) => x is T2' is not assignable to parameter of type '(x: any) => x is T1'.
Type predicate 'x is T2' is not assignable to 'x is T1'.
Type 'T2' is not assignable to type 'T1'.
Types of property 't' are incompatible.
Type '2' is not assignable to type '1'
TypeScript Version: 2.5.3 and 2.7.0-dev.20171101
Code
Playground link
Expected behavior:
It compiles
Actual behavior:
Fails to compile: