File: callbacksDontShareTypes.types

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (88 lines) | stat: -rw-r--r-- 3,422 bytes parent folder | download | duplicates (5)
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
=== tests/cases/compiler/callbacksDontShareTypes.ts ===
interface Collection<T> {
    length: number;
>length : number

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

    remove(x: T): boolean;
>remove : (x: T) => boolean
>x : T
}
interface 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>; }
>c : Collection<T>
>f : (x: T) => U
>x : T

    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>; }
>c : Collection<T>
>f : (x: T) => any
>x : T
}

var _: Combinators;
>_ : Combinators

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

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