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

Commit ff3c225e by Zachary J. Rollyson Committed by Simon Schick

fix(types): add string to Includeable (#11003)

This is allowable for Aliases, according to docs and lack of errors when attempting.
options.include: http://docs.sequelizejs.com/class/lib/model.js~Model.html#static-method-findAll
1 parent 695c87bf
...@@ -376,7 +376,7 @@ export interface IncludeThroughOptions extends Filterable, Projectable {} ...@@ -376,7 +376,7 @@ export interface IncludeThroughOptions extends Filterable, Projectable {}
/** /**
* Options for eager-loading associated models, also allowing for all associations to be loaded at once * Options for eager-loading associated models, also allowing for all associations to be loaded at once
*/ */
export type Includeable = typeof Model | Association | IncludeOptions | { all: true }; export type Includeable = typeof Model | Association | IncludeOptions | { all: true } | string;
/** /**
* Complex include options * Complex include options
......
...@@ -23,6 +23,10 @@ MyModel.findOne({ ...@@ -23,6 +23,10 @@ MyModel.findOne({
] ]
}); });
MyModel.hasOne(OtherModel, { as: 'OtherModelAlias' });
MyModel.findOne({ include: ['OtherModelAlias'] });
const sequelize = new Sequelize('mysql://user:user@localhost:3306/mydb'); const sequelize = new Sequelize('mysql://user:user@localhost:3306/mydb');
MyModel.init({}, { MyModel.init({}, {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!