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

x/typebox_deno/src/value/value.ts>Value.Cast

JSON Schema Type Builder with Static Type Resolution for TypeScript
Latest
function Value.Cast
import { Value } from "https://deno.land/x/typebox_deno@0.31.22/src/value/value.ts";
const { Cast } = Value;

Casts a value into a given type. The return value will retain as much information of the original value as possible.

Type Parameters

T extends Types.TSchema

Parameters

schema: T
references: Types.TSchema[]
value: unknown

Returns

Types.Static<T>

Casts a value into a given type. The return value will retain as much information of the original value as possible.

Type Parameters

T extends Types.TSchema

Parameters

schema: T
value: unknown

Returns

Types.Static<T>