v0.17.0
TypeScript inference from plain JSON Schema.
- New exported
Infer<S>type maps a schema literal to its data type, andnew Validator(defineSchema({...}))returnsValidator<Infer<S>>, sovalidate()narrowsresult.datawith no manual annotation. Write plain JSON Schema, get the type for free, no builder DSL. Covers primitives, type-array unions,const,enum, objects (required vs optional), and arrays;$ref, tuples, andanyOf/oneOfinferunknownfor now. Pure.d.ts, no runtime impact.
Fixed
validateAndParse()now works: it is implemented in JavaScript (JSON.parsethen validate) and returns{ valid, value, errors }. It previously called a native method that does not exist and threw on every call. Works with or without the native addon and in the browser.