From 55401cda201f5fccf08ac4d305ac7f817e13db67 Mon Sep 17 00:00:00 2001 From: sinclair Date: Wed, 29 Nov 2023 20:00:40 +0900 Subject: [PATCH] Revision 0.32.0 --- examples/index.ts | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/examples/index.ts b/examples/index.ts index a6a2f2c1a..ed52156bd 100644 --- a/examples/index.ts +++ b/examples/index.ts @@ -1,2 +1,40 @@ -import Type, { JavaScriptTypeBuilder, FormatRegistry, type Static } from '@sinclair/typebox' -import Value from '@sinclair/typebox/value' +import { TypeSystem } from '@sinclair/typebox/system' +import { TypeCompiler } from '@sinclair/typebox/compiler' +import { Value, ValuePointer } from '@sinclair/typebox/value' +import { Type, TypeGuard, Kind, Static, TSchema } from '@sinclair/typebox' + +// ----------------------------------------------------------- +// Create: Type +// ----------------------------------------------------------- + +const T = Type.Object({ + x: Type.Number(), + y: Type.Number(), + z: Type.Number(), +}) + +type T = Static + +console.log(T) + +// ----------------------------------------------------------- +// Create: Value +// ----------------------------------------------------------- + +const V = Value.Create(T) + +console.log(V) + +// ----------------------------------------------------------- +// Compile: Type +// ----------------------------------------------------------- + +const C = TypeCompiler.Compile(T) + +console.log(C.Code()) + +// ----------------------------------------------------------- +// Check: Value +// ----------------------------------------------------------- + +console.log(C.Check(V))