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 032d9968
authored
Apr 20, 2019
by
Chocobozzz
Committed by
Sushant
Apr 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(types): scope typing (#10803)
1 parent
39269912
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
types/lib/model.d.ts
types/test/models/User.ts
types/lib/model.d.ts
View file @
032d996
...
...
@@ -239,36 +239,36 @@ export interface WhereOperators {
/**
* MySQL/PG only
*
*
* Matches regular expression, case sensitive
*
*
* Example: `[Op.regexp]: '^[h|a|t]'` becomes `REGEXP/~ '^[h|a|t]'`
*/
[
Op
.
regexp
]?:
string
;
/**
* MySQL/PG only
*
*
* Does not match regular expression, case sensitive
*
*
* Example: `[Op.notRegexp]: '^[h|a|t]'` becomes `NOT REGEXP/!~ '^[h|a|t]'`
*/
[
Op
.
notRegexp
]?:
string
;
/**
* PG only
*
*
* Matches regular expression, case insensitive
*
*
* Example: `[Op.iRegexp]: '^[h|a|t]'` becomes `~* '^[h|a|t]'`
*/
[
Op
.
iRegexp
]?:
string
;
/**
* PG only
*
*
* Does not match regular expression, case insensitive
*
*
* Example: `[Op.notIRegexp]: '^[h|a|t]'` becomes `!~* '^[h|a|t]'`
*/
[
Op
.
notIRegexp
]?:
string
;
...
...
@@ -1655,7 +1655,7 @@ export abstract class Model<T = any, T2 = any> extends Hooks {
*/
public
static
scope
<
M
extends
{
new
():
Model
}
>
(
this
:
M
,
options
?:
string
|
string
[]
|
ScopeOptions
|
WhereAttributeHash
options
?:
string
|
ScopeOptions
|
(
string
|
ScopeOptions
)[]
|
WhereAttributeHash
):
M
;
public
static
addScope
(
name
:
string
,
scope
:
FindOptions
,
options
?:
AddScopeOptions
):
void
;
...
...
types/test/models/User.ts
View file @
032d996
...
...
@@ -55,6 +55,9 @@ User.init(
firstName
:
a
,
},
};
},
custom2
()
{
return
{}
}
},
sequelize
,
...
...
@@ -79,3 +82,8 @@ export const Group = User.belongsTo(UserGroup, { as: 'group', foreignKey: 'group
// associations refer to their Model
const
userType
:
ModelCtor
<
User
>
=
User
.
associations
.
group
.
source
;
const
groupType
:
ModelCtor
<
UserGroup
>
=
User
.
associations
.
group
.
target
;
User
.
scope
([
'custom2'
,
{
method
:
[
'custom'
,
32
]
}
])
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