Generic Schema — With Default Arguments

Pass a defaults array as the first argument so the template can be validated directly — without calling .apply(). The template function is called once with the defaults and the result is cached.

editor.ts
Loading editor...
Waiting for code...
Assign a validation result to a variable to see output here, e.g. const result = schema.validate(data)
Inferred Type

Define a schema to see its inferred TypeScript type.

InferType<typeof schema> automatically derives the TypeScript type from your schema definition.