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.
Type Parameters
Section titled “Type Parameters”T
TEncoded
Section titled “TEncoded”TEncoded = T
Methods
Section titled “Methods”decode()
Section titled “decode()”decode(
raw):T
Defined in: state/codecs.ts:13
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”T
encode()
Section titled “encode()”encode(
value):TEncoded
Defined in: state/codecs.ts:12
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”TEncoded