Created
May 23, 2016 23:58
-
-
Save tryggvigy/2468607b28e6dcdac1f15db770d3666f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
type Iteratee<T> = Array<string> | {[key: string]: T} | string | |
// Try and fix this | |
type Iteratee$Weak<T> = Array<string> | {[key: string]: T} | string | Function | |
type Collection<T> = Array<T> | {[key: string]: T} | |
declare module 'lodash' { | |
/** | |
* Array methods | |
*/ | |
declare function chunk<T>(array: Array<T>, size?: number): Array<Array<T>> | |
declare function compact<T>(array: Array<T>): Array<T> | |
declare function concat(array: Array<any>, ...values?: Array<any>): Array<any> | |
declare function difference<T>(array: Array<T>, values?: Array<T>): Array<T> | |
declare function differenceBy<T>(array: Array<T>, values?: Array<T>, iteratee?: Iteratee): Array<T> | |
declare function differenceBy<T>(array: Array<T>, values?: Array<T>, iteratee?: (value: T) => any): Array<T> | |
declare function differenceWith<T>( | |
array: Array<T>, | |
values?: Array<T>, | |
comparator?: (arrVal: any, othVal: any) => boolean | |
): Array<T> | |
declare function drop<T>(array: Array<T>, n?: number): Array<T> | |
declare function dropRight<T>(array: Array<T>, n?: number): Array<T> | |
declare function dropRightWhile<T>(array: Array<T>, predicate?: string): Array<T> | |
declare function dropRightWhile<T>(array: Array<T>, predicate?: (value:T) => boolean): Array<T> | |
// Object matches almost anything. Not so good | |
declare function dropRightWhile<T>(array: Array<T>, predicate?: Object): Array<T> | |
declare function dropRightWhile<T>(array: Array<T>, predicate?: Array<any>): Array<T> | |
// maybe fill<T>(array: Array<any>, value: T, start?: number, end?:number): Array<T> ? | |
declare function fill<T, U>(array: Array<U>, value: T, start?: number, end?:number): Array<T|U> | |
declare function findIndex<T>(array: Array<T>, predicate?: string, fromIndex?: number): number | |
declare function findIndex<T>(array: Array<T>, predicate?: (value: T) => boolean, fromIndex?: number): number | |
declare function findIndex<T>(array: Array<T>, predicate?: Object, fromIndex?: number): number | |
declare function findIndex<T>(array: Array<T>, predicate?: Array<any>, fromIndex?: number): number | |
declare function findLastIndex<T>(array: Array<T>, predicate?: string, fromIndex?: number): number | |
declare function findLastIndex<T>(array: Array<T>, predicate?: (value: T) => boolean, fromIndex?: number): number | |
declare function findLastIndex<T>(array: Array<T>, predicate?: Object, fromIndex?: number): number | |
declare function findLastIndex<T>(array: Array<T>, predicate?: Array<any>, fromIndex?: number): number | |
declare function head<T>(array: Array<T>): ?T | |
declare function first<T>(array: Array<T>): ?T | |
// Try to do better. | |
declare function flatten(array: Array<any>): Array<any> | |
// Try to do better. | |
declare function flattenDeep(array: Array<any>): Array<any> | |
// Try to do better. | |
declare function flattenDepth(array: Array<any>, depth?: number): Array<any> | |
declare function fromPairs(array: Array<[string, any]>): Object | |
declare function indexOf<T>(array: Array<T>, value: T, fromIndex?: number): number | |
declare function initial<T>(array: Array<T>): Array<T> | |
declare function intersection<T>(...array?: Array<Array<T>>): Array<T> | |
// `intersectionBy` cant be specified correctly since no argument can come after a spread. | |
declare function intersectionBy<T>(...array?: Array<Array<T> | Iteratee$Weak>): Array<T> | |
// `intersectionWith` cant be specified correctly since no argument can come after a spread. | |
declare function intersectionWith<T>(...array?: Array<Array<T> | (_: T) => boolean>): Array<T> | |
declare function join<T>(array: Array<T>, seperator?: string): string | |
declare function last<T>(array: Array<T>): T | |
declare function lastIndexOf<T>(array: Array<T>, value: any, fromIndex?: number): number | |
declare function nth<T>(array: Array<T>, n?: number): number | |
declare function pull<T>(array: Array<T>, ...values?: Array<T>): Array<T> | |
declare function pullAll<T>(array: Array<T>, values: Array<T>): Array<T> | |
declare function pullAllBy<T>(array: Array<T>, values: Array<T>, iteratee?: Iteratee): Array<T> | |
declare function pullAllBy<T>(array: Array<T>, values: Array<T>, iteratee?: (value: T) => any): Array<T> | |
declare function pullAllWith<T>(array: Array<T>, values: Array<T>, comparator: (_: T) => boolean): Array<T> | |
declare function pullAt<T>(array: Array<T>, ...indexes?: Array<number>): Array<T> | |
declare function pullAt<T>(array: Array<T>, indexes?: Array<number>): Array<T> | |
declare function remove<T>(array: Array<T>, predicate?: string): Array<T> | |
declare function remove<T>(array: Array<T>, predicate?: Array<any>): Array<T> | |
declare function remove<T>(array: Array<T>, predicate?: Object): Array<T> | |
declare function remove<T>(array: Array<T>, predicate?: (value: T) => boolean): Array<T> | |
declare function reverse<T>(array: Array<T>): Array<T> | |
declare function slice<T>(array: Array<T>, start?: number, end?: number): Array<T> | |
declare function sortedIndex<T>(array: Array<T>, value: T): number | |
declare function sortedIndexBy<T>(array: Array<T>, value: T, iteratee?: Iteratee): number | |
declare function sortedIndexBy<T>(array: Array<T>, value: T, iteratee?: (value: T) => any): number | |
declare function sortedIndexOf<T>(array: Array<T>, value: T): number | |
declare function sortedLastIndex<T>(array: Array<T>, value: T): number | |
declare function sortedLastIndexBy<T>(array: Array<T>, value: T, iteratee?: Iteratee): number | |
declare function sortedLastIndexBy<T>(array: Array<T>, value: T, iteratee?: (value: T) => any): number | |
declare function sortedLastIndexOf<T>(array: Array<T>, value: T): number | |
declare function sortedUniq<T>(array: Array<T>): Array<T> | |
declare function sortedUniqBy<T>(array: Array<T>, iteratee?: (value: T) => any): Array<T> | |
declare function tail<T>(array: Array<T>): Array<T> | |
declare function take<T>(array: Array<T>, n?: number): Array<T> | |
declare function takeRight<T>(array: Array<T>, n?: number): Array<T> | |
declare function takeRightWhile<T>(array: Array<T>, predicate: string): Array<T> | |
declare function takeRightWhile<T>(array: Array<T>, predicate: (value: T, index: number, array: Array<T>) => boolean): Array<T> | |
declare function takeRightWhile<T>(array: Array<T>, predicate: Object): Array<T> | |
declare function takeRightWhile<T>(array: Array<T>, predicate: Array<any>): Array<T> | |
declare function takeWhile<T>(array: Array<T>, predicate: string): Array<T> | |
declare function takeWhile<T>(array: Array<T>, predicate: (value: T, index: number, array: Array<T>) => boolean): Array<T> | |
declare function takeWhile<T>(array: Array<T>, predicate: Object): Array<T> | |
declare function takeWhile<T>(array: Array<T>, predicate: Array<any>): Array<T> | |
declare function union<T>(...arrays: Array<Array<T>>): Array<T> | |
// `unionBy` cant be specified correctly since no argument can come after a spread. | |
declare function unionBy<T>(...arrays?: Array<Array<T> | Iteratee>): Array<T> | |
declare function unionBy<T>(...arrays?: Array<Array<T> | (value: T) => any>): Array<T> | |
// `unionWith` cant be specified correctly since no argument can come after a spread. | |
declare function unionWith<T>(...arrays?: Array<Array<T> | (arrVal: any, othVal: any) => boolean>): Array<T> | |
declare function uniq<T>(array: Array<T>): Array<T> | |
declare function uniqBy<T>(array: Array<T>, iteratee?: Iteratee): Array<T> | |
declare function uniqBy<T>(array: Array<T>, iteratee?: (value: T) => any): Array<T> | |
declare function uniqWith<T>(array: Array<T>, comparator?: (arrVal: T, othVal: T) => boolean): Array<T> | |
// Is this the right return type? | |
declare function unzip<T>(array: Array<Array<T>>): Array<Array<T>> | |
// is it right to return boolan in comparators? | |
declare function unzipWith<T>(array: Array<Array<T>>, comparator: (arrVal: T, otherVal: T) => boolean): Array<Array<T>> | |
declare function without<T>(array: Array<T>, ...values?: Array<T>): Array<T> | |
declare function xor<T>(...arrays?: Array<Array<T>>): Array<T> | |
// `xorBy` cant be specified correctly since no argument can come after a spread. | |
declare function xorBy<T>(...arrays?: Array<Array<T> | Iteratee>): Array<T> | |
declare function xorBy<T>(...arrays?: Array<Array<T> | (value: T) => any>): Array<T> | |
declare function xorWith<T>(...arrays?: Array<Array<T> | (arrVal: any, othVal: any) => boolean>): Array<T> | |
declare function zip<T>(...array: Array<Array<T>>): Array<Array<T>> | |
declare function zipObject<T>(values: Array<string>, props: Array<T>): {[key: string]: T} | |
declare function zipObjectDeep<T>(values: Array<string>, props: Array<T>): Object | |
// `zipWith` cant be specified correctly since no argument can come after a spread. | |
declare function zipWith<T>(...array: Array<Array<T> | (...values: Array<T>) => T>): Array<T> | |
/** | |
* Collection methods | |
*/ | |
// This type can't be a function or a DOM node. Can we be stricter? | |
declare function isEqual<T>(value: T, other: T): boolean | |
declare function findKey<T>(list: Array<T>, properties: {}): T | |
} | |
declare module _ { | |
declare var exports: $Exports<'lodash'> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment