Skip to content
Snippets Groups Projects
Unverified Commit 70f921b0 authored by Aleksandr Lesnenko's avatar Aleksandr Lesnenko Committed by GitHub
Browse files

remove flow leftovers (#28334)

parent 259560ca
No related merge requests found
declare module CSSModule {
declare var exports: { [key: string]: string };
}
type Key = string | number;
type Value = any;
declare module icepick {
declare function assoc<O: Object | Array<any>, K: Key, V: Value>(
object: O,
key: K,
value: V,
): O;
declare function dissoc<O: Object | Array<any>, K: Key, V: Value>(
object: O,
key: K,
): O;
declare function getIn<O: Object | Array<any>, K: Key, V: Value>(
object: ?O,
path: Array<K>,
): ?V;
declare function setIn<O: Object | Array<any>, K: Key, V: Value>(
object: O,
path: Array<K>,
value: V,
): O;
declare function assocIn<O: Object | Array<any>, K: Key, V: Value>(
object: O,
path: Array<K>,
value: V,
): O;
declare function dissocIn<O: Object | Array<any>, K: Key>(
object: O,
path: Array<K>,
): O;
declare function updateIn<O: Object | Array<any>, K: Key, V: Value>(
object: O,
path: Array<K>,
callback: (value: V) => V,
): O;
declare function merge<O: Object | Array<any>>(object: O, other: O): O;
// TODO: improve this
declare function chain<O: Object | Array<any>>(object: O): any;
}
// Origin: https://github.com/flowtype/flow-typed/blob/master/definitions/npm/redux-actions_v2.x.x/flow_v0.34.x-/redux-actions_v2.x.x.js
declare module "redux-actions" {
/*
* Use `ActionType` to get the type of the action created by a given action
* creator. For example:
*
* import { creatAction, type ActionType } from 'redux-actions'
*
* const increment = createAction(INCREMENT, (count: number) => count)
*
* function myReducer(state: State = initState, action: ActionType<typeof increment>): State {
* // Flow will infer that the type of `action.payload` is `number`
* }
*/
declare type ActionType<ActionCreator> = _ActionType<*, ActionCreator>;
declare type _ActionType<R, Fn: (payload: *, ...rest: any[]) => R> = R;
/*
* To get the most from Flow type checking use a `payloadCreator` argument
* with `createAction`. Make sure that Flow can infer the argument type of the
* `payloadCreator`. That will allow Flow to infer the payload type of actions
* created by that action creator in other parts of the program. For example:
*
* const increment = createAction(INCREMENT, (count: number) => count)
*
*/
declare function createAction<T, P>(
type: T,
$?: empty, // hack to force Flow to not use this signature when more than one argument is given
): (payload: P, ...rest: any[]) => { type: T, payload: P, error?: boolean };
declare function createAction<T, P, P2>(
type: T,
payloadCreator: (_: P) => P2,
$?: empty,
): (payload: P, ...rest: any[]) => { type: T, payload: P2, error?: boolean };
declare function createAction<T, P, P2, M>(
type: T,
payloadCreator: (_: P) => P2,
metaCreator: (_: P) => M,
): (
payload: P,
...rest: any[]
) => { type: T, payload: P2, error?: boolean, meta: M };
declare function createAction<T, P, M>(
type: T,
payloadCreator: null | void,
metaCreator: (_: P) => M,
): (
payload: P,
...rest: any[]
) => { type: T, payload: P, error?: boolean, meta: M };
// `createActions` is quite difficult to write a type for. Maybe try not to
// use this one?
declare function createActions(
actionMap: Object,
...identityActions: string[]
): Object;
declare function createActions(...identityActions: string[]): Object;
declare type Reducer<S, A> = (state: S, action: A) => S;
declare type ReducerMap<S, A> =
| { next: Reducer<S, A> }
| { throw: Reducer<S, A> }
| { next: Reducer<S, A>, throw: Reducer<S, A> };
/*
* To get full advantage from Flow, use a type annotation on the action
* argument to your reducer when creating a reducer with `handleAction` or
* `handleActions`. For example:
*
* import { type Reducer } from 'redux'
* import { createAction, handleAction, type Action } from 'redux-actions'
*
* const increment = createAction(INCREMENT, (count: number) => count)
*
* const reducer = handleAction(INCREMENT, (state, { payload }: ActionType<typeof increment>) => {
* // Flow infers that the type of `payload` is number
* }, defaultState)
*/
declare function handleAction<Type, State, Action: { type: Type }>(
type: Type,
reducer: Reducer<State, Action> | ReducerMap<State, Action>,
defaultState: State,
): Reducer<State, Action>;
declare function handleActions<State, Action>(
reducers: {
[key: string]: Reducer<State, Action> | ReducerMap<State, Action>,
},
defaultState?: State,
): Reducer<State, Action>;
declare function combineActions(
...types: (string | Symbol | Function)[]
): string;
}
// type definitions for (some of) underscore
declare module "underscore" {
declare function find<T>(list: ?(T[]), predicate: (val: T) => boolean): ?T;
declare function findWhere<T>(
list: ?(T[]),
properties: { [key: string]: any },
): ?T;
declare function findIndex<T>(
list: ?(T[]),
predicate: (val: T) => boolean,
): number;
declare function findLastIndex<T>(
list: ?(T[]),
predicate: (val: T) => boolean,
): number;
declare function clone<T>(obj: T): T;
declare function isEqual(a: any, b: any): boolean;
declare function range(a: number, b?: number): Array<number>;
declare function extend<S, T>(o1: S, o2: T): S & T;
declare function zip<S, T>(a1: S[], a2: T[]): Array<[S, T]>;
declare function flatten<S>(a: Array<Array<S>>): S[];
declare function each<T>(
o: { [key: string]: T },
iteratee: (val: T, key: string) => void,
): void;
declare function each<T>(
a: T[],
iteratee: (val: T, key: string) => void,
): void;
declare function map<T, U>(a: T[], iteratee: (val: T, n?: number) => U): U[];
declare function map<K, T, U>(
a: { [key: K]: T },
iteratee: (val: T, k?: K) => U,
): U[];
declare function mapObject(
object: Object,
iteratee: (val: any, key: string) => Object,
context?: mixed,
): Object;
declare function object<T>(a: Array<[string, T]>): { [key: string]: T };
declare function every<T>(
a: Array<T> | { [key: string]: T },
pred: (val: T) => boolean,
): boolean;
declare function some<T>(a: Array<T>, pred: (val: T) => boolean): boolean;
declare function all<T>(a: Array<T>, pred: (val: T) => boolean): boolean;
declare function any<T>(a: Array<T>, pred: (val: T) => boolean): boolean;
declare function contains<T>(a: Array<T>, val: T): boolean;
declare function head<T>(a: Array<T>, n?: number): Array<T>;
declare function tail<T>(a: Array<T>, n?: number): Array<T>;
declare function initial<T>(a: Array<T>, n?: number): Array<T>;
declare function rest<T>(a: Array<T>, index?: number): Array<T>;
declare function sortBy<T>(a: T[], iteratee: string | ((val: T) => any)): T[];
declare function filter<T>(
o: { [key: string]: T },
pred: (val: T, k: string) => boolean,
): T[];
declare function isEmpty(o: any): boolean;
declare function isString(o: any): boolean;
declare function isObject(o: any): boolean;
declare function groupBy<T>(
a: Array<T>,
iteratee: string | ((val: T, index: number) => any),
): { [key: string]: T[] };
declare function indexBy<T>(
a: Array<T>,
iteratee: string | ((val: T, index: number) => any),
): { [key: string]: T };
declare function min<T>(a: Array<T> | { [key: any]: T }): T;
declare function max<T>(a: Array<T> | { [key: any]: T }): T;
declare function uniq<T>(a: T[], iteratee?: (val: T) => boolean): T[];
declare function uniq<T>(
a: T[],
isSorted: boolean,
iteratee?: (val: T) => boolean,
): T[];
declare function values<T>(o: { [key: any]: T }): T[];
declare function omit(
o: { [key: any]: any },
...properties: string[]
): { [key: any]: any };
declare function omit(
o: { [key: any]: any },
predicate: (val: any, key: any, object: { [key: any]: any }) => boolean,
): { [key: any]: any };
declare function pick(
o: { [key: any]: any },
...properties: string[]
): { [key: any]: any };
declare function pick(
o: { [key: any]: any },
predicate: (val: any, key: any, object: { [key: any]: any }) => boolean,
): { [key: any]: any };
declare function pluck(
o: Array<{ [key: any]: any }>,
propertyNames: string,
): Array<any>;
declare function has(
o: { [key: any]: any },
...properties: string[]
): boolean;
declare function difference<T>(array: T[], ...others: T[][]): T[];
declare function flatten(a: Array<any>): Array<any>;
declare function debounce<T: Function>(func: T): T;
declare function partition<T>(
array: T[],
pred: (val: T) => boolean,
): [T[], T[]];
// TODO: improve this
declare function chain<S>(obj: S): any;
declare function constant<S>(obj: S): () => S;
declare function isMatch(object: Object, properties: Object): boolean;
declare function identity<T>(o: T): T;
declare function uniqueId(prefix?: string): string;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment