Closed
Description
Prerequisites
- I have written a descriptive issue title
Mongoose version
=7.3.3
Node.js version
18.x
MongoDB version
6.x
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
No response
Issue
It seems that the return type of the insertMany
function changed with version 7.3.3.
The following code runs without any error on v7.3.2 and lower
import * as mongoose from "mongoose";
export class RepositoryBase<T> {
protected model: mongoose.Model<T & mongoose.Document>;
constructor(schemaModel: mongoose.Model<T & mongoose.Document>) {
this.model = schemaModel;
}
async insertMany(elems: T[]): Promise<T[]> {
elems = await this.model.insertMany(elems);
return elems;
}
}
while on versions >=7.3.3 the assignment inside the function generates this error:
The typescript version is 5.2.2.