UNPKG

1.39 kBTypeScriptView Raw
1import { Observable } from 'rxjs';
2/**
3 * Custom equality checker that can be used with `.select` and `@select`.
4 * ```ts
5 * const customCompare: Comparator = (x: any, y: any) => {
6 * return x.id === y.id
7 * }
8 *
9 * @select(selector, customCompare)
10 * ```
11 */
12export declare type Comparator = (x: any, y: any) => boolean;
13export declare type Transformer<RootState, V> = (store$: Observable<RootState>, scope: any) => Observable<V>;
14export declare type PropertySelector = string | number | symbol;
15export declare type PathSelector = (string | number)[];
16export declare type FunctionSelector<RootState, S> = (s: RootState) => S;
17export declare type Selector<RootState, S> = PropertySelector | PathSelector | FunctionSelector<RootState, S>;
18/** @hidden */
19export declare const sniffSelectorType: <RootState, S>(selector?: Selector<RootState, S>) => "function" | "nil" | "path" | "property";
20/** @hidden */
21export declare const resolver: <RootState, S>(selector?: Selector<RootState, S>) => {
22 property: (state: any) => any;
23 path: (state: RootState) => any;
24 function: FunctionSelector<RootState, S>;
25 nil: (state: RootState) => RootState;
26};
27/** @hidden */
28export declare const resolveToFunctionSelector: <RootState, S>(selector?: Selector<RootState, S>) => FunctionSelector<RootState, S> | ((state: RootState) => RootState) | ((state: RootState) => any) | ((state: any) => any);
29
\No newline at end of file