zod-struct
v2.1.3
Published
Create runtime-checked structs with Zod
Readme
zod-struct
Create runtime-checked structs with Zod.
Usage
import Struct from "zod-struct"
import { z } from "zod"
const Person = new Struct(z.object({
name: z.string(),
email: z.string().email()
}))
const alice = new Person({
name: "Alice",
email: "[email protected]"
})
// Checks validity with schema on property change
alice.name = "Alice Example"