export {}; declare global { interface Array { flatMap(callbackfn: (value: T, index: number, array: T[]) => U[] | undefined, thisArg?: any): U[]; } } Object.defineProperty(Array.prototype, 'flatMap', { value: function(this: Array, callbackfn: (value: T, index: number, array: T[]) => U[], thisArg?: any): U[] { return [].concat.apply([], this.map(callbackfn, thisArg)); }, enumerable: false });