Schema overview

The schemata-ts schema type

Added in v1.0.0


Table of contents


Guards

isSchema

Signature

export declare const isSchema: (u: unknown) => u is Schema<unknown, unknown>

Added in v2.0.0

Implementation

SchemaImplementation (class)

Signature

export declare class SchemaImplementation<I, O> {
  protected constructor(runSchema: <S extends hkt.SchemableLambda>(S: Schemable<S>) => hkt.SchemableKind<S, I, O>)
}

Added in v2.1.0

[SchemaSymbol] (property)

Signature

readonly [SchemaSymbol]: typeof SchemaSymbol

Added in v2.0.0

input (property)

Signature

readonly input: (_: I) => I

Added in v2.0.0

output (property)

Signature

readonly output: (_: O) => O

Added in v2.0.0

runSchema (property)

Signature

readonly runSchema: <S extends hkt.SchemableLambda>(S: Schemable<S>) => hkt.SchemableKind<S, I, O>

Added in v2.0.0

Model

Schema (interface)

Signature

export interface Schema<I, O = I> {
  readonly [SchemaSymbol]: SchemaSymbol
  readonly input: (_: I) => I
  readonly output: (_: O) => O
  readonly runSchema: <S extends hkt.SchemableLambda>(S: Schemable<S>) => hkt.SchemableKind<S, I, O>
}

Added in v1.0.0

Type Helpers

InputOf (type alias)

Extract the input type of a schema.

Signature

export type InputOf<S> = S extends Schema<infer I, any> ? I : never

Added in v1.0.0

OutputOf (type alias)

Extract the output of a schema.

Alias of TypeOf

Signature

export type OutputOf<S> = TypeOf<S>

Added in v1.0.0

TypeOf (type alias)

Extract the output of a schema

Signature

export type TypeOf<S> = S extends Schema<any, infer A> ? A : never

Added in v1.0.0

Utilities

memoize

Signature

export declare const memoize: <A, B>(f: (a: A) => B) => (a: A) => B

Added in v1.0.0