File: typePredicatesInUnion2.types

package info (click to toggle)
node-typescript 5.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 497,488 kB
  • sloc: javascript: 2,107,274; makefile: 6; sh: 1
file content (27 lines) | stat: -rw-r--r-- 841 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//// [tests/cases/compiler/typePredicatesInUnion2.ts] ////

=== typePredicatesInUnion2.ts ===
declare function isString(x: any): x is string;
>isString : (x: any) => x is string
>x : any

declare function isNumber(x: any): x is number;
>isNumber : (x: any) => x is number
>x : any

declare function f(p: typeof isString | typeof isNumber): void;
>f : (p: typeof isString | typeof isNumber) => void
>p : ((x: any) => x is string) | ((x: any) => x is number)
>isString : (x: any) => x is string
>isNumber : (x: any) => x is number

f(isString);
>f(isString) : void
>f : (p: ((x: any) => x is string) | ((x: any) => x is number)) => void
>isString : (x: any) => x is string

f(isNumber);
>f(isNumber) : void
>f : (p: ((x: any) => x is string) | ((x: any) => x is number)) => void
>isNumber : (x: any) => x is number