unacy / TupleSchema
Type Alias: TupleSchema
ts
type TupleSchema = readonly string[];Defined in: packages/core/src/types.ts:235
A schema describing a tuple as an array of primitive type name strings. Supports optional ('number?') and rest ('...number') modifiers.
Example
typescript
const RGBSchema = ['number', 'number', 'number'] as const satisfies TupleSchema;
const FlexSchema = ['string', 'number?', '...boolean'] as const satisfies TupleSchema;Remarks
When the registry detects a tuple-typed unit (via isTupleMetadata), the brand function collects spread arguments into an array. Pass each tuple member as a separate argument: registry.RGB(255, 128, 0) instead of registry.RGB([255, 128, 0]).
Pitfalls
NEVER declare a rest element ('...type') in a non-terminal position — validateTupleSchema accepts it syntactically, but InferFromTupleSchema only handles rest at the last position and returns never otherwise.