UNPKG

downshift

Version:

🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.

27 lines (26 loc) 655 B
type StateReducerProp<S extends object, A extends { type: string; }> = (state: S, actionAndChanges: (A & { props: any; }) & { changes: Partial<S>; }) => Partial<S>; export type Props<S extends object, A extends { type: string; }> = Partial<S> & { stateReducer: StateReducerProp<S, A>; onStateChange?: (changes: { type: A['type']; } & Partial<S>) => void; }; export type Action<S extends object, A extends { type: string; }, P extends Props<S, A>> = A & { props: P; }; export type Reducer<S extends object, A extends { type: string; }> = (state: S, action: A & { props: any; }) => Partial<S>; export {};