-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Open
Labels
pending-approvalBug reports that have not been verified yet, or feature requests that have not been accepted yetBug reports that have not been verified yet, or feature requests that have not been accepted yet
Description
Hi! π Thank you for supporting this package.
I've noticed a difference between how null and undefined values are treated in where clauses in Sequelize, but have noticed that null values are not supported in cases where it is necessary to generate Postgres code like IS NULL or IS NOT NULL in SELECT statements.
Sequelize application code properly supports null in these cases, but the typings do not. I'm currently use this patch locally and would love to contribute it upstream:
diff --git a/node_modules/sequelize/types/model.d.ts b/node_modules/sequelize/types/model.d.ts
index 7ab36db..ca99807 100644
--- a/node_modules/sequelize/types/model.d.ts
+++ b/node_modules/sequelize/types/model.d.ts
@@ -200,7 +200,7 @@ export type ColumnReference = Col | { [Op.col]: string };
* Internal type - prone to changes. Do not export.
* @private
*/
-type WhereSerializableValue = boolean | string | number | Buffer | Date;
+type WhereSerializableValue = boolean | string | number | Buffer | Date | null;
/**
* Internal type - prone to changes. Do not export.
@@ -598,8 +598,10 @@ export type WhereAttributeHash<TAttributes = any> = {
/**
* Types that can be compared to an attribute in a WHERE context.
+ * undefined is allowed so optional condition values omit the key at runtime.
*/
export type WhereAttributeHashValue<AttributeType> =
+ | undefined
| AllowNotOrAndRecursive<
// if the right-hand side is an array, it will be equal to Op.in
// otherwise it will be equal to Op.eqLet me know if this can be contributed upstream!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
pending-approvalBug reports that have not been verified yet, or feature requests that have not been accepted yetBug reports that have not been verified yet, or feature requests that have not been accepted yet