Revision 0.8.6 (#15)

* Parameterized Compile Types

* Documentation | Tests

* Infer Validator via Static

* Version
This commit is contained in:
sinclairzx81
2025-01-28 18:14:33 +09:00
committed by GitHub
parent 85f38f4b2b
commit be5a202ad1
9 changed files with 189 additions and 97 deletions

39
test/compile.ts Normal file
View File

@@ -0,0 +1,39 @@
import { Assert } from './assert'
import { TypeBox, Valibot, Zod, Compile } from '@sinclair/typemap'
describe('Compile', () => {
it('Should compile Syntax', () => {
const C = Compile('123')
Assert.IsTrue(C.Check(123))
})
it('Should compile Syntax (Parameterized)', () => {
const C = Compile({ T: TypeBox('123') }, 'T')
Assert.IsTrue(C.Check(123))
})
it('Should compile TypeBox', () => {
const C = Compile(TypeBox('123'))
Assert.IsTrue(C.Check(123))
})
it('Should compile TypeBox (Parameterized)', () => {
const C = Compile({ T: TypeBox('123') }, 'T')
Assert.IsTrue(C.Check(123))
})
it('Should compile Valibot', () => {
const C = Compile(Valibot('123'))
Assert.IsTrue(C.Check(123))
})
it('Should compile Valibot (Parameterized)', () => {
const C = Compile({ T: Valibot('123') }, 'T')
Assert.IsTrue(C.Check(123))
})
it('Should compile Zod', () => {
const C = Compile(Zod('123'))
Assert.IsTrue(C.Check(123))
})
it('Should compile Zod (Parameterized)', () => {
const C = Compile({ T: Zod('123') }, 'T')
Assert.IsTrue(C.Check(123))
})
})

View File

@@ -1,3 +1,4 @@
import './compile'
import './options'
import './parameters'
import './typebox-from-zod'