/
Alex_Ural
/
opencode
Обзор
Документация
Войти
/
Alex_Ural
/
opencode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
packages/console/core/src/util/fn.ts
11 строк
321 B
Frank
wip: zen
18 сен 2025, 17:59
18 сен 2025, 17:59
4ceabdf
Код
Авторство
О чём код?
import { z } from "zod" export function fn<T extends z.ZodType, Result>(schema: T, cb: (input: z.infer<T>) => Result) { const result = (input: z.infer<T>) => { const parsed = schema.parse(input) return cb(parsed) } result.force = (input: z.infer<T>) => cb(input) result.schema = schema return result }