A Relish schema for maps with keys of type K and values of type V
import { RMap, RString, RU32, createCodec, type Static } from '@grounds/schema';
const schema = RMap(RString(), RU32());
type StringToNumber = Static<typeof schema>;
const codec = createCodec(schema);
codec.encode(new Map([['count', 42]])).match(
(bytes) => console.log('Map encoded:', bytes),
(error) => console.error(error)
);
Creates a schema for homogeneous maps with key type K and value type V.
All keys and values must match their respective types. The wire format encodes key type (1 byte), value type (1 byte), then key-value pairs in sequence with a length prefix. Keys must be unique.