Mongoose $push typescript errors Mongoose $push typescript errors mongoose mongoose

Mongoose $push typescript errors


Adding //@ts-ignore to the line above seems to calm down the typescript checker and the query still works.


I'm not sure if this is the same issue as yours, but I was facing the same issue today, The error was in my definition of the field. I had following in my mongoose document.

attachments?: AttachmentDocument["_id"]

where it should be:

attachments?: AttachmentDocument["_id"][]

As it is an array of documents the above change fixed my issue.

Adding it as answer to help out someone, not sure if it is actual answer to the question.