Revision 0.8.4 (#13)

* Parameterized Types

* Syntax Options

* Documentation
This commit is contained in:
sinclairzx81
2025-01-28 02:39:50 +09:00
committed by GitHub
parent c2991c1972
commit 78dc497ef8
21 changed files with 451 additions and 159 deletions

View File

@@ -1,6 +1,10 @@
import { TypeBox, Valibot, Zod } from '@sinclair/typemap'
// TypeScript Syntax Type
// Parse Syntax | Parse Value
const R = Zod('string | number').parse('...') // const R: string | number
// Syntax Type
const S = `{
x: number,
@@ -8,8 +12,6 @@ const S = `{
z: number
}`
// Construct Library Types from Syntax
const T = TypeBox(S) // const T: TObject<{
// x: TNumber,
// y: TNumber,
@@ -29,6 +31,3 @@ const Z = Zod(S) // const Z: ZodObject<{
// z: ZodNumber
// }, ...>
// Parse Syntax | Parse Value
const R = Zod('string | number').parse('...') // const R: string | number