Closed
Description
On the $add
method interface its return value is Promise<this>
but this isn't the case for m:n eg:
[ [ SourceContentItem {
dataValues: { id: null, contentItemId: 1045, sourceId: 4 },
_previousDataValues: { contentItemId: undefined, sourceId: undefined },
_changed: { contentItemId: true, sourceId: true },
_modelOptions: [Object],
_options: { isNewRecord: true, _schema: null, _schemaDelimiter: '', includeNames: [] },
hasPrimaryKeys: true,
__eagerlyLoadedAssociations: [],
isNewRecord: false } ] ]
If the source was already set, it returns [].
Monkey patch is to set that interface to return Promise<any>
but better solution would just be to create an interface for it.
(L419 Model.d.ts) Eg: $add<R extends Model<R>>(propertyKey: string, instances: R|R[], options?: IAssociationActionOptions): Promise<any>;
Cred to @connected-jlovelock for finding this.
Metadata
Metadata
Assignees
Labels
No labels