1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
//// [tests/cases/compiler/typeInferenceTypePredicate.ts] ////
=== typeInferenceTypePredicate.ts ===
declare function f<T>(predicate: (x: {}) => x is T): T;
>f : <T>(predicate: (x: {}) => x is T) => T
>predicate : (x: {}) => x is T
>x : {}
// 'res' should be of type 'number'.
const res = f((n): n is number => true);
>res : number
>f((n): n is number => true) : number
>f : <T>(predicate: (x: {}) => x is T) => T
>(n): n is number => true : (n: {}) => n is number
>n : {}
>true : true
|