1declare module _ { 2 interface Collection<T> { } 3 interface List<T> extends Collection<T> { 4 [index: number]: T; 5 length: number; 6 } 7 8 interface ListIterator<T, TResult> { 9 (value: T, index: number, list: T[]): TResult; 10 } 11 12 interface Dictionary<T> extends Collection<T> { 13 [index: string]: T; 14 } 15 export function pluck<T extends {}>( 16 list: Collection<T>, 17 propertyName: string): any[]; 18 19 export function map<T, TResult>( 20 list: List<T>, 21 iterator: ListIterator<T, TResult>, 22 context?: any): TResult[]; 23 24 export function first<T>(array: List<T>): T; 25} 26 27declare class View { 28 model: any; 29} 30 31interface IData { 32 series: ISeries[]; 33} 34 35interface ISeries { 36 items: any[]; 37 key: string; 38} 39 40class MyView extends View { 41 public getDataSeries(): ISeries[] { 42 var data: IData[] = this.model.get("data"); 43 var allSeries: ISeries[][] = _.pluck(data, "series"); 44 45 return _.map(allSeries, _.first); 46 } 47} 48