Skip to content

Codec

Defined in: state/codecs.ts:11

A codec converts a value between its in-memory representation T and a JSON-safe encoded form TEncoded that adapters can stringify. encode always returns the encoded form; decode takes unknown because the input is whatever an adapter produced from storage (which may be corrupt or legacy) and must be validated/coerced.

TEncoded defaults to T so identity codecs (most callers) need only one type parameter.

T

TEncoded = T

decode(raw): T

Defined in: state/codecs.ts:13

unknown

T


encode(value): TEncoded

Defined in: state/codecs.ts:12

T

TEncoded