Skip to content

createTypeGuardSchema<T>

Builds a schema over one value from a type guard: the output schema of a method contract, typically.

Import:

import { createTypeGuardSchema } from '@mnaoumov/typescript-lib/api-contract';

Signature:

function createTypeGuardSchema(params: CreateTypeGuardSchemaParams<T>): StandardSchemaV1<unknown, T>

Parameters:

Parameter Type Description
params CreateTypeGuardSchemaParams<T> The guard, what it expects, and optionally the schema’s vendor.

Returns: StandardSchemaV1<unknown, T> — The schema.


Links to this page: