File: typeGuardOfFormFunctionEquality.types

package info (click to toggle)
node-typescript 2.1.5-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 203,960 kB
  • sloc: sh: 11; makefile: 5
file content (54 lines) | stat: -rw-r--r-- 1,272 bytes parent folder | download | duplicates (2)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
=== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormFunctionEquality.ts ===
declare function isString1(a: number, b: Object): b is string;
>isString1 : (a: number, b: Object) => b is string
>a : number
>b : Object
>Object : Object
>b : any

declare function isString2(a: Object): a is string;
>isString2 : (a: Object) => a is string
>a : Object
>Object : Object
>a : any

switch (isString1(0, "")) {
>isString1(0, "") : boolean
>isString1 : (a: number, b: Object) => b is string
>0 : 0
>"" : ""

    case isString2(""):
>isString2("") : boolean
>isString2 : (a: Object) => a is string
>"" : ""

    default:
}

var x = isString1(0, "") === isString2("");
>x : boolean
>isString1(0, "") === isString2("") : boolean
>isString1(0, "") : boolean
>isString1 : (a: number, b: Object) => b is string
>0 : 0
>"" : ""
>isString2("") : boolean
>isString2 : (a: Object) => a is string
>"" : ""

function isString3(a: number, b: number, c: Object): c is string {
>isString3 : (a: number, b: number, c: Object) => c is string
>a : number
>b : number
>c : Object
>Object : Object
>c : any

    return isString1(0, c);
>isString1(0, c) : boolean
>isString1 : (a: number, b: Object) => b is string
>0 : 0
>c : Object
}