fix
This commit is contained in:
1 parent
abe6e46750
commit
a2d11a7d7d
88 files changed
+87
-88
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import { z } from "zod";
|
||||
const boolean = () => z.preprocess(
|
||||
val => typeof val === 'string' && (val.toLowerCase() === 'false' || val === '0') ? false : Boolean(val),
|
||||
z.boolean()
|
||||
);
|
||||
const number = () => z.preprocess(
|
||||
val => typeof val !== 'number' ? Number(val) : val,
|
||||
z.number()
|
||||
);
|
||||
const string = () => z.preprocess(
|
||||
val => typeof val !== 'string' ? String(val) : val,
|
||||
z.string()
|
||||
);
|
||||
export const actionType = { boolean, number, string };
|
||||
Reference in new issue
Block a user