MVFM

zod/from

Import a runtime Zod schema into the mvfm zod namespace

const userSchema = z.object({
  name: z.string().min(2),
  age: z.number().int().gte(18),
});
const app = mvfm(prelude, zod);
const prog = app(($) => {
  return $.zod.from(userSchema).safeParse($.input);
});
await fold(
  defaults(app),
  injectInput(prog, { name: "Ada", age: 21 })
);
Ctrl+Enter