API reference / @node-ts/bus-messages / MessageFieldType
Type Alias: MessageFieldType
ts
type MessageFieldType =
| "Date"
| "BigInt"
| {
type: string;
}
| {
array: MessageFieldType;
}
| {
set: MessageFieldType | "plain";
}
| {
keys?: "number";
map: MessageFieldType | "plain";
}
| {
record: MessageFieldType;
};Defined in: packages/bus-messages/src/message-types.ts:14
How a field is restored after its message has been parsed from JSON. Fields that JSON already represents (strings, numbers, booleans, null, plain objects and arrays of them) aren't listed.
'Date': an ISO string or epoch number becomes aDate'BigInt': a string or number becomes abigint{ type }: an object is restored using the entry with that key inMessageTypes.types{ array }: each item of an array is restored as the given type{ set }: an array becomes aSet, with each item restored as the given type, or kept as-is for'plain'{ map }: an object becomes aMapof its entries, with each value restored as the given type, or kept as-is for'plain'. Keys stay strings unlesskeysis'number'{ record }: each value of an object used as a dictionary is restored as the given type