The extended mongoose Document will be dropped in the next major version.
We strongly recommend against using this approach, its support will be dropped in the next major version as it causes major performance issues. Many Mongoose TypeScript codebases use the below approach. - https://mongoosejs.com/docs/typescript.html#using-extends-document
It will correctly infer the model or collection TypeScript types when mongoose.
The extended mongoose Document will be dropped in the next major version.
It will correctly infer the model or collection TypeScript types when mongoose.
Interface
Before
After