lean4-code-actions
Version:
Refactorings and snippets for Lean 4
6 lines (3 loc) • 426 B
text/typescript
import { ZodSchema, ZodTypeDef } from 'zod'
export const getMapperFromSchema = <Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(schema: ZodSchema<Output, Def, Input>) => (input: Input) => schema.parse(input)
export const getMapperPFromSchema = <Output = unknown, Def extends ZodTypeDef = ZodTypeDef, Input = Output>(schema: ZodSchema<Output, Def, Input>) => (input: Input) => schema.parseAsync(input)