tcmts.core.schema

Types

ParamsSchema type
Schema type
TableSchema type
A table's row type, as a schema, with a hash identifying it (rows record the hash they were written with).

Shared

GLOBAL_CLASSES Set<string>
checkArgs (schema: ParamsSchema, args: unknown[]) => string | undefined
Check a call's arguments against a function's parameters.
checkValue (s: Schema, v: unknown, at: string, defs: Schema[]) => string | undefined
Check a value against a schema; returns what's wrong, or undefined if it fits.
describe (v: unknown) => string
paramsSchema (checker: Checker, type: Type, typeOf?: ((p: Symbol) => Type | undefined) | undefined) => ParamsSch…
schemaBuilder (checker: Checker) => { of: (t: Type, depth: number) => Schema; defs: Schema[]; }
Turns TypeScript types into schemas; recursive types share `defs`.
schemaCheckerSource () => string
The value checker as standalone source text, for runtimes that can't import tcm (the generated #tcm/host module): built from these functions' own source, so it's the same code wherever tcm runs from.
schemaText (s: Schema, defs: Schema[], depth?: number) => string
A schema as a short TypeScript-like type, for display (`string`, `Date`, `{ x: number }[]`).
summary (s: Schema) => string
typeSchema (checker: Checker, type: Type) => { s: Schema; defs: Schema[]; }
The runtime schema of a type (e.g. a table's row type).