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

112 lines
3.2 KiB
Plaintext

=== tests/cases/compiler/genericFunctionsWithOptionalParameters3.ts ===
class Collection<T> {
>Collection : Collection<T>
>T : T
public add(x: T) { }
>add : (x: T) => void
>x : T
>T : T
}
interface Utils {
>Utils : Utils
fold<T, S>(c?: Collection<T>, folder?: (s: S, t: T) => T, init?: S): T;
>fold : <T, S>(c?: Collection<T>, folder?: (s: S, t: T) => T, init?: S) => T
>T : T
>S : S
>c : Collection<T>
>Collection : Collection<T>
>T : T
>folder : (s: S, t: T) => T
>s : S
>S : S
>t : T
>T : T
>T : T
>init : S
>S : S
>T : T
mapReduce<T, U, V>(c: Collection<T>, mapper: (x: T) => U, reducer: (y: U) => V): Collection<V>;
>mapReduce : <T, U, V>(c: Collection<T>, mapper: (x: T) => U, reducer: (y: U) => V) => Collection<V>
>T : T
>U : U
>V : V
>c : Collection<T>
>Collection : Collection<T>
>T : T
>mapper : (x: T) => U
>x : T
>T : T
>U : U
>reducer : (y: U) => V
>y : U
>U : U
>V : V
>Collection : Collection<T>
>V : V
}
var utils: Utils;
>utils : Utils
>Utils : Utils
var c = new Collection<string>();
>c : Collection<string>
>new Collection<string>() : Collection<string>
>Collection : typeof Collection
var r3 = utils.mapReduce(c, (x) => { return 1 }, (y) => { return new Date() });
>r3 : Collection<Date>
>utils.mapReduce(c, (x) => { return 1 }, (y) => { return new Date() }) : Collection<Date>
>utils.mapReduce : <T, U, V>(c: Collection<T>, mapper: (x: T) => U, reducer: (y: U) => V) => Collection<V>
>utils : Utils
>mapReduce : <T, U, V>(c: Collection<T>, mapper: (x: T) => U, reducer: (y: U) => V) => Collection<V>
>c : Collection<string>
>(x) => { return 1 } : (x: string) => number
>x : string
>1 : number
>(y) => { return new Date() } : (y: number) => Date
>y : number
>new Date() : Date
>Date : DateConstructor
var r4 = utils.mapReduce(c, (x: string) => { return 1 }, (y: number) => { return new Date() });
>r4 : Collection<Date>
>utils.mapReduce(c, (x: string) => { return 1 }, (y: number) => { return new Date() }) : Collection<Date>
>utils.mapReduce : <T, U, V>(c: Collection<T>, mapper: (x: T) => U, reducer: (y: U) => V) => Collection<V>
>utils : Utils
>mapReduce : <T, U, V>(c: Collection<T>, mapper: (x: T) => U, reducer: (y: U) => V) => Collection<V>
>c : Collection<string>
>(x: string) => { return 1 } : (x: string) => number
>x : string
>1 : number
>(y: number) => { return new Date() } : (y: number) => Date
>y : number
>new Date() : Date
>Date : DateConstructor
var f1 = (x: string) => { return 1 };
>f1 : (x: string) => number
>(x: string) => { return 1 } : (x: string) => number
>x : string
>1 : number
var f2 = (y: number) => { return new Date() };
>f2 : (y: number) => Date
>(y: number) => { return new Date() } : (y: number) => Date
>y : number
>new Date() : Date
>Date : DateConstructor
var r5 = utils.mapReduce(c, f1, f2);
>r5 : Collection<Date>
>utils.mapReduce(c, f1, f2) : Collection<Date>
>utils.mapReduce : <T, U, V>(c: Collection<T>, mapper: (x: T) => U, reducer: (y: U) => V) => Collection<V>
>utils : Utils
>mapReduce : <T, U, V>(c: Collection<T>, mapper: (x: T) => U, reducer: (y: U) => V) => Collection<V>
>c : Collection<string>
>f1 : (x: string) => number
>f2 : (y: number) => Date