dsanel / mongoose-delete

Mongoose Soft Delete Plugin
MIT License
346 stars 101 forks source link

Type Script - WithDeleted methods are not available #142

Closed durveshparmar closed 1 year ago

durveshparmar commented 1 year ago

Hi,

Whenever I try to use any "withDeleted" method to retrieve the records or update the records, it just doesn't find the function or method.

Property 'findDeleted' does not exist on type 'Model<Document, {}, {}, {}, any>'

Please add the typescript support for this. I just love this package. I know there are others in the market but I find this one as the best.

Please provide the support. Thanks in Advance.

Looking forward for the solution.

durveshparmar commented 1 year ago

Hi,

I fixed this issue. I was doing as following before:

const model: SoftDeleteModel = model<Pet>('Pet', PetSchema);

Fixed this issue by doing as per following: const model = model<Pet, SoftDeleteModel<Pet>>('Pet', PetSchema);

Thanks.

suman379 commented 1 year ago

@durveshparmar , It worked.