Files
typemap/example/index.ts
2025-02-01 23:37:23 +09:00

25 lines
1.2 KiB
TypeScript

import { TypeBox } from '@sinclair/typemap'
import * as z from 'zod'
const Z = z.object({ // const Z: z.ZodObject<{
x: z.number(), // x: z.ZodNumber;
y: z.number(), // y: z.ZodNumber;
z: z.number() // z: z.ZodNumber;
}).strict() // }, "strict", ...>
// TypeBox represents types as Json Schema
const T = TypeBox(Z) // const T = {
// type: 'object',
// required: ['x', 'y', 'z'],
// additionalProperties: false,
// properties: {
// x: { type: 'number' },
// y: { type: 'number' },
// z: { type: 'number' }
// }
// }
console.log(T)