/** * These interfaces are consistent across all backings. * As long as these interfaces are respected, the backing can be abstracted entirely. */ export interface ArrayLike { [n: number]: T; readonly length: number; [Symbol.iterator](): Iterator; } export type Vector = ArrayLike; export interface List extends ArrayLike { push(...values: T[]): number; pop(): T | undefined; } export type Container> = T; export type ByteVector = Vector; export type ByteList = List; export type BitVector = Vector; export type BitList = List; export interface ObjectLike { [fieldName: string]: unknown; } export interface Union { readonly selector: number; value: T; } export type CompositeValue = Record | ArrayLike | Union | Record; /** * The Json interface is used for json-serializable input */ export type Json = string | number | boolean | null | { [property: string]: Json; } | Json[];