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 | import React = require("react");
|
30 | import ReactDOM = require(".");
|
31 |
|
32 | export {};
|
33 |
|
34 | declare const REACT_FORM_STATE_SIGIL: unique symbol;
|
35 |
|
36 | declare module "." {
|
37 | function prefetchDNS(href: string): void;
|
38 |
|
39 | interface PreconnectOptions {
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 | crossOrigin?: "anonymous" | "use-credentials" | "" | undefined;
|
46 | }
|
47 | function preconnect(href: string, options?: PreconnectOptions): void;
|
48 |
|
49 | type PreloadAs =
|
50 | | "audio"
|
51 | | "document"
|
52 | | "embed"
|
53 | | "fetch"
|
54 | | "font"
|
55 | | "image"
|
56 | | "object"
|
57 | | "track"
|
58 | | "script"
|
59 | | "style"
|
60 | | "video"
|
61 | | "worker";
|
62 | interface PreloadOptions {
|
63 | as: PreloadAs;
|
64 | crossOrigin?: "anonymous" | "use-credentials" | "" | undefined;
|
65 | fetchPriority?: "high" | "low" | "auto" | undefined;
|
66 |
|
67 | imageSizes?: string | undefined;
|
68 | imageSrcSet?: string | undefined;
|
69 | integrity?: string | undefined;
|
70 | nonce?: string | undefined;
|
71 | referrerPolicy?: ReferrerPolicy | undefined;
|
72 | }
|
73 | function preload(href: string, options?: PreloadOptions): void;
|
74 |
|
75 |
|
76 | type PreloadModuleAs = RequestDestination;
|
77 | interface PreloadModuleOptions {
|
78 | |
79 |
|
80 |
|
81 | as: PreloadModuleAs;
|
82 | crossOrigin?: "anonymous" | "use-credentials" | "" | undefined;
|
83 | integrity?: string | undefined;
|
84 | nonce?: string | undefined;
|
85 | }
|
86 | function preloadModule(href: string, options?: PreloadModuleOptions): void;
|
87 |
|
88 | type PreinitAs = "script" | "style";
|
89 | interface PreinitOptions {
|
90 | as: PreinitAs;
|
91 | crossOrigin?: "anonymous" | "use-credentials" | "" | undefined;
|
92 | fetchPriority?: "high" | "low" | "auto" | undefined;
|
93 | precedence?: string | undefined;
|
94 | integrity?: string | undefined;
|
95 | nonce?: string | undefined;
|
96 | }
|
97 | function preinit(href: string, options?: PreinitOptions): void;
|
98 |
|
99 |
|
100 | type PreinitModuleAs = "script";
|
101 | interface PreinitModuleOptions {
|
102 | |
103 |
|
104 |
|
105 | as?: PreinitModuleAs;
|
106 | crossOrigin?: "anonymous" | "use-credentials" | "" | undefined;
|
107 | integrity?: string | undefined;
|
108 | nonce?: string | undefined;
|
109 | }
|
110 | function preinitModule(href: string, options?: PreinitModuleOptions): void;
|
111 |
|
112 | interface FormStatusNotPending {
|
113 | pending: false;
|
114 | data: null;
|
115 | method: null;
|
116 | action: null;
|
117 | }
|
118 |
|
119 | interface FormStatusPending {
|
120 | pending: true;
|
121 | data: FormData;
|
122 | method: string;
|
123 | action: string | ((formData: FormData) => void | Promise<void>);
|
124 | }
|
125 |
|
126 | type FormStatus = FormStatusPending | FormStatusNotPending;
|
127 |
|
128 | function useFormStatus(): FormStatus;
|
129 |
|
130 | function useFormState<State>(
|
131 | action: (state: Awaited<State>) => State | Promise<State>,
|
132 | initialState: Awaited<State>,
|
133 | permalink?: string,
|
134 | ): [state: Awaited<State>, dispatch: () => void];
|
135 | function useFormState<State, Payload>(
|
136 | action: (state: Awaited<State>, payload: Payload) => State | Promise<State>,
|
137 | initialState: Awaited<State>,
|
138 | permalink?: string,
|
139 | ): [state: Awaited<State>, dispatch: (payload: Payload) => void];
|
140 | }
|
141 |
|
142 | declare module "./client" {
|
143 | interface ReactFormState {
|
144 | [REACT_FORM_STATE_SIGIL]: never;
|
145 | }
|
146 |
|
147 | interface HydrationOptions {
|
148 | formState?: ReactFormState | null;
|
149 | }
|
150 | }
|