Skip to content

registryComponent

registryComponent<TValue, TId, TValueKey>(name, options): ComponentDef<RegistryComponentValue<TValue, TValueKey>>

Defined in: src/component-store.ts:560

Build a ComponentDef for registry-backed references.

The generated serializer stores only an id field (default: { id }), and deserializer resolves that id through a supplied lookup function, returning a single-field object (default: { def }).

TValue

TId extends string | number

TValueKey extends string = "def"

string

RegistryComponentOptions<TValue, TId, TValueKey>

ComponentDef<RegistryComponentValue<TValue, TValueKey>>

interface Card { def: CardDef }
const CardDefComp = registryComponent<CardDef, string>('card', {
lookup: getCardDef,
selectId: def => def.id,
});