Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 43ba131e
authored
Oct 30, 2019
by
Martin Mena
Committed by
Sushant
Oct 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(types): add Includeable to IncludeOptions.include type (#11622)
1 parent
757a986c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
types/lib/model.d.ts
types/test/model.ts
types/lib/model.d.ts
View file @
43ba131
...
...
@@ -513,13 +513,13 @@ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
*/
export
interface
FindOptions
extends
QueryOptions
,
Filterable
,
Projectable
,
Paranoid
,
IndexHintable
{
/**
* A list of associations to eagerly load using a left join. Supported is either
* `{ include: [ Model1, Model2, ...]}`, `{ include: [{ model: Model1, as: 'Alias' }]}` or
* A list of associations to eagerly load using a left join
(a single association is also supported)
. Supported is either
* `{ include:
Model1 }`, `{ include:
[ Model1, Model2, ...]}`, `{ include: [{ model: Model1, as: 'Alias' }]}` or
* `{ include: [{ all: true }]}`.
* If your association are set up with an `as` (eg. `X.hasMany(Y, { as: 'Z }`, you need to specify Z in
* the as attribute when eager loading Y).
*/
include
?:
Includeable
[];
include
?:
Includeable
|
Includeable
[];
/**
* Specifies an ordering. If a string is provided, it will be escaped. Using an array, you can provide
...
...
@@ -588,7 +588,7 @@ export interface CountOptions extends Logging, Transactionable, Filterable, Proj
/**
* Include options. See `find` for details
*/
include
?:
Includeable
[];
include
?:
Includeable
|
Includeable
[];
/**
* Apply COUNT(DISTINCT(col))
...
...
@@ -637,11 +637,11 @@ export interface BuildOptions {
isNewRecord
?:
boolean
;
/**
*
an array of include options
- Used to build prefetched/included model instances. See `set`
*
An array of include options. A single option is also supported
- Used to build prefetched/included model instances. See `set`
*
* TODO: See set
*/
include
?:
Includeable
[];
include
?:
Includeable
|
Includeable
[];
}
export
interface
Silent
{
...
...
@@ -757,7 +757,7 @@ export interface BulkCreateOptions extends Logging, Transactionable {
/**
* Include options. See `find` for details
*/
include
?:
Includeable
[];
include
?:
Includeable
|
Includeable
[];
/**
* Return all columns or only the specified columns for the affected rows (only for postgres)
...
...
types/test/model.ts
View file @
43ba131
import
{
Association
,
HasOne
,
Model
,
Sequelize
,
DataTypes
}
from
'sequelize'
;
import
{
Association
,
DataTypes
,
HasOne
,
Model
,
Sequelize
}
from
'sequelize'
;
class
MyModel
extends
Model
{
public
num
!
:
number
;
...
...
@@ -27,6 +27,14 @@ MyModel.hasOne(OtherModel, { as: 'OtherModelAlias' });
MyModel
.
findOne
({
include
:
[
'OtherModelAlias'
]
});
MyModel
.
findOne
({
include
:
OtherModel
});
MyModel
.
count
({
include
:
OtherModel
});
MyModel
.
build
({
int
:
10
},
{
include
:
OtherModel
});
MyModel
.
bulkCreate
([{
int
:
10
}],
{
include
:
OtherModel
});
const
sequelize
=
new
Sequelize
(
'mysql://user:user@localhost:3306/mydb'
);
MyModel
.
init
({},
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment