File: callbacksDontShareTypes.types

package info (click to toggle)
node-typescript 2.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 203,952 kB
  • ctags: 52,987
  • sloc: sh: 11; makefile: 5
file content (110 lines) | stat: -rw-r--r-- 3,752 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
=== tests/cases/compiler/callbacksDontShareTypes.ts ===
interface Collection<T> {
>Collection : Collection<T>
>T : T

    length: number;
>length : number

    add(x: T): void;
>add : (x: T) => void
>x : T
>T : T

    remove(x: T): boolean;
>remove : (x: T) => boolean
>x : T
>T : T
}
interface Combinators {
>Combinators : Combinators

    map<T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>;
>map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
>T : T
>U : U
>c : Collection<T>
>Collection : Collection<T>
>T : T
>f : (x: T) => U
>x : T
>T : T
>U : U
>Collection : Collection<T>
>U : U

    map<T>(c: Collection<T>, f: (x: T) => any): Collection<any>;
>map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
>T : T
>c : Collection<T>
>Collection : Collection<T>
>T : T
>f : (x: T) => any
>x : T
>T : T
>Collection : Collection<T>
}

var _: Combinators;
>_ : Combinators
>Combinators : Combinators

var c2: Collection<number>;
>c2 : Collection<number>
>Collection : Collection<T>

var rf1 = (x: number) => { return x.toFixed() };
>rf1 : (x: number) => string
>(x: number) => { return x.toFixed() } : (x: number) => string
>x : number
>x.toFixed() : string
>x.toFixed : (fractionDigits?: number) => string
>x : number
>toFixed : (fractionDigits?: number) => string

var r1a = _.map(c2, (x) => { return x.toFixed() });
>r1a : Collection<string>
>_.map(c2, (x) => { return x.toFixed() }) : Collection<string>
>_.map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
>_ : Combinators
>map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
>c2 : Collection<number>
>(x) => { return x.toFixed() } : (x: number) => string
>x : number
>x.toFixed() : string
>x.toFixed : (fractionDigits?: number) => string
>x : number
>toFixed : (fractionDigits?: number) => string

var r1b = _.map(c2, rf1); // this line should not cause the following 2 to have errors 
>r1b : Collection<string>
>_.map(c2, rf1) : Collection<string>
>_.map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
>_ : Combinators
>map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
>c2 : Collection<number>
>rf1 : (x: number) => string

var r5a = _.map<number, string>(c2, (x) => { return x.toFixed() });
>r5a : Collection<string>
>_.map<number, string>(c2, (x) => { return x.toFixed() }) : Collection<string>
>_.map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
>_ : Combinators
>map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
>c2 : Collection<number>
>(x) => { return x.toFixed() } : (x: number) => string
>x : number
>x.toFixed() : string
>x.toFixed : (fractionDigits?: number) => string
>x : number
>toFixed : (fractionDigits?: number) => string

var r5b = _.map<number, string>(c2, rf1);
>r5b : Collection<string>
>_.map<number, string>(c2, rf1) : Collection<string>
>_.map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
>_ : Combinators
>map : { <T, U>(c: Collection<T>, f: (x: T) => U): Collection<U>; <T>(c: Collection<T>, f: (x: T) => any): Collection<any>; }
>c2 : Collection<number>
>rf1 : (x: number) => string