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 2bf7f7bb
authored
Jun 05, 2020
by
Sebastian Di Luzio
Committed by
GitHub
Jun 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(typings): add support for optional values in "where" clauses (#12337)
1 parent
65a9e1ea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
types/lib/model.d.ts
types/test/where.ts
types/lib/model.d.ts
View file @
2bf7f7b
...
...
@@ -339,8 +339,10 @@ export type WhereValue =
|
OrOperator
|
AndOperator
|
WhereGeometryOptions
|
(
string
|
number
|
Buffer
|
WhereAttributeHash
)[];
// implicit [Op.or]
|
(
string
|
number
|
Buffer
|
WhereAttributeHash
)[]
// implicit [Op.or]
// allow optional values in where object types
// Sequelize will still throw when a value in the object has the value undefined
|
undefined
;
/**
* A hash of attributes to describe your search.
*/
...
...
types/test/where.ts
View file @
2bf7f7b
...
...
@@ -25,6 +25,15 @@ where = {
date
:
new
Date
()
};
// Optional values
let
whereWithOptionals
:
{
needed
:
number
;
optional
?:
number
}
=
{
needed
:
2
};
where
=
whereWithOptionals
;
// Misusing optional values (typings allow this, sequelize will throw an error during runtime)
// This might be solved by updates to typescript itself (https://github.com/microsoft/TypeScript/issues/13195)
whereWithOptionals
=
{
needed
:
2
,
optional
:
undefined
};
where
=
whereWithOptionals
;
// Operators
const
and
:
AndOperator
=
{
...
...
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