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

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 {}
/**
* 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
......
......@@ -58,12 +58,12 @@ export interface SyncOptions extends Logging {
*/
schema?: string;
/**
/**
* An optional parameter to specify the schema search_path (Postgres only)
*/
searchPath?: string;
/**
/**
* If hooks is true then beforeSync, afterSync, beforeBulkSync, afterBulkSync hooks will be called
*/
hooks?: boolean;
......
......@@ -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');
MyModel.init({}, {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!