Skip to main content
Module

x/enzastdlib/schema/mod.ts>SchemaTypeOf

enzastdlib is a set of TypeScript modules that follow a common design API philosophy aiming at sane defaults and ease-of-use targeting the Deno TypeScript runtime.
Latest
type alias SchemaTypeOf
import { type SchemaTypeOf } from "https://deno.land/x/enzastdlib@v0.0.4/schema/mod.ts";

Returns the JSON Schema type of a specified JavaScript type.

Examples

Example 1

import type { SchemaTypeOf } from 'https://deno.land/x/enzastdlib/schema/mod.ts';

const my_string = 'Hello World!';

type MyStringSchemaType = SchemaTypeOf<typeof my_string>; // "string"
definition: Type extends boolean ? "boolean" : (Type extends null ? "null" : (Type extends number ? "number" : (Type extends string ? "string" : (Type extends unknown[] ? "array" : (Type extends Record<string, unknown> ? "object" : never)))))