Skip to content
1 min read · 193 words

Interface: EncoderModule

Defined in: src/batteries/isolation/codec.ts:44

The slice of @nhtio/encoder's API surface this codec uses. Deliberately non-generic (unknown in, unknown out) — this codec always encodes/decodes values whose shape it cannot statically know, so the real encoder's <T extends Encodable>-constrained signature is narrowed away via defaultEncoderLoader's adapter rather than reflected here.

Properties

PropertyTypeDescriptionDefined in
decode(encoded: string) => unknownDecode a @nhtio/encoder wire string back into the original value.src/batteries/isolation/codec.ts:48
encode(value: unknown) => stringEncode an arbitrary value to its @nhtio/encoder wire string.src/batteries/isolation/codec.ts:46
isCustomEncodable(value: unknown) => booleanWhether value is an instance of a class previously passed to registerClass.src/batteries/isolation/codec.ts:52
isError(value: unknown) => booleanWhether value is an Error (or subclass), per the encoder's own classification.src/batteries/isolation/codec.ts:54
registerClass(ctor: { name: string; }) => voidRegister a class as custom-encodable so encode/decode round-trip its instances.src/batteries/isolation/codec.ts:50