TypeScript/tests/baselines/reference/callbacksDontShareTypes.types
2015-04-15 16:44:20 -07:00

111 lines
3.7 KiB
Plaintext

=== 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