aboutsummaryrefslogtreecommitdiffstats
path: root/src/types/app.ts
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-10-26 19:07:31 +0200
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:15:27 +0100
commit795b92cc1a168c48c7710ca6e0e1ef5974013d95 (patch)
tree8f57204b0ffe7c8acb3203a24292f375377b6369 /src/types/app.ts
parent9aeb82269d7c74c4566b7ca254782a4dfbd69a6e (diff)
refactor(hooks): rewrite useLocalStorage hook
* return a tuple instead of an object * add a validator function as parameter (if the stored value is manually changed, it is not safe to cast its type) * add tests
Diffstat (limited to 'src/types/app.ts')
-rw-r--r--src/types/app.ts2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/types/app.ts b/src/types/app.ts
index 2e892b8..93ba1db 100644
--- a/src/types/app.ts
+++ b/src/types/app.ts
@@ -135,3 +135,5 @@ export type Position = 'bottom' | 'center' | 'left' | 'right' | 'top';
/** Spacing keys defined has CSS variables */
export type Spacing = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
+
+export type Validator<T> = (value: unknown) => value is T;