Creates a schema for homogeneous arrays with elements of type T.
All array elements must be the same type. The wire format encodes element type (1 byte), then all elements in sequence with a length prefix.
Schema defining the type of all array elements
A Relish schema for arrays of type T
import { RArray, RU32, createCodec, type Static } from '@grounds/schema';const schema = RArray(RU32());type Numbers = Static<typeof schema>;const codec = createCodec(schema);codec.encode([1, 2, 3]).match( (bytes) => console.log('Array encoded:', bytes), (error) => console.error(error)); Copy
import { RArray, RU32, createCodec, type Static } from '@grounds/schema';const schema = RArray(RU32());type Numbers = Static<typeof schema>;const codec = createCodec(schema);codec.encode([1, 2, 3]).match( (bytes) => console.log('Array encoded:', bytes), (error) => console.error(error));
Creates a schema for homogeneous arrays with elements of type T.
All array elements must be the same type. The wire format encodes element type (1 byte), then all elements in sequence with a length prefix.