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
Hi thread, we're moving DefinitelyTyped to use GitHub Discussions for conversations the @types modules in DefinitelyTyped.
To help with the transition, we're closing all issues which haven't had activity in the last 6 months, which includes this issue. If you think closing this issue is a mistake, please pop into the TypeScript Community Discord and mention the issue in the definitely-typed channel.
@types/mongoose
v5.10.0 package and had problems.Given any type
T extends Document
,Pick<MongooseUpdateQuery<Document>, '$push'>
is equal to{ $push?: undefined; }
.I expect to be able to use
MongooseUpdateQuery
to push elements in a subdocument.Minimal example:
Playground Link
On the other hand, no errors are thrown applying the same process to a type T which does not extends the
Document
class:Playground Link
Is this the expected behavior?
Additional information
It seems there is a conflict at mongodb
PushOperator
type whenTSchema extends Document
.PushOperator<Document>
is equal tonever
.If we explore the mongodb
PushOperator
type:We can see two intersections of types. If we try:
The type
DocumentSimplifiedPushOperator
is equal tonever
, so we can asume there must be a conflict in that type intersection.Additional information 2
Looking at your types:
The following change would probably solve the issue:
But there's probably a good reason to not to do that change.
Additional information 3
It seems you have
UpdateQuery
which isIt feels a bit confusing, it's not easy to figure out when I should use
MongooseUpdateQuery
overUpdateQuery
.The text was updated successfully, but these errors were encountered: