We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aa1b80d commit 6b85ac1Copy full SHA for 6b85ac1
src/utils/types.ts
@@ -42,15 +42,21 @@ export type InitialState<T> = {
42
};
43
44
45
-export type ValidateResult<T> = {
46
- isValid: boolean;
47
- data: T | null;
48
- errors?: Partial<{ [K in keyof T]: T[K] }>;
49
-};
+export type ValidateResult<T> =
+ | {
+ isValid: true;
+ data: T;
+ }
50
51
+ isValid: false;
52
+ data: null;
53
+ errors?: Partial<{ [K in keyof T]: T[K] }>;
54
+ };
55
56
export type useFormErrors<T> = {
57
[K in keyof T]?: string;
58
59
+
60
export interface UseFormReturn<T> {
61
data: T;
62
state: IState<T>;
0 commit comments