// Update existing entity
const updated = evolve(current, { balance: current.balance + event.amount })
// Create new entity with defaults
const created = evolve(undefined, { id: event.entityId, name: event.name }, { status: 'active' })
// Create new entity without defaults (changes must be complete)
const created = evolve(undefined, { id: event.entityId, name: event.name, status: 'active' })
Applies partial changes to an entity, optionally using defaults when creating a new instance.
Designed for plain objects (entity state); use createInstance for class instances.
// Update existing entity
const updated = evolve(current, { balance: current.balance + event.amount })
// Create new entity with defaults
const created = evolve(undefined, { id: event.entityId, name: event.name }, { status: 'active' })
// Create new entity without defaults (changes must be complete)
const created = evolve(undefined, { id: event.entityId, name: event.name, status: 'active' })
Applies partial changes to an entity, optionally using defaults when creating a new instance.
Designed for plain objects (entity state); use createInstance for class instances.
// Update existing entity
const updated = evolve(current, { balance: current.balance + event.amount })
// Create new entity with defaults
const created = evolve(undefined, { id: event.entityId, name: event.name }, { status: 'active' })
// Create new entity without defaults (changes must be complete)
const created = evolve(undefined, { id: event.entityId, name: event.name, status: 'active' })
Applies partial changes to an entity, optionally using defaults when creating a new instance. Designed for plain objects (entity state); use
createInstancefor class instances.