-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.d.ts
49 lines (37 loc) · 1.19 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { Context, ComponentType } from 'react';
import {
Action,
Dispatch,
Store,
} from 'redux';
type CustomContext = Context<unknown>;
export type ProviderProps<S, A extends Action> = {
store: Store<S, A>;
customContext?: CustomContext;
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type ProviderType<S = unknown, A extends Action = any>
= ComponentType<ProviderProps<S, A>>;
export const createCustomContext: () => CustomContext;
export const Provider: ProviderType;
type Opts = {
customContext?: CustomContext;
};
export const useDispatch: <A extends Action>(opts?: Opts) => Dispatch<A>;
export const useTrackedState: <S extends {}>(opts?: Opts) => S;
export const useSelector: <S, V>(
selector: (state: S) => V,
equalityFn?: (a: V, b: V) => boolean | Opts & { equalityFn?: (a: V, b: V) => boolean },
opts?: Opts,
) => V;
// deep proxy utils
/**
* If `obj` is a proxy, it will mark the entire object as used.
* Otherwise, it does nothing.
*/
export const trackMemo: (obj: unknown) => void;
/**
* If `obj` is a proxy, it will return the original object.
* Otherwise, it will return null.
*/
export const getUntrackedObject: <T>(obj: T) => T | null;