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 a39c63a4
authored
Aug 09, 2019
by
Andrew Schmadel
Committed by
Sushant
Aug 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(types): return a usable type when using the sequelize.models lookup (#11293)
1 parent
98a40891
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
types/lib/sequelize.d.ts
types/test/sequelize.ts
types/lib/sequelize.d.ts
View file @
a39c63a
...
@@ -19,6 +19,7 @@ import {
...
@@ -19,6 +19,7 @@ import {
UpdateOptions
,
UpdateOptions
,
WhereAttributeHash
,
WhereAttributeHash
,
WhereOperators
,
WhereOperators
,
ModelCtor
,
}
from
'./model'
;
}
from
'./model'
;
import
{
ModelManager
}
from
'./model-manager'
;
import
{
ModelManager
}
from
'./model-manager'
;
import
*
as
Op
from
'./operators'
;
import
*
as
Op
from
'./operators'
;
...
@@ -767,7 +768,7 @@ export class Sequelize extends Hooks {
...
@@ -767,7 +768,7 @@ export class Sequelize extends Hooks {
* Dictionary of all models linked with this instance.
* Dictionary of all models linked with this instance.
*/
*/
public
readonly
models
:
{
public
readonly
models
:
{
[
key
:
string
]:
typeof
Model
;
[
key
:
string
]:
ModelCtor
<
Model
>
;
};
};
/**
/**
...
@@ -1109,7 +1110,7 @@ export class Sequelize extends Hooks {
...
@@ -1109,7 +1110,7 @@ export class Sequelize extends Hooks {
*
*
* @param modelName The name of a model defined with Sequelize.define
* @param modelName The name of a model defined with Sequelize.define
*/
*/
public
model
(
modelName
:
string
):
typeof
Model
;
public
model
(
modelName
:
string
):
ModelCtor
<
Model
>
;
/**
/**
* Checks whether a model with the given name is defined
* Checks whether a model with the given name is defined
...
...
types/test/sequelize.ts
View file @
a39c63a
...
@@ -49,4 +49,8 @@ Sequelize.afterConnect(() => {
...
@@ -49,4 +49,8 @@ Sequelize.afterConnect(() => {
const
rnd
:
Fn
=
sequelize
.
random
();
const
rnd
:
Fn
=
sequelize
.
random
();
const
myModel
:
typeof
Model
=
sequelize
.
models
.
asd
;
class
Model1
extends
Model
{}
class
Model2
extends
Model
{}
const
myModel
:
typeof
Model1
=
sequelize
.
models
.
asd
;
myModel
.
hasOne
(
Model2
)
myModel
.
findAll
();
\ No newline at end of file
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