=== tests/cases/compiler/underscoreTest1_underscoreTests.ts ===
///
declare var $;
>$ : any
declare function alert(x: string): void;
>alert : (x: string) => void
>x : string
_.each([1, 2, 3], (num) => alert(num.toString()));
>_.each([1, 2, 3], (num) => alert(num.toString())) : void
>_.each : { (list: T[], iterator: Iterator, context?: any): void; (list: Dictionary, iterator: Iterator, context?: any): void; }
>_ : Underscore.Static
>each : { (list: T[], iterator: Iterator, context?: any): void; (list: Dictionary, iterator: Iterator, context?: any): void; }
>[1, 2, 3] : number[]
>(num) => alert(num.toString()) : (num: number) => void
>num : number
>alert(num.toString()) : void
>alert : (x: string) => void
>num.toString() : string
>num.toString : (radix?: number) => string
>num : number
>toString : (radix?: number) => string
_.each({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => alert(value.toString()));
>_.each({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => alert(value.toString())) : void
>_.each : { (list: T[], iterator: Iterator, context?: any): void; (list: Dictionary, iterator: Iterator, context?: any): void; }
>_ : Underscore.Static
>each : { (list: T[], iterator: Iterator, context?: any): void; (list: Dictionary, iterator: Iterator, context?: any): void; }
>{ one: 1, two: 2, three: 3 } : { [x: string]: number; one: number; two: number; three: number; }
>one : number
>two : number
>three : number
>(value: number, key?: string) => alert(value.toString()) : (value: number, key?: string) => void
>value : number
>key : string
>alert(value.toString()) : void
>alert : (x: string) => void
>value.toString() : string
>value.toString : (radix?: number) => string
>value : number
>toString : (radix?: number) => string
_.map([1, 2, 3], (num) => num * 3);
>_.map([1, 2, 3], (num) => num * 3) : number[]
>_.map : { (list: T[], iterator: Iterator, context?: any): U[]; (list: Dictionary, iterator: Iterator, context?: any): U[]; }
>_ : Underscore.Static
>map : { (list: T[], iterator: Iterator, context?: any): U[]; (list: Dictionary, iterator: Iterator, context?: any): U[]; }
>[1, 2, 3] : number[]
>(num) => num * 3 : (num: number) => number
>num : number
>num * 3 : number
>num : number
_.map({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => value * 3);
>_.map({ one: 1, two: 2, three: 3 }, (value: number, key?: string) => value * 3) : number[]
>_.map : { (list: T[], iterator: Iterator, context?: any): U[]; (list: Dictionary, iterator: Iterator, context?: any): U[]; }
>_ : Underscore.Static
>map : { (list: T[], iterator: Iterator, context?: any): U[]; (list: Dictionary, iterator: Iterator, context?: any): U[]; }
>{ one: 1, two: 2, three: 3 } : { [x: string]: number; one: number; two: number; three: number; }
>one : number
>two : number
>three : number
>(value: number, key?: string) => value * 3 : (value: number, key?: string) => number
>value : number
>key : string
>value * 3 : number
>value : number
var sum = _.reduce([1, 2, 3], (memo, num) => memo + num, 0);
>sum : number
>_.reduce([1, 2, 3], (memo, num) => memo + num, 0) : number
>_.reduce : { (list: T[], iterator: Reducer, initialValue?: T, context?: any): T; (list: T[], iterator: Reducer, initialValue: U, context?: any): U; (list: Dictionary, iterator: Reducer, initialValue?: T, context?: any): T; (list: Dictionary, iterator: Reducer, initialValue: U, context?: any): U; }
>_ : Underscore.Static
>reduce : { (list: T[], iterator: Reducer, initialValue?: T, context?: any): T; (list: T[], iterator: Reducer, initialValue: U, context?: any): U; (list: Dictionary, iterator: Reducer, initialValue?: T, context?: any): T; (list: Dictionary, iterator: Reducer, initialValue: U, context?: any): U; }
>[1, 2, 3] : number[]
>(memo, num) => memo + num : (memo: number, num: number) => number
>memo : number
>num : number
>memo + num : number
>memo : number
>num : number
var list = [[0, 1], [2, 3], [4, 5]];
>list : number[][]
>[[0, 1], [2, 3], [4, 5]] : number[][]
>[0, 1] : number[]
>[2, 3] : number[]
>[4, 5] : number[]
var flat = _.reduceRight(list, (a, b) => a.concat(b), []);
>flat : number[]
>_.reduceRight(list, (a, b) => a.concat(b), []) : number[]
>_.reduceRight : { (list: T[], iterator: Reducer, initialValue?: T, context?: any): T; (list: T[], iterator: Reducer, initialValue: U, context?: any): U; (list: Dictionary, iterator: Reducer, initialValue?: T, context?: any): T; (list: Dictionary, iterator: Reducer, initialValue: U, context?: any): U; }
>_ : Underscore.Static
>reduceRight : { (list: T[], iterator: Reducer, initialValue?: T, context?: any): T; (list: T[], iterator: Reducer, initialValue: U, context?: any): U; (list: Dictionary, iterator: Reducer, initialValue?: T, context?: any): T; (list: Dictionary, iterator: Reducer, initialValue: U, context?: any): U; }
>list : number[][]
>(a, b) => a.concat(b) : (a: number[], b: number[]) => number[]
>a : number[]
>b : number[]
>a.concat(b) : number[]
>a.concat : { (...items: U[]): number[]; (...items: number[]): number[]; }
>a : number[]
>concat : { (...items: U[]): number[]; (...items: number[]): number[]; }
>b : number[]
>[] : undefined[]
var even = _.find([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0);
>even : number
>_.find([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0) : number
>_.find : { (list: T[], iterator: Iterator, context?: any): T; (list: Dictionary, iterator: Iterator, context?: any): T; }
>_ : Underscore.Static
>find : { (list: T[], iterator: Iterator, context?: any): T; (list: Dictionary, iterator: Iterator, context?: any): T; }
>[1, 2, 3, 4, 5, 6] : number[]
>(num) => num % 2 == 0 : (num: number) => boolean
>num : number
>num % 2 == 0 : boolean
>num % 2 : number
>num : number
var evens = _.filter([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0);
>evens : number[]
>_.filter([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0) : number[]
>_.filter : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; }
>_ : Underscore.Static
>filter : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; }
>[1, 2, 3, 4, 5, 6] : number[]
>(num) => num % 2 == 0 : (num: number) => boolean
>num : number
>num % 2 == 0 : boolean
>num % 2 : number
>num : number
var listOfPlays = [{ title: "Cymbeline", author: "Shakespeare", year: 1611 }, { title: "The Tempest", author: "Shakespeare", year: 1611 }, { title: "Other", author: "Not Shakespeare", year: 2012 }];
>listOfPlays : { title: string; author: string; year: number; }[]
>[{ title: "Cymbeline", author: "Shakespeare", year: 1611 }, { title: "The Tempest", author: "Shakespeare", year: 1611 }, { title: "Other", author: "Not Shakespeare", year: 2012 }] : { title: string; author: string; year: number; }[]
>{ title: "Cymbeline", author: "Shakespeare", year: 1611 } : { title: string; author: string; year: number; }
>title : string
>author : string
>year : number
>{ title: "The Tempest", author: "Shakespeare", year: 1611 } : { title: string; author: string; year: number; }
>title : string
>author : string
>year : number
>{ title: "Other", author: "Not Shakespeare", year: 2012 } : { title: string; author: string; year: number; }
>title : string
>author : string
>year : number
_.where(listOfPlays, { author: "Shakespeare", year: 1611 });
>_.where(listOfPlays, { author: "Shakespeare", year: 1611 }) : { title: string; author: string; year: number; }[]
>_.where : { (list: T[], properties: Object): T[]; (list: Dictionary, properties: Object): T[]; }
>_ : Underscore.Static
>where : { (list: T[], properties: Object): T[]; (list: Dictionary, properties: Object): T[]; }
>listOfPlays : { title: string; author: string; year: number; }[]
>{ author: "Shakespeare", year: 1611 } : { author: string; year: number; }
>author : string
>year : number
var odds = _.reject([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0);
>odds : number[]
>_.reject([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0) : number[]
>_.reject : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; }
>_ : Underscore.Static
>reject : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; }
>[1, 2, 3, 4, 5, 6] : number[]
>(num) => num % 2 == 0 : (num: number) => boolean
>num : number
>num % 2 == 0 : boolean
>num % 2 : number
>num : number
_.all([true, 1, null, 'yes'], _.identity);
>_.all([true, 1, null, 'yes'], _.identity) : boolean
>_.all : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; }
>_ : Underscore.Static
>all : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; }
>[true, 1, null, 'yes'] : (string | number | boolean)[]
>_.identity : (value: T) => T
>_ : Underscore.Static
>identity : (value: T) => T
_.any([null, 0, 'yes', false]);
>_.any([null, 0, 'yes', false]) : boolean
>_.any : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; }
>_ : Underscore.Static
>any : { (list: T[], iterator?: Iterator, context?: any): boolean; (list: Dictionary, iterator?: Iterator, context?: any): boolean; }
>[null, 0, 'yes', false] : (string | number | boolean)[]
_.contains([1, 2, 3], 3);
>_.contains([1, 2, 3], 3) : boolean
>_.contains : { (list: T[], value: T): boolean; (list: Dictionary, value: T): boolean; }
>_ : Underscore.Static
>contains : { (list: T[], value: T): boolean; (list: Dictionary, value: T): boolean; }
>[1, 2, 3] : number[]
_.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
>_.invoke([[5, 1, 7], [3, 2, 1]], 'sort') : any[]
>_.invoke : { (list: any[], methodName: string, ...args: any[]): any[]; (list: Dictionary, methodName: string, ...args: any[]): any[]; }
>_ : Underscore.Static
>invoke : { (list: any[], methodName: string, ...args: any[]): any[]; (list: Dictionary, methodName: string, ...args: any[]): any[]; }
>[[5, 1, 7], [3, 2, 1]] : number[][]
>[5, 1, 7] : number[]
>[3, 2, 1] : number[]
var stooges = [{ name: 'moe', age: 40 }, { name: 'larry', age: 50 }, { name: 'curly', age: 60 }];
>stooges : { name: string; age: number; }[]
>[{ name: 'moe', age: 40 }, { name: 'larry', age: 50 }, { name: 'curly', age: 60 }] : { name: string; age: number; }[]
>{ name: 'moe', age: 40 } : { name: string; age: number; }
>name : string
>age : number
>{ name: 'larry', age: 50 } : { name: string; age: number; }
>name : string
>age : number
>{ name: 'curly', age: 60 } : { name: string; age: number; }
>name : string
>age : number
_.pluck(stooges, 'name');
>_.pluck(stooges, 'name') : any[]
>_.pluck : { (list: any[], propertyName: string): any[]; (list: Dictionary, propertyName: string): any[]; }
>_ : Underscore.Static
>pluck : { (list: any[], propertyName: string): any[]; (list: Dictionary, propertyName: string): any[]; }
>stooges : { name: string; age: number; }[]
_.max(stooges, (stooge) => stooge.age);
>_.max(stooges, (stooge) => stooge.age) : { name: string; age: number; }
>_.max : { (list: T[], iterator?: Iterator, context?: any): T; (list: Dictionary, iterator?: Iterator, context?: any): T; }
>_ : Underscore.Static
>max : { (list: T[], iterator?: Iterator, context?: any): T; (list: Dictionary, iterator?: Iterator, context?: any): T; }
>stooges : { name: string; age: number; }[]
>(stooge) => stooge.age : (stooge: { name: string; age: number; }) => number
>stooge : { name: string; age: number; }
>stooge.age : number
>stooge : { name: string; age: number; }
>age : number
var numbers = [10, 5, 100, 2, 1000];
>numbers : number[]
>[10, 5, 100, 2, 1000] : number[]
_.min(numbers);
>_.min(numbers) : number
>_.min : { (list: T[], iterator?: Iterator, context?: any): T; (list: Dictionary, iterator?: Iterator, context?: any): T; }
>_ : Underscore.Static
>min : { (list: T[], iterator?: Iterator, context?: any): T; (list: Dictionary, iterator?: Iterator, context?: any): T; }
>numbers : number[]
_.sortBy([1, 2, 3, 4, 5, 6], (num) => Math.sin(num));
>_.sortBy([1, 2, 3, 4, 5, 6], (num) => Math.sin(num)) : number[]
>_.sortBy : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; (list: T[], propertyName: string): T[]; (list: Dictionary, propertyName: string): T[]; }
>_ : Underscore.Static
>sortBy : { (list: T[], iterator: Iterator, context?: any): T[]; (list: Dictionary, iterator: Iterator, context?: any): T[]; (list: T[], propertyName: string): T[]; (list: Dictionary, propertyName: string): T[]; }
>[1, 2, 3, 4, 5, 6] : number[]
>(num) => Math.sin(num) : (num: number) => number
>num : number
>Math.sin(num) : number
>Math.sin : (x: number) => number
>Math : Math
>sin : (x: number) => number
>num : number
// not sure how this is typechecking at all.. Math.floor(e) is number not string..?
_([1.3, 2.1, 2.4]).groupBy((e: number, i?: number, list?: number[]) => Math.floor(e));
>_([1.3, 2.1, 2.4]).groupBy((e: number, i?: number, list?: number[]) => Math.floor(e)) : Dictionary
>_([1.3, 2.1, 2.4]).groupBy : { (iterator?: Iterator, context?: any): Dictionary; (propertyName: string): Dictionary; }
>_([1.3, 2.1, 2.4]) : Underscore.WrappedArray
>_ : Underscore.Static
>[1.3, 2.1, 2.4] : number[]
>groupBy : { (iterator?: Iterator, context?: any): Dictionary; (propertyName: string): Dictionary; }
>(e: number, i?: number, list?: number[]) => Math.floor(e) : (e: number, i?: number, list?: number[]) => number
>e : number
>i : number
>list : number[]
>Math.floor(e) : number
>Math.floor : (x: number) => number
>Math : Math
>floor : (x: number) => number
>e : number
_.groupBy([1.3, 2.1, 2.4], (num: number) => Math.floor(num));
>_.groupBy([1.3, 2.1, 2.4], (num: number) => Math.floor(num)) : Dictionary
>_.groupBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; }
>_ : Underscore.Static
>groupBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; }
>[1.3, 2.1, 2.4] : number[]
>(num: number) => Math.floor(num) : (num: number) => number
>num : number
>Math.floor(num) : number
>Math.floor : (x: number) => number
>Math : Math
>floor : (x: number) => number
>num : number
_.groupBy(['one', 'two', 'three'], 'length');
>_.groupBy(['one', 'two', 'three'], 'length') : Dictionary
>_.groupBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; }
>_ : Underscore.Static
>groupBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary; (list: Dictionary, propertyName: string): Dictionary; }
>['one', 'two', 'three'] : string[]
_.countBy([1, 2, 3, 4, 5], (num) => num % 2 == 0 ? 'even' : 'odd');
>_.countBy([1, 2, 3, 4, 5], (num) => num % 2 == 0 ? 'even' : 'odd') : Dictionary
>_.countBy : { (list: T[], iterator?: Iterator, context?: any): Dictionary; (list: Dictionary, iterator?: Iterator, context?: any): Dictionary; (list: T[], propertyName: string): Dictionary;