This commit is contained in:
手瓜一十雪 committed 2025-04-17 09:52:03 +08:00
1 parent 3f6249f39c
commit 54e6d5c3f2
88 files changed
+87 -88

No files matched your search

+14
View File
@@ -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 };