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

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 { ...@@ -2,6 +2,7 @@ import {
BulkCreateOptions, BulkCreateOptions,
CreateOptions, CreateOptions,
Filterable, Filterable,
FindAttributeOptions,
FindOptions, FindOptions,
InstanceDestroyOptions, InstanceDestroyOptions,
InstanceUpdateOptions, InstanceUpdateOptions,
...@@ -100,6 +101,10 @@ export class BelongsToMany<S extends Model = Model, T extends Model = Model> ext ...@@ -100,6 +101,10 @@ export class BelongsToMany<S extends Model = Model, T extends Model = Model> ext
*/ */
export interface BelongsToManyGetAssociationsMixinOptions extends FindOptions { 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. * Apply a scope on the related model, or remove its default scope by passing false.
*/ */
scope?: string | boolean; scope?: string | boolean;
......
import { Association, DataTypes, HasOne, Model, Sequelize } from 'sequelize'; import { Association, BelongsToManyGetAssociationsMixin, DataTypes, HasOne, Model, Sequelize } from 'sequelize';
class MyModel extends Model { class MyModel extends Model {
public num!: number; public num!: number;
...@@ -103,3 +103,15 @@ UserModel.findCreateFind({ ...@@ -103,3 +103,15 @@ UserModel.findCreateFind({
*/ */
class TestModel extends Model {}; class TestModel extends Model {};
TestModel.primaryKeyAttributes; 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!