//// [underscoreMapFirst.ts] declare module _ { interface Collection { } interface List extends Collection { [index: number]: T; length: number; } interface ListIterator { (value: T, index: number, list: T[]): TResult; } interface Dictionary extends Collection { [index: string]: T; } export function pluck( list: Collection, propertyName: string): any[]; export function map( list: List, iterator: ListIterator, context?: any): TResult[]; export function first(array: List): T; } declare class View { model: any; } interface IData { series: ISeries[]; } interface ISeries { items: any[]; key: string; } class MyView extends View { public getDataSeries(): ISeries[] { var data: IData[] = this.model.get("data"); var allSeries: ISeries[][] = _.pluck(data, "series"); return _.map(allSeries, _.first); } } //// [underscoreMapFirst.js] var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } __.prototype = b.prototype; d.prototype = new __(); }; var MyView = (function (_super) { __extends(MyView, _super); function MyView() { _super.apply(this, arguments); } MyView.prototype.getDataSeries = function () { var data = this.model.get("data"); var allSeries = _.pluck(data, "series"); return _.map(allSeries, _.first); }; return MyView; })(View);