Schemastery is a TypeScript-driven schema validation library (v3.18.0, actively maintained, monthly releases). It defines schemas using TypeScript inference rather than runtime builders, offering type-safe validation and transformation. Compared to Zod or Yup, it emphasizes integration with TypeScript generics for maximum type inference and a lightweight footprint. It supports nested objects, arrays, unions, and custom types with full type narrowing and error reporting.
npm install schemasteryNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Defines a user schema with string and number, validates data, and infers the TypeScript type.
Check result.error instead of result === true.
Use named imports: import { s, Schema } from 'schemastery'.Use import { string } from 'schemastery' instead of Schema.string().Use union helper: import { union } from 'schemastery'.Use named import: import { s } from 'schemastery'Ensure schemastery v3 installed and use correct schema from object() result.
Add the required field or mark it as optional with .optional()
Install schemastery via npm (includes types).
No dependency data recorded yet.