Skip to content

unacy / RecordSchema

Type Alias: RecordSchema

ts
type RecordSchema = {
[key: string]: RecordSchemaValue;
};

Defined in: packages/core/src/types.ts:210

A schema describing an object shape. Keys are property names; values are primitive type name strings ('number', 'string', etc.) or nested RecordSchema objects.

Index Signature

ts
[key: string]: RecordSchemaValue

Example

typescript
const PointSchema = { x: 'number', y: 'number' } satisfies RecordSchema;
const NestedSchema = { pos: { x: 'number', y: 'number' }, label: 'string' } satisfies RecordSchema;

Pitfalls

NEVER use a circular schema object — validateRecordSchema detects circular references and throws, so the registry will refuse to register such a unit.

NEVER use non-primitive type names as leaf values (e.g., 'Date') — only 'number', 'string', 'boolean', and 'bigint' are accepted.

Released under the MIT License.