-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.d.ts
45 lines (33 loc) · 967 Bytes
/
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
interface callbackFn {
(): void
}
type partialStates<T> = { [K in keyof T]?: T[K] };
interface setSingleStateFn<T> {
(partialStates: partialStates<T>, callback?: callbackFn): void;
}
interface getStateFn<T> {
(): T
}
interface setStateFn<T> {
(newState: T, callback?: callbackFn): void;
}
interface lifeCycle {
didMount?: {(): void},
willUnmount?: {(): void},
didUpdate?: {(): void},
didMountAndWillUnmount?: Array<{
didMount: {(): void},
willUnmount: {(): void}
}>
}
interface getIntervalValFn<T> {
(): T
}
interface setIntervalValFn<T> {
(val: T): void
}
export function useStateCB<T>(initialState?:T): [getStateFn<T>, setStateFn<T>]
export function useSingleState<T>(initialState?:T): [T, setSingleStateFn<T>]
export function useLifeCycle(lifeCycle: lifeCycle): void
export function useInstanceVar<T>(initialValue?: T): [getIntervalValFn<T>, setIntervalValFn<T>]
export function useSingleInstanceVar<T>(initialState?:T): T