UNPKG

@mui/x-data-grid

Version:

The Community plan edition of the Data Grid components (MUI X).

23 lines 1.81 kB
import { RefObject } from '@mui/x-internals/types'; import { Selector, SelectorResultArray } from 'reselect'; export interface OutputSelector<State, Args, Result> { (apiRef: RefObject<{ state: State; } | null>, args?: Args): Result; } type StateFromSelector<T> = T extends ((first: infer F, ...args: any[]) => any) ? F extends RefObject<{ state: infer F2; } | null> ? F2 : F : never; type StateFromSelectorList<Selectors extends readonly any[]> = Selectors extends [f: infer F, ...other: infer R] ? StateFromSelector<F> extends StateFromSelectorList<R> ? StateFromSelector<F> : StateFromSelectorList<R> : {}; type SelectorResultArrayWithArgs<Selectors extends ReadonlyArray<Selector<any>>, Args> = [...SelectorResultArray<Selectors>, Args]; type SelectorArgs<Selectors extends ReadonlyArray<Selector<any>>, Args, Result> = [selectors: [...Selectors], combiner: (...args: SelectorResultArrayWithArgs<Selectors, Args>) => Result] | [...Selectors, (...args: SelectorResultArrayWithArgs<Selectors, Args>) => Result]; type CreateSelectorFunction = <Selectors extends ReadonlyArray<Selector<any>>, Args, Result>(...items: SelectorArgs<Selectors, Args, Result>) => OutputSelector<StateFromSelectorList<Selectors>, Args, Result>; export declare const createSelector: CreateSelectorFunction; /** * Used to create the root selector for a feature. It assumes that the state is already initialized * and strips from the types the possibility of `apiRef` being `null`. * Users are warned about this in our documentation https://mui.com/x/react-data-grid/state/#direct-selector-access */ export declare const createRootSelector: <State, Args, Result>(fn: (state: State, args: Args) => Result) => OutputSelector<State, Args, Result>; export declare const createSelectorMemoized: CreateSelectorFunction; export {};