Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/typebox/src/typebox.ts>StandardTypeBuilder

JSON Schema Type Builder with Static Type Resolution for TypeScript
Go to Latest
class StandardTypeBuilder
extends TypeBuilder
import { StandardTypeBuilder } from "https://deno.land/x/typebox@0.26.0-dev.1/src/typebox.ts";

Methods

Any(options?: SchemaOptions): TAny

[Standard] Creates an Any type

Array<T extends TSchema>(items: T, options?: ArrayOptions): TArray<T>

[Standard] Creates an Array type

[Standard] Creates a Boolean type

Composite<T extends TObject[]>(schemas: [...T], options?: ObjectOptions): TComposite<T>

[Standard] Creates a Composite object type that will Union any overlapping properties of the given Object array

Deref<T extends TRef>(schema: T): TDeref<T>

[Standard] Dereferences the given TRef to its target type

Enum<T extends Record<string, string | number>>(item: T, options?: SchemaOptions): TEnum<T>

[Standard] Creates a Enum type

Exclude<L extends TSchema, R extends TSchema>(
left: L,
right: R,
options?: SchemaOptions,
): TExclude<L, R>

[Standard] Excludes from the left type any type that is not assignable to the right

Extends<L extends TSchema, R extends TSchema, T extends TSchema, U extends TSchema>(
left: L,
right: R,
trueType: T,
falseType: U,
options?: SchemaOptions,
): TExtends<L, R, T, U>

[Standard] A conditional type expression that will return the true type if the left type extends the right

Extract<L extends TSchema, R extends TSchema>(
left: L,
right: R,
options?: SchemaOptions,
): TExtract<L, R>

[Standard] Extracts from left left any type that is assignable to the right

Integer(options?: NumericOptions<number>): TInteger

[Standard] Creates an Integer type

Intersect(allOf: [], options?: SchemaOptions): TNever

[Standard] Creates a Intersect type

Intersect<T extends [TSchema]>(allOf: [...T], options?: SchemaOptions): T[0]

[Standard] Creates a Intersect type

Intersect<T extends TSchema[]>(allOf: [...T], options?: IntersectOptions): TIntersect<T>
KeyOf<T extends TSchema>(schema: T, options?: SchemaOptions): TKeyOf<T>

[Standard] Creates a KeyOf type

Literal<T extends TLiteralValue>(value: T, options?: SchemaOptions): TLiteral<T>

[Standard] Creates a Literal type

[Standard] Creates a Never type

Not<N extends TSchema, T extends TSchema>(
not: N,
schema: T,
options?: SchemaOptions,
): TNot<N, T>

[Standard] Creates a Not type. The first argument is the disallowed type, the second is the allowed.

[Standard] Creates a Null type

Number(options?: NumericOptions<number>): TNumber

[Standard] Creates a Number type

Object<T extends TProperties>(properties: T, options?: ObjectOptions): TObject<T>

[Standard] Creates an Object type

Omit<T extends TSchema, K extends (keyof Static<T>)[]>(
schema: T,
keys: readonly [...K],
options?: SchemaOptions,
): TOmit<T, K[number]>

[Standard] Creates a mapped type whose keys are omitted from the given type

Omit<T extends TSchema, K extends TUnion<TLiteral<string>[]>>(
schema: T,
keys: K,
options?: SchemaOptions,
): TOmit<T, TUnionOfLiteral<K>>

[Standard] Creates a mapped type whose keys are omitted from the given type

Optional<T extends TSchema>(schema: T): TOptional<T>

[Modifier] Creates a Optional property

Partial<T extends TSchema>(schema: T, options?: ObjectOptions): TPartial<T>

[Standard] Creates a mapped type where all properties are Optional

Pick<T extends TSchema, K extends (keyof Static<T>)[]>(
schema: T,
keys: readonly [...K],
options?: SchemaOptions,
): TPick<T, K[number]>

[Standard] Creates a mapped type whose keys are picked from the given type

Pick<T extends TSchema, K extends TUnion<TLiteral<string>[]>>(
schema: T,
keys: K,
options?: SchemaOptions,
): TPick<T, TUnionOfLiteral<K>>

[Standard] Creates a mapped type whose keys are picked from the given type

Readonly<T extends TSchema>(schema: T): TReadonly<T>

[Modifier] Creates a Readonly object or property

ReadonlyOptional<T extends TSchema>(schema: T): TReadonlyOptional<T>

[Modifier] Creates a ReadonlyOptional property

Record<K extends TUnion<TLiteral<string | number>[]>, T extends TSchema>(
key: K,
schema: T,
options?: ObjectOptions,
): TObject<TRecordPropertiesFromUnionLiteral<K, T>>

[Standard] Creates an Object type from the given Literal Union

Record<K extends TLiteral<string | number>, T extends TSchema>(
key: K,
schema: T,
options?: ObjectOptions,
): TObject<TRecordPropertiesFromLiteral<K, T>>

[Standard] Creates an Object type from the given Literal Union

Record<K extends TString | TNumeric, T extends TSchema>(
key: K,
schema: T,
options?: ObjectOptions,
): TRecord<K, T>

[Standard] Creates a Record type

Recursive<T extends TSchema>(callback: (self: TSelf) => T, options?: SchemaOptions): TRecursive<T>

[Standard] Creates a Recursive type

Ref<T extends TSchema>(schema: T, options?: SchemaOptions): TRef<T>

[Standard] Creates a Ref type. The referenced type must contain a $id

Required<T extends TSchema>(schema: T, options?: SchemaOptions): TRequired<T>

[Standard] Creates a mapped type where all properties are Required

String<Format extends string>(options?: StringOptions<StringFormatOption | Format>): TString<Format>

[Standard] Creates a String type

Tuple<T extends TSchema[]>(items: [...T], options?: SchemaOptions): TTuple<T>

[Standard] Creates a Tuple type

Union(anyOf: [], options?: SchemaOptions): TNever

[Standard] Creates a Union type

Union<T extends [TSchema]>(anyOf: [...T], options?: SchemaOptions): T[0]

[Standard] Creates a Union type

Union<T extends TSchema[]>(anyOf: [...T], options?: SchemaOptions): TUnion<T>

[Standard] Creates a Union type

[Standard] Creates an Unknown type

Unsafe<T>(options?: UnsafeOptions): TUnsafe<T>

[Standard] Creates a Unsafe type that infers for the generic argument