aboutsummaryrefslogtreecommitdiffstats
path: root/src/types
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-11-03 19:34:16 +0100
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:15:27 +0100
commitddd45e29745b73e7fe1684e197dcff598b375644 (patch)
tree8bf01305b5c0d163c52a7dce747ed7a4a4650acb /src/types
parent5d3e8a4d0c2ce2ad8f22df857ab3ce54fcfc38ac (diff)
feat(hooks): add an useForm hook
* add two "sub"-hooks: useFormValues and useFormSubmit (that can be used independently) * handle initial data * handle custom submit callback * handle data validation * handle submit status
Diffstat (limited to 'src/types')
-rw-r--r--src/types/generics.ts5
-rw-r--r--src/types/index.ts1
2 files changed, 6 insertions, 0 deletions
diff --git a/src/types/generics.ts b/src/types/generics.ts
new file mode 100644
index 0000000..5377c54
--- /dev/null
+++ b/src/types/generics.ts
@@ -0,0 +1,5 @@
+export type Maybe<T> = T | undefined;
+
+export type Nullable<T> = T | null;
+
+export type DataValidator<T> = (data: T) => boolean | Promise<boolean>;
diff --git a/src/types/index.ts b/src/types/index.ts
index c9820db..e2f0f55 100644
--- a/src/types/index.ts
+++ b/src/types/index.ts
@@ -1,4 +1,5 @@
export * from './app';
+export * from './generics';
export * from './graphql';
export * from './mdx';
export * from './raw-data';