constructor(keyType: TypeId, valueType: TypeId)
View sourceCreates map metadata for one key type and one value type.
The supplied type IDs are stored directly without copying or normalization.
Class
ExtendsTypeInfo
Describes the key and value types in map reflection metadata.
MapInfo records type metadata for map entries; it does not contain a map
or validate map values. Its serialized form is an object with kind: 'map',
keyType, and valueType properties.
It does not provide a default() factory; construct it with both type IDs.
import { MapInfo } from '@wimaengine/reflect'
import { typeid } from '@wimaengine/type'
const info = new MapInfo(typeid(String), typeid(Number))
info.getKeyType() // typeid(String)
info.getValueType() // typeid(Number)
info.serialize() // { kind: 'map', keyType: ..., valueType: ... }constructor(keyType: TypeId, valueType: TypeId)Creates map metadata for one key type and one value type.
The supplied type IDs are stored directly without copying or normalization.
Type ID expected for each map key.
Type ID expected for each map value.
getKeyType(): TypeIdReturns the type ID recorded for map keys.
getValueType(): TypeIdReturns the type ID recorded for map values.
serialize(): MapInfoSerialSerializes 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: MapInfo): MapInfoSerialAbstract 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: MapInfoSerial, out?: MapInfo): MapInfoAbstract 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 MapInfoSerialChecks whether a value has the serialized map metadata shape.
Validation accepts a non-null, non-array object with kind: 'map' and
string keyType and valueType properties. Extra properties are allowed;
this method validates the serial shape and does not create a MapInfo.