Skip to main content

Function: attach()

attach<C, E, D, RD, I, K, Record, Related, Data>(instance, relation, value): (action) => Promise <Action<C & ConsumeModel <Model<D, I>> & ConsumeRelation<RD[K]> & ConsumeId, E>>

Type parameters

C extends object

E extends object

D extends object

RD extends ModelSchemaRelations<D>

I extends ModelInstance<D>

K extends string

Record

Related

Data

Parameters

instance: ModelClassInstance<D> & I

relation: ModelRelationKey<D> & K

value: ModelInferPropValue<RD[K]> | NonNullable <ModelInferPropValue<RD[K]>>[number]

Returns

Function

Parameters

action: Action<C & ConsumeSerializer<Record, Related, Data>, E>

Returns

Promise <Action<C & ConsumeModel <Model<D, I>> & ConsumeRelation<RD[K]> & ConsumeId, E>>

Source

packages/core/src/actions/context/enhancers/crud/attach.ts:43