Files
typebox/changelog/0.28.3.md
glm-5.1 bd758c2342 Fork from @sinclair/typebox 0.34.49 as @alkdev/typebox
- Rename package from @sinclair/typebox to @alkdev/typebox
- Update author, repository, and homepage to alkdev
- Remove GitHub workflows, .vscode config, and branding assets
- Update all source, test, example, changelog, and task imports
- Update tsconfig.json path mappings
- Clean up readme header (remove upstream badges/branding)
2026-04-23 13:22:31 +00:00

1.2 KiB

0.28.3

Overview

Revision 0.28.3 adds a new Rest type to support variadic type composition.

Contents

Variadic Types

Revision 0.28.3 adds a new type named Type.Rest. This type is used to extract a tuple array of type of [...TSchema]. The return value of this type is not strictly JSON Schema, however the tuple array can be used as a parameter to other types that accept tuples as their arguments.

Tuple Concatenation

// TypeScript

type A = [1, 2]

type B = [3, 4]

type C = [...A, ...B]

// TypeBox

const A = Type.Tuple([Type.Literal(1), Type.Literal(2)])

const B = Type.Tuple([Type.Literal(3), Type.Literal(4)])

const C = Type.Tuple([...Type.Rest(A), ...Type.Rest(B)])

Tuple To Parameter

// TypeScript

type P = [number, number]

type F1 = (param: [...P]) => void

type F2 = (param: [...P, number]) => void

// TypeBox

const P = Type.Tuple([Type.Number(), Type.Number()])

const F1 = Type.Function(Type.Rest(P), Type.Void())

const F2 = Type.Function([...Type.Rest(P), Type.Number()], Type.Void())