Fix apps/console lint issues
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -9,13 +9,13 @@ export function useStateWithSchema<T extends ZodTypeAny>(
|
||||
const [value, errors] = useMemo((): [z.infer<T>, Record<string, string>] => {
|
||||
try {
|
||||
schema.parse(state);
|
||||
return [schema.parse(state), {}];
|
||||
return [schema.parse(state) as z.TypeOf<T>, {}];
|
||||
} catch (error) {
|
||||
if (error instanceof ZodError) {
|
||||
return [
|
||||
state,
|
||||
Object.fromEntries(
|
||||
error.issues.map((issue) => [
|
||||
error.issues.map(issue => [
|
||||
issue.path.join("."),
|
||||
issue.message,
|
||||
]) ?? [],
|
||||
@@ -32,7 +32,7 @@ export function useStateWithSchema<T extends ZodTypeAny>(
|
||||
errors,
|
||||
update: useCallback(
|
||||
<TKey extends keyof z.infer<T>>(key: TKey, value: z.infer<T>[TKey]) => {
|
||||
setState((prevState) => ({ ...prevState, [key]: value }));
|
||||
setState(prevState => ({ ...prevState, [key]: value }));
|
||||
},
|
||||
[],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user