Skip to content

ProjectedEntity<S> = { readonly [K in keyof S as S[K] extends true ? K : never]: K extends keyof Entity ? NonNullable<Entity[K]> : never } & S extends object ? Pick<Entity, "toText" | "toJson"> : unknown

Defined in: src/query/selection.ts:50

The result of a selection S: an Entity narrowed to exactly the selected fields (each non-undefined). The shape is flat and backwards compatible — e.g. select({ owner: true }) yields { owner: Hex } accessed as entity.owner. Accessing an unselected field is a compile error.

The toText() / toJson() helpers operate on the payload, so they are only present when payload was selected — calling them otherwise would always throw.

S