Skip to content

$add method interface #173

Closed
Closed
@connected-pjeri

Description

@connected-pjeri

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions