151 lines
3.1 KiB
Text
151 lines
3.1 KiB
Text
=== tests/cases/compiler/underscoreMapFirst.ts ===
|
|
declare module _ {
|
|
>_ : typeof _
|
|
|
|
interface Collection<T> { }
|
|
>Collection : Collection<T>
|
|
>T : T
|
|
|
|
interface List<T> extends Collection<T> {
|
|
>List : List<T>
|
|
>T : T
|
|
>Collection : Collection<T>
|
|
>T : T
|
|
|
|
[index: number]: T;
|
|
>index : number
|
|
>T : T
|
|
|
|
length: number;
|
|
>length : number
|
|
}
|
|
|
|
interface ListIterator<T, TResult> {
|
|
>ListIterator : ListIterator<T, TResult>
|
|
>T : T
|
|
>TResult : TResult
|
|
|
|
(value: T, index: number, list: T[]): TResult;
|
|
>value : T
|
|
>T : T
|
|
>index : number
|
|
>list : T[]
|
|
>T : T
|
|
>TResult : TResult
|
|
}
|
|
|
|
interface Dictionary<T> extends Collection<T> {
|
|
>Dictionary : Dictionary<T>
|
|
>T : T
|
|
>Collection : Collection<T>
|
|
>T : T
|
|
|
|
[index: string]: T;
|
|
>index : string
|
|
>T : T
|
|
}
|
|
export function pluck<T extends {}>(
|
|
>pluck : <T extends {}>(list: Collection<T>, propertyName: string) => any[]
|
|
>T : T
|
|
|
|
list: Collection<T>,
|
|
>list : Collection<T>
|
|
>Collection : Collection<T>
|
|
>T : T
|
|
|
|
propertyName: string): any[];
|
|
>propertyName : string
|
|
|
|
export function map<T, TResult>(
|
|
>map : <T, TResult>(list: List<T>, iterator: ListIterator<T, TResult>, context?: any) => TResult[]
|
|
>T : T
|
|
>TResult : TResult
|
|
|
|
list: List<T>,
|
|
>list : List<T>
|
|
>List : List<T>
|
|
>T : T
|
|
|
|
iterator: ListIterator<T, TResult>,
|
|
>iterator : ListIterator<T, TResult>
|
|
>ListIterator : ListIterator<T, TResult>
|
|
>T : T
|
|
>TResult : TResult
|
|
|
|
context?: any): TResult[];
|
|
>context : any
|
|
>TResult : TResult
|
|
|
|
export function first<T>(array: List<T>): T;
|
|
>first : <T>(array: List<T>) => T
|
|
>T : T
|
|
>array : List<T>
|
|
>List : List<T>
|
|
>T : T
|
|
>T : T
|
|
}
|
|
|
|
declare class View {
|
|
>View : View
|
|
|
|
model: any;
|
|
>model : any
|
|
}
|
|
|
|
interface IData {
|
|
>IData : IData
|
|
|
|
series: ISeries[];
|
|
>series : ISeries[]
|
|
>ISeries : ISeries
|
|
}
|
|
|
|
interface ISeries {
|
|
>ISeries : ISeries
|
|
|
|
items: any[];
|
|
>items : any[]
|
|
|
|
key: string;
|
|
>key : string
|
|
}
|
|
|
|
class MyView extends View {
|
|
>MyView : MyView
|
|
>View : View
|
|
|
|
public getDataSeries(): ISeries[] {
|
|
>getDataSeries : () => ISeries[]
|
|
>ISeries : ISeries
|
|
|
|
var data: IData[] = this.model.get("data");
|
|
>data : IData[]
|
|
>IData : IData
|
|
>this.model.get("data") : any
|
|
>this.model.get : any
|
|
>this.model : any
|
|
>this : MyView
|
|
>model : any
|
|
>get : any
|
|
|
|
var allSeries: ISeries[][] = _.pluck(data, "series");
|
|
>allSeries : ISeries[][]
|
|
>ISeries : ISeries
|
|
>_.pluck(data, "series") : any[]
|
|
>_.pluck : <T extends {}>(list: _.Collection<T>, propertyName: string) => any[]
|
|
>_ : typeof _
|
|
>pluck : <T extends {}>(list: _.Collection<T>, propertyName: string) => any[]
|
|
>data : IData[]
|
|
|
|
return _.map(allSeries, _.first);
|
|
>_.map(allSeries, _.first) : ISeries[]
|
|
>_.map : <T, TResult>(list: _.List<T>, iterator: _.ListIterator<T, TResult>, context?: any) => TResult[]
|
|
>_ : typeof _
|
|
>map : <T, TResult>(list: _.List<T>, iterator: _.ListIterator<T, TResult>, context?: any) => TResult[]
|
|
>allSeries : ISeries[][]
|
|
>_.first : <T>(array: _.List<T>) => T
|
|
>_ : typeof _
|
|
>first : <T>(array: _.List<T>) => T
|
|
}
|
|
}
|
|
|