0.0.5 • Published 1 year ago
@hoseung.json/schema v0.0.5
$ npm install @hoseung.json/schema
import { S } from "@hoseung.json/schema";
// {
// type: "object",
// properties: {
// id: { type: "number" },
// name: { type: "string" }
// }
// required: ["id", "name"]
// }
const User = S.Object({
id: S.Number(),
name: S.String(),
});
// {
// id: number;
// name: string;
// }
type User = S.Resolve<typeof User>;