-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
67 lines (60 loc) · 1.68 KB
/
types.ts
File metadata and controls
67 lines (60 loc) · 1.68 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
export type FunctionComponent<P = {}> = (props: P) => ZeroactElement | null;
export interface ZeroactElement {
type: string | FunctionComponent;
props: {
children: ZeroactNode[];
key?: string | number;
[key: string]: any;
};
key?: string | number;
}
export interface TextElement {
type: "TEXT_ELEMENT";
props: {
nodeValue: string;
children: never[];
key?: string | number;
};
key?: string | number;
}
export type ZeroactNode = ZeroactElement | TextElement | string | number | null;
export interface Fiber {
type?: string | FunctionComponent | undefined;
isSvg?: boolean;
props: any;
dom?: HTMLElement | SVGElement | Text | null;
return?: Fiber | null;
child?: Fiber | null;
sibling?: Fiber | null;
alternate?: Fiber | null;
effectTag?: "UPDATE" | "PLACEMENT" | "DELETION" | "SKIP" | "PROCESS";
stateHooks?: any[];
effectHooks?: any[];
callbackHooks?: any[];
contextHooks?: ContextHook<any>[];
refHooks?: RefObject<any>[];
hookIndex?: number;
}
// useEffect Hook
export interface EffectHook {
effect: () => void | (() => void); // Effect func, can return cleanup func
cleanup?: () => void; // Cleanup func from previous effect
deps?: any[]; // Dependency array
isDirty?: boolean; // Whether the effect needs to run
}
// UseRef Hook
export interface RefObject<T> {
rotationTweenRef: gsap.core.Timeline;
current: T | null;
}
// useContext Hook
export interface Context<T> {
_currentValue: T;
_defaultValue: T;
Provider: FunctionComponent<{ value: T; children: ZeroactNode[] }>;
Consumer: FunctionComponent<{ children: (value: T) => ZeroactElement }>;
}
export interface ContextHook<T> {
context: Context<T>;
value: T;
}