You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the above removeRelation example the $remove does not work because it is a HasOne relation which makes sense and is similar to other ORMs, but I would expect to be able to call TestEntity.$set('oneTestRelation', null) in order to remove the relationship.
Expected behavior:
null should be an included in the union (Currently instances: R | R[] | string[] | string | number[] | number) type for the static $set method.
Versions
I'm submitting a ...
Actual behavior:
Setting a
one-to-one
relationship to null is not currently supported using$set
or$remove
.I have the following models
The following code is from a framework called
nestjs-query
so it is pretty generic, but the following does not workIn the above
removeRelation
example the$remove
does not work because it is aHasOne
relation which makes sense and is similar to other ORMs, but I would expect to be able to callTestEntity.$set('oneTestRelation', null)
in order to remove the relationship.Expected behavior:
null
should be an included in theunion
(Currentlyinstances: R | R[] | string[] | string | number[] | number
) type for the static$set
method.You can see the definition here https://github.com/RobinBuschmann/sequelize-typescript/blob/master/src/model/model/model.ts#L54
Of course I can currently get around this limitation by doing the following, but updating the union type would be preferable.
Steps to reproduce:
You can use the above model definitions to reproduce or you can also view the framework to get a better idea of whats going on.
It could be the case that I am doing this incorrectly, if so please let me know!
Related code:
The text was updated successfully, but these errors were encountered: