Files
typebox/docs/syntax/create.md

1.1 KiB

Home | Installation | Usage | Types | Values | Syntax | TypeRegistry | TypeCheck

Create

TypeBox provides experimental support for parsing TypeScript annotation syntax into TypeBox types.

This feature is provided via optional import.

import { Syntax } from "@alkdev/typebox/syntax";

Create

Use the Syntax function to create TypeBox types from TypeScript syntax (Example)

const T = Syntax(`{ x: number, y: number }`); // const T: TObject<{
//   x: TNumber,
//   y: TNumber
// }>

type T = Static<typeof T>; // type T = {
//   x: number,
//   y: number
// }

Back to Home