(schema: T, cb: (input: z.infer<T>) => Result)
| 1 | import { z } from "zod" |
| 2 | |
| 3 | export function fn<T extends z.ZodType, Result>(schema: T, cb: (input: z.infer<T>) => Result) { |
| 4 | const result = (input: z.infer<T>) => { |
| 5 | const parsed = schema.parse(input) |
| 6 | return cb(parsed) |
| 7 | } |
| 8 | result.force = (input: z.infer<T>) => cb(input) |
| 9 | result.schema = schema |
| 10 | return result |
| 11 | } |
no outgoing calls
no test coverage detected