-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
32 lines (23 loc) · 911 Bytes
/
index.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
import { EffectCallback, RefObject } from 'react';
export type CleanupCallback = void | (() => void | undefined);
export type KeyboardEventType = 'keydown' | 'keyup';
export type MountCallback = EffectCallback | { (): Promise<void> };
export type UpdateCallback = EffectCallback | { (): Promise<void> };
export type UseKeyboardEventConfig = {
eventType: KeyboardEventType;
handler: (event: KeyboardEvent) => void;
};
export type UseMutationObserverConfig = {
callback: MutationCallback;
config: MutationObserverInit;
target: RefObject<Node>;
};
export type UseOnOutsideClickConfig = {
callback: () => void;
element: RefObject<HTMLElement>;
};
export type UseResizeObserverConfig = {
callback: ResizeObserverCallback;
target: RefObject<HTMLElement>;
};
export type Comparator<T, R> = ({ newValue, prevValue }: { newValue: T; prevValue: R }) => boolean;