Skip to content

v0.4.0

Latest

Choose a tag to compare

@mertcanaltin mertcanaltin released this 25 May 21:02

Adds the .schema.json convention. A <name>.schema.json source compiles to <name>.schema.js (a zero-dependency validator) and <name>.schema.d.ts, so you can:

import validate, { type User, isValid } from './user.schema'

The default export is the validate function; validate, isValid, and the inferred type are also named exports. The type name comes from the schema's title, then $id, then the file name. The default glob is **/*.schema.json, excluding node_modules. Sources without the .schema suffix keep the existing .validator.mjs output.