// flow-typed signature: 2a37b992d69aa44091bbce792686c327 // flow-typed version: 3246e0e09e/underscore_v1.x.x/flow_>=v0.38.x // @flow /* eslint-disable */ // type definitions for (some of) underscore type FnIteratee = (t: T, index: number, array: Array) => boolean; declare module "underscore" { declare type UnaryFn = (a: A) => R; declare type Compose = & (( fg: UnaryFn, ef: UnaryFn, de: UnaryFn, cd: UnaryFn, bc: UnaryFn, ab: UnaryFn, ...rest: Array ) => UnaryFn) & (( ef: UnaryFn, de: UnaryFn, cd: UnaryFn, bc: UnaryFn, ab: UnaryFn, ...rest: Array ) => UnaryFn) & (( de: UnaryFn, cd: UnaryFn, bc: UnaryFn, ab: UnaryFn, ...rest: Array ) => UnaryFn) & ((cd: UnaryFn, bc: UnaryFn, ab: UnaryFn, ...rest: Array) => UnaryFn) & ((bc: UnaryFn, ab: UnaryFn, ...rest: Array) => UnaryFn) & ((ab: UnaryFn, ...rest: Array) => UnaryFn) declare function $underscore$Extend(a: A, ...rest: Array): A; declare function $underscore$Extend(a: A, b: B, ...rest: Array): A & B; declare function $underscore$Extend(a: A, b: B, c: C, ...rest: Array): A & B & C; declare function $underscore$Extend(a: A, b: B, c: C, d: D, ...rest: Array): A & B & C & D; declare function $underscore$Extend(a: A, b: B, c: C, d: D, e: E, ...rest: Array): A & B & C & D & E; declare function $underscore$ExtendParameterized(...rest: Array): A; declare function $underscore$ExtendParameterized(b: B, ...rest: Array): A & B; declare function $underscore$ExtendParameterized(b: B, c: C, ...rest: Array): A & B & C; declare function $underscore$ExtendParameterized(b: B, c: C, d: D, ...rest: Array): A & B & C & D; declare function $underscore$ExtendParameterized(b: B, c: C, d: D, e: E, ...rest: Array): A & B & C & D & E; declare var compose: Compose; // Handle underscore chainables things. declare class UnderscoreWrappedList { // Chain chain(): UnderscoreChainedList; // Handle Collections functions each(iteratee: (element: T, index?: number, list?: Array) => void): void; each(iteratee: (val: mixed, key: mixed, list?: Object) => void): void; map(iteratee: (value: T, index: number, list: Array) => U): Array; reduce(iteratee: (memo: Object, value: T, index: number) => U, init: Object): Object; reduce(iteratee: (memo: Array, value: T, index: number) => U, init: Array): Array; reduce(iteratee: (memo: U, value: T, index: number) => U, init: U): U; reduceRight(iteratee: (memo: Object, value: T, index: number) => U, init: Object): Object; reduceRight(iteratee: (memo: Array, value: T, index: number) => U, init: Array): Array; reduceRight(iteratee: (memo: U, value: T, index: number) => U, init: U): U; find(predicate: (value: T) => boolean): T; filter(predicate: (value: ?T) => boolean): Array; where(properties: Object): Array; findWhere(properties: $Shape): ?T; reject(predicate: (value: T) => boolean, context?: mixed): Array; every(predicate: (value: T) => boolean, context?: mixed): boolean; some(predicate: (value: T) => boolean, context?: mixed): boolean; contains(value: T, fromIndex?: number): boolean; invoke(methodName: string, ...args: Array): Array; pluck(propertyName: string): Array; max(iteratee?: (value: T) => number, context?: mixed): U; min(iteratee?: (value: T) => number, context?: mixed): U; sortBy(iteratee: (value: T) => number): Array; sortBy(iteratee: string): Array; // TODO: UnderscoreWrapTheseObjects groupBy(iteratee: (value: T) => U, context?: mixed): { [key: U]: T }; groupBy(iteratee: string, context?: mixed): { [key: any]: T }; indexBy(iteratee: (value: T) => U, context?: mixed): { [key: U]: T }; indexBy(iteratee: string, context?: mixed): { [key: any]: T }; countBy(iteratee: (value: T) => U, context?: mixed): { [key: U]: T }; shuffle(): Array; sample(n?: number): Array; toArray(): Array; size(): number; partition(predicate: (value: T) => boolean): Array>; // Handle Array function first(): T; first(n: number): Array; head(n?: number): Array; take(n?: number): Array; initial(n?: number): Array; last(n?: number): Array; rest(index?: number): Array; tail(index?: number): Array; drop(index?: number): Array; compact(): Array; flatten(shallow?: boolean): Array; without(...values: Array): Array; union(...arrays: Array): Array; intersection(...arrays: Array): Array; difference(...others: Array): Array; uniq(): Array; uniq(iteratee: FnIteratee): Array; uniq(isSorted: boolean, iteratee?: FnIteratee): Array; unique(): Array; unique(iteratee: FnIteratee): Array; unique(isSorted: boolean, iteratee?: FnIteratee): Array; zip(...arrays: Array): Array; unzip(): Array; object(values?: Array): Object; indexOf(value: T, isSorted?: boolean): number; lastIndexOf(value: T, iteratee?: Function, context?: mixed): number; sortedIndex(value: T, iteratee?: Function, context?: mixed): number; findIndex(predicate: (value: T) => boolean, context?: mixed): number; findLastIndex(predicate: (value: T) => boolean, context?: mixed): number; range(stop: number, step?: number): Array; range(): Array; // TODO _.propertyOf // TODO _.matcher, _.matches isEqual(b: Object): boolean; isMatch(b: Object): boolean; isEmpty(): boolean; isElement(): boolean; isArray(): boolean; isObject(): boolean; isArguments(): boolean; isFunction(): boolean; isString(): boolean; isNumber(): boolean; isFinite(): boolean; isBoolean(): boolean; isDate(): boolean; isRegExp(): boolean; isError(): boolean; isNaN(): boolean; isNull(): boolean; isUndefined(): boolean; } // Handle underscore chainables things. declare class UnderscoreChainedList { // End a Chain value(): Array; // Handle Collections functions each(iteratee: (element: T, index: number, list: Array) => void): Array; each(iteratee: (val: mixed, key: mixed, list: Object) => void): Object; map(iteratee: (value: T, index: number, list: Array) => U): UnderscoreChainedList; reduce(iteratee: (memo: Object, value: T, index: number) => U, init: Object): UnderscoreChainedValue; reduce(iteratee: (memo: Array, value: T, index: number) => U, init: Array): UnderscoreChainedList; reduce(iteratee: (memo: U, value: T, index: number) => U, init: U): UnderscoreChainedValue; reduceRight(iteratee: (memo: Object, value: T, index: number) => U, init: Object): UnderscoreChainedValue; reduceRight(iteratee: (memo: Array, value: T, index: number) => U, init: Array): UnderscoreChainedList; reduceRight(iteratee: (memo: U, value: T, index: number) => U, init: U): UnderscoreChainedValue; find(predicate: (value: T) => boolean): UnderscoreChainedValue; filter(predicate: (value: T) => boolean): UnderscoreChainedList; where(properties: Object): UnderscoreChainedList; findWhere(properties: $Shape): ?UnderscoreChainedValue; reject(predicate: (value: T) => boolean, context?: mixed): UnderscoreChainedList; every(predicate: (value: T) => boolean, context?: mixed): UnderscoreChainedValue; some(predicate: (value: T) => boolean, context?: mixed): UnderscoreChainedValue; contains(value: T, fromIndex?: number): UnderscoreChainedValue; invoke(methodName: string, ...args: Array): UnderscoreChainedList; pluck(propertyName: string): UnderscoreChainedList; max(iteratee?: (value: T) => number, context?: mixed): UnderscoreChainedValue; min(iteratee?: (value: T) => number, context?: mixed): UnderscoreChainedValue; sortBy(iteratee: (value: T) => number): UnderscoreChainedList; sortBy(iteratee: string): UnderscoreChainedList; // TODO: UnderscoreWrapTheseObjects groupBy(iteratee: (value: T) => U, context?: mixed): UnderscoreChainedValue<{ [key: U]: T }>; groupBy(iteratee: string, context?: mixed): UnderscoreChainedValue<{ [key: any]: T }>; indexBy(iteratee: (value: T) => U, context?: mixed): UnderscoreChainedValue<{ [key: U]: T }>; indexBy(iteratee: string, context?: mixed): UnderscoreChainedValue<{ [key: any]: T }>; countBy(iteratee: (value: T) => U, context?: mixed): UnderscoreChainedValue<{ [key: U]: T }>; shuffle(): UnderscoreChainedList; sample(n?: number): UnderscoreChainedList; toArray(): UnderscoreChainedList; size(): UnderscoreChainedValue; partition(predicate: (value: T) => boolean): UnderscoreChainedList>; // Handle Array function first(n: number): UnderscoreChainedList; first(): UnderscoreChainedValue; head(n?: number): UnderscoreChainedList; take(n?: number): UnderscoreChainedList; initial(n?: number): UnderscoreChainedList; last(n?: number): UnderscoreChainedList; rest(index?: number): UnderscoreChainedList; tail(index?: number): UnderscoreChainedList; drop(index?: number): UnderscoreChainedList; compact(): UnderscoreChainedList; flatten(shallow?: boolean): UnderscoreChainedList; without(...values: Array): UnderscoreChainedList; union(...arrays: Array): UnderscoreChainedList; intersection(...arrays: Array): UnderscoreChainedList; difference(...others: Array): UnderscoreChainedList; uniq(): UnderscoreChainedList; uniq(iteratee: FnIteratee): UnderscoreChainedList; uniq(isSorted: boolean, iteratee?: FnIteratee): UnderscoreChainedList; unique(): UnderscoreChainedList; unique(iteratee: FnIteratee): UnderscoreChainedList; unique(isSorted: boolean, iteratee?: FnIteratee): UnderscoreChainedList; zip(...arrays: Array): UnderscoreChainedList; unzip(): UnderscoreChainedList; object(values?: Array): UnderscoreChainedValue; indexOf(value: T, isSorted?: boolean): UnderscoreChainedValue; lastIndexOf(value: T, iteratee?: Function, context?: mixed): UnderscoreChainedValue; sortedIndex(value: T, iteratee?: Function, context?: mixed): UnderscoreChainedValue; findIndex(predicate: (value: T) => boolean, context?: mixed): UnderscoreChainedValue; findLastIndex(predicate: (value: T) => boolean, context?: mixed): UnderscoreChainedValue; range(stop: number, step?: number): UnderscoreChainedList; range(): UnderscoreChainedList; isEqual(b: Object): UnderscoreChainedValue; isMatch(b: Object): UnderscoreChainedValue; isEmpty(): UnderscoreChainedValue; isElement(): UnderscoreChainedValue; isArray(): UnderscoreChainedValue; isObject(): UnderscoreChainedValue; isArguments(): UnderscoreChainedValue; isFunction(): UnderscoreChainedValue; isString(): UnderscoreChainedValue; isNumber(): UnderscoreChainedValue; isFinite(): UnderscoreChainedValue; isBoolean(): UnderscoreChainedValue; isDate(): UnderscoreChainedValue; isRegExp(): UnderscoreChainedValue; isError(): UnderscoreChainedValue; isNaN(): UnderscoreChainedValue; isNull(): UnderscoreChainedValue; isUndefined(): UnderscoreChainedValue; } declare class UnderscoreChainedValue { value(): T; } declare class UnderscoreWrappedValue { chain(): UnderscoreChainedValue; escape(): string; // TODO: Probably move this to UnderscoreWrappedNumber or something range(): Array; isEmpty(): boolean; } // Handle regular things. declare class UnderscoreList { // Handle chaining chain(a: Array): UnderscoreChainedList; chain(v: T): UnderscoreChainedValue; // Handle Collections functions each(o: {[key:string]: T}, iteratee: (val: T, key: string)=>void): void; each(a: T[], iteratee: (val: T, key: string)=>void): void; each(list: Object, iteratee: (val: mixed, key: mixed, list: Object) => void): void; forEach(o: {[key:string]: T}, iteratee: (val: T, key: string)=>void): void; forEach(a: T[], iteratee: (val: T, key: string)=>void): void; map(a: T[], iteratee: (val: T, n: number)=>U): U[]; map(a: {[key:K]: T}, iteratee: (val: T, k: K)=>U): U[]; collect(a: T[], iteratee: (val: T, n: number)=>U): U[]; collect(a: {[key:K]: T}, iteratee: (val: T, k: K)=>U): U[]; reduce(a: Array, iterator: (m: MemoT, o: T)=>MemoT, initialMemo?: MemoT): MemoT; inject(a: Array, iterator: (m: MemoT, o: T)=>MemoT, initialMemo?: MemoT): MemoT; foldl(a: Array, iterator: (m: MemoT, o: T)=>MemoT, initialMemo?: MemoT): MemoT; reduceRight(a: Array, iterator: (m: MemoT, o: T)=>MemoT, initialMemo?: MemoT): MemoT; foldr(a: Array, iterator: (m: MemoT, o: T)=>MemoT, initialMemo?: MemoT): MemoT; find(list: T[], predicate: (val: T)=>boolean): ?T; detect(list: T[], predicate: (val: T)=>boolean): ?T; filter(o: {[key:string]: T}, pred: (val: T, k: string)=>boolean): T[]; filter(a: T[], pred: (val: T, k: string)=>boolean): T[]; select(o: {[key:string]: T}, pred: (val: T, k: string)=>boolean): T[]; select(a: T[], pred: (val: T, k: string)=>boolean): T[]; where(list: Array, properties: Object): Array; findWhere(list: Array, properties: {[key:string]: any}): ?T; reject(o: {[key:string]: T}, pred: (val: T, k: string)=>boolean): T[]; reject(a: T[], pred: (val: T, k: string)=>boolean): T[]; every(a: Array, pred?: (val: T)=>boolean): boolean; all(a: Array, pred?: (val: T)=>boolean): boolean; some(a: Array, pred?: (val: T)=>boolean): boolean; any(a: Array, pred?: (val: T)=>boolean): boolean; contains(list: T[], val: T, fromIndex?: number): boolean; includes(list: T[], val: T, fromIndex?: number): boolean; invoke(list: Array, methodName: string, ...args?: Array): any; pluck(a: Array, propertyName: string): Array ; max(a: Array|{[key:any]: T}): T; min(a: Array|{[key:any]: T}): T; sortBy(a: T[], property: any): T[]; sortBy(a: T[], iteratee: (val: T)=>any): T[]; groupBy(a: Array, iteratee: string | (val: T, index: number)=>any): {[key:string]: T[]}; indexBy(a: Array, iteratee: string | (val: T, index: number)=>any): {[key:string]: T[]}; countBy(a: Array, iteratee: (val: T, index: number)=>any): {[key:string]: T[]}; shuffle(list: ?Array): Array; sample(a: T[]): T; toArray(a: Iterable|{[key:any]: T}): Array; size(o: Object): number; size(o: Array): number; partition(o: {[key:string]: T}, pred: (val: T, k: string)=>boolean): [T[], T[]]; partition(o: Array, pred: (val: T)=>boolean): [T[], T[]]; // Handle Array function first(a: Array, n: number): Array; first(a: Array): T; head(a: Array, n: number): Array; head(a: Array): T; take(a: Array, n: number): Array; take(a: Array): T; initial(a: Array, n?: number): Array; last(a: Array, n: number): Array; last(a: Array): T; rest(a: Array, index?: number): Array; tail(a: Array, index?: number): Array; drop(a: Array, index?: number): Array; compact(a: Array): T[]; flatten(a: S[][]): S[]; without(a: T[], ...values: T[]): T[]; union(...arrays: Array>): Array; intersection(...arrays: Array>): Array; difference(array: Array, ...others: Array>): Array; uniq(a: T[]): T[]; uniq(list: Array, iteratee: Function): Array; uniq(list: Array, isSorted: boolean, iteratee?: Function): Array; unique(a: T[]): T[]; unique(list: Array, iteratee: Function): Array; unique(list: Array, isSorted: boolean, iteratee?: Function): Array; zip(a1: S[], a2: T[]): Array<[S, T]>; unzip(array: Array>): Array>; object(a: Array<[string, T]>): {[key:string]: T}; object(list: Array, values?: Array): {[key: string]: T}; indexOf(list: T[], val: T, isSorted?: boolean): number; lastIndexOf(array: Array, value: T, fromIndex?: number): number; sortedIndex(list: Array, value: T, iteratee?: (value: T) => mixed, context?: any): number; findIndex(list: T[], predicate: (val: T)=>boolean): number; findLastIndex(array: Array, predicate: any, context?: any): number; range(a: number, b: number): Array; isEqual(object: Object, b: Object): boolean; isMatch(object: Object, b: Object): boolean; isEmpty(object: Object): boolean; isElement(object: any): boolean; isArray(value: any): boolean; isObject(value: any): boolean; isArguments(object: any): boolean; isFunction(object: any): boolean; isString(object: any): boolean; isNumber(object: any): boolean; isFinite(object: any): boolean; isBoolean(object: any): boolean; isDate(object: any): boolean; isRegExp(object: any): boolean; isError(object: any): boolean; isNaN(object: any): boolean; isNull(object: any): boolean; isUndefined(object: any): boolean; } declare class UnderscoreFunctions { bind(func: Function, object: Object, ...arguments: Array): Function; bindAll(object: ?Object, ...methodNames: Array): Object; partial(func: Function, ...arguments: Array): Function; memoize(func: Function, hashFunction?: Function): Function; delay(func: Function, wait: number, ...arguments: Array): void; defer(func: Function, ...arguments: Array): void; throttle(func: Function, wait: number, options?: {leading: boolean, trailing: boolean}): Function; debounce(func: Function, wait: number, immediate?: boolean): Function; once(func: Function): Function; after(count: number, func: Function): Function; before(count: number, func: Function): Function; wrap(func: Function, wrapper: Function): Function; negate(predicate: (...args: any) => boolean): Function; compose: Compose; isEqual(object: any, b: any): boolean; isMatch(object: Object, b: Object): boolean; isEmpty(object: Object): boolean; isElement(object: Object): boolean; isArray(value: any): boolean; isObject(value: any): boolean; isArguments(object: any): boolean; isFunction(object: any): boolean; isString(object: any): boolean; isNumber(object: any): boolean; isFinite(object: any): boolean; isBoolean(object: any): boolean; isDate(object: any): boolean; isRegExp(object: any): boolean; isError(object: any): boolean; isNaN(object: any): boolean; isNull(object: any): boolean; isUndefined(object: any): boolean; } declare class UnderscoreObject { keys(object: {[keys: K]: V}): Array; allKeys(object: {[keys: K]: V}): Array; values(object: {[keys: K]: V}): Array; mapObject( object: Object, iteratee: (val: any, key: string) => Object, context?: mixed ): Object; pairs(object: {[keys: K]: V}): Array<[K, V]>; invert(object: {[keys: K]: V}): {[keys: V]: K}; // TODO: _.create functions(object: Object): Array; findKey(object: Object, predicate: (...args: Array) => boolean, context?: mixed): ?string; extend: typeof $underscore$Extend; extendOwn: typeof $underscore$Extend; pick(object: {[keys: K]: V}, predicate?: K): {[keys: K]: V}; omit(object: {[keys: K]: V}, predicate?: K): {[keys: K]: V}; defaults(defaults: {[keys: K]: V}, more: {[keys: K]: V}): {[keys: K]: V}; clone(object: O): O; tap(object: O): O; has(object: Object, key: string): boolean; property(key: K): (obj: { [key: K]: V }) => V; // TODO _.propertyOf // TODO _.matcher, _.matches isEqual(object: Object, b: Object): boolean; isMatch(object: Object, b: Object): boolean; isEmpty(object: Object): boolean; isElement(object: any): boolean; isArray(value: any): boolean; isObject(value: any): boolean; isArguments(object: any): boolean; isFunction(object: any): boolean; isString(object: any): boolean; isNumber(object: any): boolean; isFinite(object: any): boolean; isBoolean(object: any): boolean; isDate(object: any): boolean; isRegExp(object: any): boolean; isError(object: any): boolean; isNaN(object: any): boolean; isNull(object: any): boolean; isUndefined(object: any): boolean; } declare class UnderscoreChainedObject { value(): WrappedObj; keys(): UnderscoreChainedList<$Keys>; allKeys(): UnderscoreChainedList<$Keys>; // This call necessarily loses precision since we treat chained lists generics of a single type. values(): UnderscoreChainedList; mapObject(v: V) => Ret>>( iteratee: Function, context?: mixed ): UnderscoreChainedObject; map(mapFn: (v: any, k: $Keys, obj: WrappedObj) => T): UnderscoreChainedList; pairs(): UnderscoreChainedList<[any, any]>; invert(): UnderscoreChainedObject; // TODO: _.create functions(): UnderscoreChainedList; findKey(predicate: (...args: Array) => boolean, context?: mixed): UnderscoreChainedValue; // TODO: Reimplement these when you can get them to return UnderscoreChainedObject // extend: ExtendParameterized<{[key: K]: V}>; // extendOwn: ExtendParameterized<{[key: K]: V}>>; pick(...rest: Array>): UnderscoreChainedObject; pick(predicate: (v: any, k: any, object: WrappedObj) => boolean): UnderscoreChainedObject; omit(...rest: Array>): UnderscoreChainedObject; omit(predicate: (v: any, k: any, object: WrappedObj) => boolean): UnderscoreChainedObject; defaults(more: $Shape): UnderscoreChainedObject; clone(): UnderscoreChainedObject; tap(): UnderscoreChainedObject; has(key: string): UnderscoreChainedValue; // TODO _.propertyOf // TODO _.matcher, _.matches isEqual(b: Object): UnderscoreChainedValue; isMatch(b: Object): UnderscoreChainedValue; isEmpty(): UnderscoreChainedValue; isElement(): UnderscoreChainedValue; isArray(): UnderscoreChainedValue; isObject(): UnderscoreChainedValue; isArguments(): UnderscoreChainedValue; isFunction(): UnderscoreChainedValue; isString(): UnderscoreChainedValue; isNumber(): UnderscoreChainedValue; isFinite(): UnderscoreChainedValue; isBoolean(): UnderscoreChainedValue; isDate(): UnderscoreChainedValue; isRegExp(): UnderscoreChainedValue; isError(): UnderscoreChainedValue; isNaN(): UnderscoreChainedValue; isNull(): UnderscoreChainedValue; isUndefined(): UnderscoreChainedValue; } declare class UnderscoreWrappedObject { chain(): UnderscoreChainedObject; map(fn: (v: any, k: $Keys) => R): Array; filter(fn: (v: any, k: $Keys, obj: any) => boolean): Array; keys(): Array<$Keys>; allKeys(): Array<$Keys>; values(): Array; mapObject(v: V) => Ret>>( iteratee: Function, context?: mixed ): NewObj; pairs(): Array<[K, V]>; invert(): {[keys: V]: K}; // TODO: _.create functions(): Array; find(predicate: (v: any, k: $Keys, obj: WrappedObj) => boolean): ?any; findKey(predicate: (...args: Array) => boolean, context?: mixed): ?string; extend: typeof $underscore$ExtendParameterized; extendOwn: typeof $underscore$ExtendParameterized; // TODO make these actually remove properties pick(...rest: Array>): WrappedObj; pick(predicate: (v: any, k: $Keys, object: WrappedObj) => boolean): WrappedObj; omit(...rest: Array>): WrappedObj; omit(predicate: (v: any, k: $Keys, object: WrappedObj) => boolean): WrappedObj; defaults(more: $Shape): WrappedObj; clone(): WrappedObj; tap(): WrappedObj; has(key: string): boolean; // TODO _.propertyOf // TODO _.matcher, _.matches isEqual(b: Object): boolean; isMatch(b: Object): boolean; isEmpty(): boolean; isElement(): boolean; isArray(): boolean; isObject(): boolean; isArguments(): boolean; isFunction(): boolean; isString(): boolean; isNumber(): boolean; isFinite(): boolean; isBoolean(): boolean; isDate(): boolean; isRegExp(): boolean; isError(): boolean; isNaN(): boolean; isNull(): boolean; isUndefined(): boolean; } declare class UnderscoreUtility { noConflict(): Underscore; identity(value: U): U; constant(value: U): () => U; noop(): void; times(n: number, iteratee: Function, context?: mixed): void; random(min: number, max: number): number; // TODO: Is this right? mixin(object: Object): Underscore & Object; // TODO: _.iteratee uniqueId(prefix?: string): string; escape(string: string): string; unescape(string: string): string; // TODO: _.result now(): number; template(templateText: string): (values: {[key: string]: string}) => string; } declare class UnderscoreWrappedList { chain(): UnderscoreChainedList; // Handle Collections functions each(iteratee: (element: T, index: number, list: Array) => void): Array; each(iteratee: (val: mixed, key: mixed, list: Object) => void): Object; map(iteratee: (value: T, index: number, list: Array) => U): Array; reduce(iteratee: (memo: Object, value: T, index?: number) => U, init: Object): Object; reduce(iteratee: (memo: Array, value: T, index?: number) => U, init: Array): Array; reduce(iteratee: (memo: U, value: T, index?: number) => U, init: U): U; reduceRight(iteratee: (memo: Object, value: T, index?: number) => U, init: Object): U; reduceRight(iteratee: (memo: Array, value: T, index?: number) => U, init: Array): Array; reduceRight(iteratee: (memo: U, value: T, index?: number) => U, init: U): U; find(predicate: (value: T) => boolean): ?T; filter(predicate: (value: T) => boolean): Array; where(properties: Object): Array; findWhere(properties: $Shape): ?T; reject(predicate: (value: T) => boolean, context?: mixed): Array; every(predicate: (value: T) => boolean, context?: mixed): boolean; some(predicate: (value: T) => boolean, context?: mixed): boolean; contains(value: T, fromIndex?: number): boolean; invoke(methodName: string, ...args: Array): Array; pluck(propertyName: string): Array; max(iteratee?: (value: T) => number, context?: mixed): U; min(iteratee?: (value: T) => number, context?: mixed): U; sortBy(iteratee: (value: T) => number): Array; sortBy(iteratee: string): Array; // TODO: UnderscoreWrapTheseObjects groupBy(iteratee: (value: T) => U, context?: mixed): { [key: U]: T }; groupBy(iteratee: string, context?: mixed): { [key: any]: T }; indexBy(iteratee: (value: T) => U, context?: mixed): { [key: U]: T }; indexBy(iteratee: string, context?: mixed): { [key: any]: T }; countBy(iteratee: (value: T) => U, context?: mixed): { [key: U]: T }; shuffle(): Array; sample(n?: number): Array; toArray(): Array; size(): number; partition(predicate: (value: T) => boolean): Array>; // Handle Array function first(): T; first(n: number): Array; head(n?: number): Array; take(n?: number): Array; initial(n?: number): Array; last(n?: number): Array; rest(index?: number): Array; tail(index?: number): Array; drop(index?: number): Array; compact(): Array; flatten(shallow?: boolean): Array; without(...values: Array): Array; union(...arrays: Array): Array; intersection(...arrays: Array): Array; difference(...others: Array): Array; uniq(): Array; uniq(iteratee: Function): Array; uniq(isSorted: boolean, iteratee?: Function): Array; unique(): Array; unique(iteratee: Function): Array; unique(isSorted: boolean, iteratee?: Function): Array; zip(...arrays: Array): Array; unzip(): Array; object(values?: Array): Object; indexOf(value: T, isSorted?: boolean): number; lastIndexOf(value: T, iteratee?: Function, context?: mixed): number; sortedIndex(value: T, iteratee?: Function, context?: mixed): number; findIndex(predicate: (value: T) => boolean, context?: mixed): number; findLastIndex(predicate: (value: T) => boolean, context?: mixed): number; range(stop: number, step?: number): Array; range(): Array; isEmpty(): boolean; isEqual(other: Array): boolean; } // Have to use a type with $call instead of function type because otherwise this will cause us to lose type // information. see: https://github.com/facebook/flow/issues/3781 declare type WrappedExports = { $call: // A type that can be an object or an array (usually 'any') should have both return types. & ((arg: AnyType) => UnderscoreWrappedObject & UnderscoreWrappedList) // It's important that UnderscoreWrappedObject, UnderscoreWrappedList takes precedence over UnderscoreWrappedValue & ((arg: WrappedObj) => UnderscoreWrappedObject) & ((arg: Array) => UnderscoreWrappedList) & ((arg: [T]) => UnderscoreWrappedList) & ((arg: T) => UnderscoreWrappedValue) } declare type Underscore = & UnderscoreList & UnderscoreFunctions & UnderscoreObject & UnderscoreUtility & WrappedExports; declare module.exports: Underscore; }