不要怂,就是干,撸起袖子干!

Commit 1f42c79d by Oliver Emery Committed by Pedro Augusto de Paula Barbosa

fix(types): fix BelongsToManyGetAssociationsMixinOptions (#11818)

1 parent 365d7c35
......@@ -2,6 +2,7 @@ import {
BulkCreateOptions,
CreateOptions,
Filterable,
FindAttributeOptions,
FindOptions,
InstanceDestroyOptions,
InstanceUpdateOptions,
......@@ -100,6 +101,10 @@ export class BelongsToMany<S extends Model = Model, T extends Model = Model> ext
*/
export interface BelongsToManyGetAssociationsMixinOptions extends FindOptions {
/**
* A list of the attributes from the join table that you want to select.
*/
joinTableAttributes?: FindAttributeOptions
/**
* Apply a scope on the related model, or remove its default scope by passing false.
*/
scope?: string | boolean;
......
import { Association, DataTypes, HasOne, Model, Sequelize } from 'sequelize';
import { Association, BelongsToManyGetAssociationsMixin, DataTypes, HasOne, Model, Sequelize } from 'sequelize';
class MyModel extends Model {
public num!: number;
......@@ -103,3 +103,15 @@ UserModel.findCreateFind({
*/
class TestModel extends Model {};
TestModel.primaryKeyAttributes;
/**
* Test for joinTableAttributes on BelongsToManyGetAssociationsMixin
*/
class SomeModel extends Model {
public getOthers!: BelongsToManyGetAssociationsMixin<OtherModel>
}
const someInstance = new SomeModel()
someInstance.getOthers({
joinTableAttributes: { include: [ 'id' ] }
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!