0.1.2 • Published 7 months ago

convince v0.1.2

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
7 months ago

Convince

Type safe schema validation library. Lightweight alternative to Zod.

Install

yarn add convince

Or

npm i convince

Usage

import { s, SchemaType } from 'convince';

const thingSchema = s.object({
  foo: s.string(),
  bar: s.number().optional(),
  baz: s.boolean(),
});

type Thing = SchemaType<typeof thingSchema>;

const thingResult = thingSchema.parse({
  foo: 'Hello',
  baz: true,
});

if (thingResult.ok) {
  console.log(thingResult.data.foo);
}