Suretype is a ridiculously fast and type-safe JSON schema validator for TypeScript and JavaScript. Current stable version is 3.3.1 (pure ESM, Node >=14.13.1 or >=16.0.0). It compiles validator functions using Ajv, extracts JSON Schema, and deduces TypeScript types at compile-time. Key differentiators: ~70x faster than Joi, ~100x faster than Superstruct, ~2500x faster than Zod; supports full JSON Schema but nothing beyond; errors prettified with awesome-ajv-errors; integrates with typeconv for conversion to/from JSON Schema, Open API, TypeScript types, or GraphQL. Works in browsers.
npm install suretypeNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Defines a user schema, compiles a validator, validates data, and logs result.
Use ES modules ("type": "module" in package.json) or dynamic import().Upgrade Node.js to ^14.13.1 || >=16.0.0.
Avoid mutating 'v' directly; create local schemas instead.
Use Ajv's custom keyword extension if needed, but it's not directly exposed by suretype.
Add "type": "module" to package.json or rename file to .mjs.
Use dynamic import: const { v } = await import('suretype'); or switch to ES modules.Ensure you have the correct named import: import { v } from 'suretype';