I am using the mongoose-auto-increment plugin and I am using TypeScript Node.js and I have installed the needed typed definitions but when I try to get the next count of the auto increment, I get this
Property 'nextCount' does not exist on type 'Model<Document>'
My schema is the one from the example:
let bookSchema = new Schema({
author: { type: Number, ref: 'Author' },
title: String,
genre: String,
publishDate: Date
});
bookSchema.plugin(autoIncrement.plugin, 'Book');
var Book = connection.model('Book', bookSchema);
//// error here
Book.nextCount(function(err, count) {
});
My tsconfig.json is like so
{
"compilerOptions": {
"types" : ["node", "socket.io"],
"module": "commonjs",
"experimentalDecorators": true,
"target": "es2015",
"lib": ["es2015", "es2017", "dom"]
},
"include": [
"**/*.ts"
],
"exclude": [
"node_modules"
]
}