Revision 0.8.0 (#9)

- Rename to TypeMap
This commit is contained in:
sinclairzx81
2025-01-26 03:27:38 +09:00
committed by GitHub
parent d24876b2ac
commit 5ce19b2f4f
52 changed files with 3769 additions and 1228 deletions

View File

@@ -1,23 +1,25 @@
import { Box } from '@sinclair/typebox-adapter'
import * as v from 'valibot'
import * as z from 'zod'
import { TypeBox, Zod, Valibot } from '@sinclair/typemap'
// Valibot to TypeBox (Runtime)
// const T: TObject<{ ... }>
const V = Box(
v.object({
x: v.number(),
y: v.number(),
z: v.number(),
}),
)
const T = TypeBox(`{
x: number,
y: number,
z: number
}`)
// Zod to TypeBox (Static)
// const V: ObjectSchema<{ ... }>
const Z = Box(
z.object({
a: z.string(),
b: z.string(),
c: z.string(),
}),
)
const V = Valibot(`{
x: number,
y: number,
z: number
}`)
// const Z: ZodObject<{ ... }>
const Z = Zod(`{
x: number,
y: number,
z: number
}`)