UNPKG

1.13 kBTypeScriptView Raw
1/**
2 * @name HOOK
3 * @author Fajar Rizky Hidayat <fajarrizkyhidayat@gmail.com>
4 */
5
6export type EventSend<T = any> = {
7 ctr?: AbortController;
8 scenario?: string;
9 params?: Record<string, any>;
10 data?: (scenario?: string | boolean) => Partial<T>;
11 keys?: (scenario?: boolean | string) => { name: string; keys: string[] }[];
12 parser?: (value: any) => void;
13};
14
15type FixArr<T> = T extends readonly any[]
16 ? Omit<T, Exclude<keyof any[], number>>
17 : T;
18type DropInitDot<T> = T extends `.${infer U}` ? U : T;
19type _DeepKeys<T> = T extends object
20 ? {
21 [K in (string | number) & keyof T]: `${
22 | `.${K}`
23 | (`${K}` extends `${number}` ? `.${K}` : never)}${
24 | ""
25 | _DeepKeys<FixArr<T[K]>>}`;
26 }[(string | number) & keyof T]
27 : never;
28export type DeepKeys<T> = DropInitDot<_DeepKeys<FixArr<T>>>;
29
30export { default as UseMutation, UseMutationProps } from "./useMutation";
31export {
32 default as UseTable,
33 UseTablePagination,
34 UseTablePaginationProps,
35} from "./useTable";
36export { default as UseFetch } from "./useFetch";
37export { default as UseSvalidation } from "./useSValidation";
38
\No newline at end of file