constructor(elementTypes: TypeId[])
View sourceCreates tuple metadata from an ordered list of element type IDs.
The supplied array is stored directly rather than copied.
Class
ExtendsTypeInfo
Describes the ordered element types in tuple reflection metadata.
TupleInfo records one type ID for each tuple position; it does not contain
a tuple or validate tuple values. Its serialized form is an object with
kind: 'tuple' and an elementTypes array.
It does not provide a default() factory; construct it with the complete
ordered type list.
import { TupleInfo } from '@wimaengine/reflect'
import { typeid } from '@wimaengine/type'
const info = new TupleInfo([typeid(Number), typeid(String)])
info.getElement(0) // typeid(Number)
info.getElements() // [typeid(Number), typeid(String)]
info.serialize() // { kind: 'tuple', elementTypes: [...] }constructor(elementTypes: TypeId[])Creates tuple metadata from an ordered list of element type IDs.
The supplied array is stored directly rather than copied.
Type IDs in tuple-position order.
The array is the one supplied to the constructor, so it remains live and can be changed through the instance. Treat it as read-only when using the metadata as a type description.
getElement(index: number): TypeIdReturns the type ID recorded at a tuple position.
getElements(): readonly TypeId[]Returns the live array of tuple element type IDs.
The return type presents the array as read-only, but the returned value is the instance’s underlying array at runtime.
serialize(): TupleInfoSerialSerializes this metadata through the base contract.
Concrete metadata classes override this method with a subtype-specific
serial shape. Calling the inherited method directly delegates to the
abstract TypeInfo.serialize implementation and throws.
serialize(value: TupleInfo): TupleInfoSerialAbstract serialization hook for reflection metadata.
This base implementation never returns a serial value. Concrete subclasses should override it with their own serial shape.
deserialize(value: TupleInfoSerial, out?: TupleInfo): TupleInfoAbstract deserialization hook for reflection metadata.
Concrete subclasses use the serial value to create or update metadata. The base implementation does not inspect either argument and always throws.
validateSerial(value: unknown): value is TupleInfoSerialChecks whether a value has the serialized tuple metadata shape.
Validation accepts a non-null, non-array object with kind: 'tuple' and
an array whose present entries are string type IDs. Extra properties are
allowed; this method validates the serial shape and does not create a
TupleInfo.