Skip to content

Documentation / @etherfold/processor-entities / FieldValue

Type Alias: FieldValue<T> ​

FieldValue<T> = T extends object ? V : T extends object ? SemanticValue<N> : T extends "text" ? string : T extends "integer" | "real" ? number : T extends "blob" ? Uint8Array : never

Defined in: packages/state-store/dist/declarations.d.ts:82

What a declared field holds, as a TypeScript type.

blob is a Uint8Array because that is what the backends hand back for one; integer and real are both number, which is the honest reading of a 64-bit SQLite INTEGER (and the reason a u256 is not an integer field: it does not fit, so it is a semantic type, ADR-0098).

An enum (ADR-0098) is the UNION of its declared values, which is true rather than hopeful because every backend refuses any other value at write time. Under an annotated declaration its values are not literal, and it reads as string, which is still true.

A semantic type ({storage, type}, ADR-0098) is the value its type answers (SemanticValue): a u256 is a bigint. That is true rather than hopeful because every backend stores one canonically and the seam decodes it (decodeFieldValues), and a port carries a bigint by structured clone as itself, so createReadSurface and createPortReadSurface both answer one. The storage class does not show through: a u256 in a blob is never a Uint8Array to a reader (ADR-0025's "for free", cashed).

Type Parameters ​

T ​

T extends FieldDeclaration