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 8f2a0d52
authored
Jun 25, 2021
by
JacobLey
Committed by
GitHub
Jun 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(typings): model init returns model class, not instance (#13214)
1 parent
deeb5c6d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
types/lib/model.d.ts
types/test/model.ts
types/lib/model.d.ts
View file @
8f2a0d5
...
@@ -1622,10 +1622,10 @@ export abstract class Model<TModelAttributes extends {} = any, TCreationAttribut
...
@@ -1622,10 +1622,10 @@ export abstract class Model<TModelAttributes extends {} = any, TCreationAttribut
* @param options These options are merged with the default define options provided to the Sequelize constructor
* @param options These options are merged with the default define options provided to the Sequelize constructor
* @return Return the initialized model
* @return Return the initialized model
*/
*/
public
static
init
<
M
extends
Model
>
(
public
static
init
<
M
S
extends
ModelStatic
<
Model
>
,
M
extends
InstanceType
<
MS
>
>
(
this
:
M
odelStatic
<
M
>
,
this
:
M
S
,
attributes
:
ModelAttributes
<
M
,
M
[
'_attributes'
]
>
,
options
:
InitOptions
<
M
>
attributes
:
ModelAttributes
<
M
,
M
[
'_attributes'
]
>
,
options
:
InitOptions
<
M
>
):
M
odel
;
):
M
S
;
/**
/**
* Remove attribute from model definition
* Remove attribute from model definition
...
...
types/test/model.ts
View file @
8f2a0d5
...
@@ -52,7 +52,7 @@ MyModel.update({}, { where: { foo: 'bar' }, paranoid: false});
...
@@ -52,7 +52,7 @@ MyModel.update({}, { where: { foo: 'bar' }, paranoid: false});
const
sequelize
=
new
Sequelize
(
'mysql://user:user@localhost:3306/mydb'
);
const
sequelize
=
new
Sequelize
(
'mysql://user:user@localhost:3306/mydb'
);
MyModel
.
init
({
const
model
:
typeof
MyModel
=
MyModel
.
init
({
virtual
:
{
virtual
:
{
type
:
new
DataTypes
.
VIRTUAL
(
DataTypes
.
BOOLEAN
,
[
'num'
]),
type
:
new
DataTypes
.
VIRTUAL
(
DataTypes
.
BOOLEAN
,
[
'num'
]),
get
()
{
get
()
{
...
...
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