Repository: nestjs/nest

Issue #5845: @nestjs/mongoose crashes 
Created: 2020-12-01T22:09:20Z
Issue
My app won't start as soon as I install the mongoose module
My package.json below
{
  "name": "api",
  "version": "0.0.1",
  "description": "",
  "author": "",
  "private": true,
  "license": "UNLICENSED",
  "scripts": {
    "prebuild": "rimraf dist",
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "nest start",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json"
  },
  "dependencies": {
    "@nestjs/common": "^7.5.1",
    "@nestjs/core": "^7.5.1",
    "@nestjs/mongoose": "^7.0.2",
    "@nestjs/platform-express": "^7.5.1",
    "mongoose": "^5.11.1",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^6.6.3"
  },
  "devDependencies": {
    "@nestjs/cli": "^7.5.1",
    "@nestjs/schematics": "^7.1.3",
    "@nestjs/testing": "^7.5.1",
    "@types/express": "^4.17.8",
    "@types/jest": "^26.0.15",
    "@types/mongoose": "^5.10.1",
    "@types/node": "^14.14.6",
    "@types/supertest": "^2.0.10",
    "@typescript-eslint/eslint-plugin": "^4.6.1",
    "@typescript-eslint/parser": "^4.6.1",
    "eslint": "^7.12.1",
    "eslint-config-prettier": "^6.15.0",
    "eslint-plugin-prettier": "^3.1.4",
    "jest": "^26.6.3",
    "prettier": "^2.1.2",
    "supertest": "^6.0.0",
    "ts-jest": "^26.4.3",
    "ts-loader": "^8.0.8",
    "ts-node": "^9.0.0",
    "tsconfig-paths": "^3.9.0",
    "typescript": "^4.0.5"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".*\\.spec\\.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "ts-jest"
    },
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  }
}


the error log
node_modules/@nestjs/mongoose/dist/factories/schema.factory.d.ts:4:60 - error TS2315: Type 'Schema' is not generic.
4     static createForClass<T = any>(target: Type): mongoose.Schema;
~~~~~~~~~~~~~~~~~~
node_modules/@types/mongoose/index.d.ts:79:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: DocumentDefinition, FilterQuery, UpdateQuery, NativeError, Mongoose, CastError, Collection, Connection, Error, QueryCursor, VirtualType, Schema, Subdocument, Array, DocumentArray, Buffer, ObjectIdConstructor, Decimal128, Map, Aggregate, SchemaType, Document
79 declare module "mongoose" {

node_modules/mongoose/index.d.ts:1:1
 1 declare module "mongoose" {
   ~~~~~~~
 Conflicts are in this file.

node_modules/@types/mongoose/index.d.ts:226:14 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'SchemaTypes' must be of type 'typeof Types', but here has type 'typeof Types'.

226   export var SchemaTypes: typeof Schema.Types;
              ~~~~~~~~~~~

node_modules/mongoose/index.d.ts:45:14
 45   export var SchemaTypes: typeof Schema.Types;
                 ~~~~~~~~~~~
 'SchemaTypes' was also declared here.

node_modules/@types/mongoose/index.d.ts:822:24 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

822     constructor(query: Query<T>, options: any);
                        ~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1013:19 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1013     pre<T extends Query<any> = Query<any>>(
                    ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1013:32 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1013     pre<T extends Query<any> = Query<any>>(
                                 ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1036:48 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1036     pre<T extends Document | Model<Document> | Query<any> | Aggregate<any>>(
                                                 ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1048:19 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1048     pre<T extends Query<any> = Query<any>>(
                    ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1048:32 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1048     pre<T extends Query<any> = Query<any>>(
                                 ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1074:48 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1074     pre<T extends Document | Model<Document> | Query<any> | Aggregate<any>>(
                                                 ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1183:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'collation' must be of type 'CollationDocument', but here has type 'CollationOptions'.

1183     collation?: CollationOptions;
      ~~~~~~~~~

node_modules/mongoose/index.d.ts:990:5
 990     collation?: mongodb.CollationDocument;
         ~~~~~~~~~
 'collation' was also declared here.

node_modules/@types/mongoose/index.d.ts:1205:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'strictQuery' must be of type 'boolean | "throw"', but here has type 'boolean'.

1205     strictQuery?: boolean;
      ~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1046:5
 1046     strictQuery?: boolean | "throw";
          ~~~~~~~~~~~
 'strictQuery' was also declared here.

node_modules/@types/mongoose/index.d.ts:1209:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'toJSON' must be of type 'ToObjectOptions', but here has type 'DocumentToObjectOptions'.

1209     toJSON?: DocumentToObjectOptions;
      ~~~~~~

node_modules/mongoose/index.d.ts:1053:5
 1053     toJSON?: ToObjectOptions;
          ~~~~~~
 'toJSON' was also declared here.

node_modules/@types/mongoose/index.d.ts:1211:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'toObject' must be of type 'ToObjectOptions', but here has type 'DocumentToObjectOptions'.

1211     toObject?: DocumentToObjectOptions;
      ~~~~~~~~

node_modules/mongoose/index.d.ts:1060:5
 1060     toObject?: ToObjectOptions;
          ~~~~~~~~
 'toObject' was also declared here.

node_modules/@types/mongoose/index.d.ts:1264:5 - error TS2374: Duplicate string index signature.

1264     [path: string]: SchemaTypeOpts<any> | Schema | SchemaType;
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1627:76 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1627     replaceOne(replacement: any, callback?: (err: any, raw: any) => void): Query<any>;
                                                                             ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1630:64 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1630     update(doc: any, callback?: (err: any, raw: any) => void): Query<any>;
                                                                 ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1632:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1632       callback?: (err: any, raw: any) => void): Query<any>;
                                                  ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1635:67 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1635     updateOne(doc: any, callback?: (err: any, raw: any) => void): Query<any>;
                                                                    ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1637:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1637       callback?: (err: any, raw: any) => void): Query<any>;
                                                  ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1920:36 - error TS2344: Type 'MongooseDocument' does not satisfy the constraint 'Document'.
Type 'MongooseDocument' is missing the following properties from type 'Document': $ignore, $isDeleted, $isEmpty, $isValid, and 16 more.

1920       parentArray(): DocumentArray<MongooseDocument>;
                                     ~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1962:9 - error TS2415: Class 'Query<ResultType, DocType, T>' incorrectly extends base class 'DocumentQuery<T, any, {}>'.

1962   class Query<T> extends DocumentQuery<T, any> { }
          ~~~~~

node_modules/@types/mongoose/index.d.ts:1962:9 - error TS2428: All declarations of 'Query' must have identical type parameters.

1962   class Query<T> extends DocumentQuery<T, any> { }
          ~~~~~

node_modules/@types/mongoose/index.d.ts:2047:58 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2047     count(callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                           ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2048:90 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2048     count(criteria: FilterQuery<DocType>, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                                           ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2069:67 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2069     countDocuments(callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                    ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2070:99 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2070     countDocuments(criteria: FilterQuery<DocType>, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                                                    ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2082:75 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2082     estimatedDocumentCount(callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                            ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2083:89 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2083     estimatedDocumentCount(options: any, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                                          ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2092:58 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2092     distinct(callback?: (err: any, res: any[]) => void): Query<any[]> & QueryHelpers;
                                                           ~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2093:73 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2093     distinct(field: string, callback?: (err: any, res: any[]) => void): Query<any[]> & QueryHelpers;
                                                                          ~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2094:45 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2094     distinct(field: string, criteria: any | Query<any>,
                                              ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2095:51 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2095       callback?: (err: any, res: any[]) => void): Query<any[]> & QueryHelpers;
                                                    ~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2098:32 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2098     elemMatch(criteria: (elem: Query<any>) => void): this;
                                 ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2100:63 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2100     elemMatch(path: string | any | Function, criteria: (elem: Query<any>) => void): this;
                                                                ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2136:54 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2136       callback?: (err: any, res: T | null) => void): Query<DocumentDefinition<DocType>> & QueryHelpers;
                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2153:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2153         : Query<mongodb.FindAndModifyWriteOpResultObject<DocType | null>> & QueryHelpers;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2173:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2173         : Query<mongodb.FindAndModifyWriteOpResultObject<DocType>> & QueryHelpers;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2179:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2179         : Query<mongodb.FindAndModifyWriteOpResultObject<DocType | null>> & QueryHelpers;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2183:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2183         : Query<DocumentDefinition<DocType>> & QueryHelpers;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2256:69 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2256     lean<P = DocumentDefinition<DocType>>(bool?: boolean | object): Query<T extends Array<any> ? P[] : (P | null)> & QueryHelpers;
                                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2300:25 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2300     merge(source: any | Query<any>): this;
                          ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2413:44 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2413     remove(callback?: (err: any) => void): Query<mongodb.WriteOpResult['result']> & QueryHelpers;
                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2414:45 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2414     remove(criteria: FilterQuery<DocType> | Query<any>, callback?: (err: any) => void): Query<mongodb.WriteOpResult['result']> & QueryHelpers;
                                              ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2414:89 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2414     remove(criteria: FilterQuery<DocType> | Query<any>, callback?: (err: any) => void): Query<mongodb.WriteOpResult['result']> & QueryHelpers;
                                                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2491:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2491     toConstructor<T>(): new (...args: any[]) => Query<T> & QueryHelpers;
                                                  ~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2499:66 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2499     update(callback?: (err: any, affectedRows: number) => void): Query<number> & QueryHelpers;
                                                                   ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2500:93 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2500     update(doc: UpdateQuery<DocType>, callback?: (err: any, affectedRows: number) => void): Query<number> & QueryHelpers;
                                                                                              ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2502:61 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2502       callback?: (err: any, affectedRows: number) => void): Query<number> & QueryHelpers;
                                                              ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2504:61 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2504       callback?: (err: any, affectedRows: number) => void): Query<number> & QueryHelpers;
                                                              ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3274:86 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3274     count(conditions: FilterQuery<T>, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                                       ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3288:67 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3288     countDocuments(callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                    ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3289:93 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3289     countDocuments(criteria: FilterQuery<T>, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                                              ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3301:75 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3301     estimatedDocumentCount(callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                            ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3302:89 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3302     estimatedDocumentCount(options: any, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                                          ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3337:73 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3337     distinct(field: string, callback?: (err: any, res: any[]) => void): Query<any[]> & QueryHelpers;
                                                                          ~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3339:51 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3339       callback?: (err: any, res: any[]) => void): Query<any[]> & QueryHelpers;
                                                    ~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3393:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3393       callback?: (err: any, res: T[]) => void): Query<DocumentDefinition<T>[]> & QueryHelpers;
                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3408:54 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3408       callback?: (err: any, res: T | null) => void): Query<DocumentDefinition<T>> & QueryHelpers;
                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3430:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3430         : Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3449:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3449         : Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3470:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3470         : Query<mongodb.FindAndModifyWriteOpResultObject<T>> & QueryHelpers;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3474:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3474         : Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3478:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3478         : Query<DocumentDefinition<T>> & QueryHelpers;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3493:54 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3493       callback?: (err: any, res: T | null) => void): Query<DocumentDefinition<T>> & QueryHelpers;
                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3513:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3513         : Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3529:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3529         : Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3547:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3547         : Query<mongodb.FindAndModifyWriteOpResultObject<T>> & QueryHelpers;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3554:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3554         : Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3557:77 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3557       callback?: (err: any, doc: DocumentDefinition<T>, res: any) => void): Query<DocumentDefinition<T>> & QueryHelpers;
                                                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3637:72 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3637     remove(conditions: FilterQuery<T>, callback?: (err: any) => void): Query<mongodb.DeleteWriteOpResultObject['result'] & { deletedCount?: number }> & QueryHelpers;
                                                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3638:75 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3638     deleteOne(conditions: FilterQuery<T>, callback?: (err: any) => void): Query<mongodb.DeleteWriteOpResultObject['result'] & { deletedCount?: number }> & QueryHelpers;
                                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3639:98 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3639     deleteOne(conditions: FilterQuery<T>, options: ModelOptions, callback?: (err: any) => void): Query<mongodb.DeleteWriteOpResultObject['result'] & { deletedCount?: number }> & QueryHelpers;
                                                                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3640:76 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3640     deleteMany(conditions: FilterQuery<T>, callback?: (err: any) => void): Query<mongodb.DeleteWriteOpResultObject['result'] & { deletedCount?: number }> & QueryHelpers;
                                                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3641:99 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3641     deleteMany(conditions: FilterQuery<T>, options: ModelOptions, callback?: (err: any) => void): Query<mongodb.DeleteWriteOpResultObject['result'] & { deletedCount?: number }> & QueryHelpers;
                                                                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3647:104 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3647     replaceOne(conditions: FilterQuery<T>, replacement: any, callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
                                                                                                         ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3654:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3654       callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
                                                  ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3656:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3656       callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
                                                  ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3658:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3658       callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
                                                  ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3660:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3660       callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
                                                  ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3662:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3662       callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
                                                  ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3664:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3664       callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
                                                  ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3667:37 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3667     where(path: string, val?: any): Query<any> & QueryHelpers;
                                      ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3734:5 - error TS2374: Duplicate string index signature.

3734     [k: string]: string;
      ~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: DocumentDefinition, FilterQuery, UpdateQuery, NativeError, Mongoose, CastError, Collection, Connection, Error, QueryCursor, VirtualType, Schema, Subdocument, Array, DocumentArray, Buffer, ObjectIdConstructor, Decimal128, Map, Aggregate, SchemaType, Document

1 declare module "mongoose" {

node_modules/@types/mongoose/index.d.ts:79:1
79 declare module "mongoose" {
~~~~~~~
Conflicts are in this file.
node_modules/mongoose/index.d.ts:346:37 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
346     delete(options?: QueryOptions): Query<any, this>;
~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:350:40 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
350     deleteOne(options?: QueryOptions): Query<any, this>;
~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:459:37 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
459     remove(options?: QueryOptions): Query<any, this>;
~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:462:129 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
462     replaceOne(replacement?: DocumentDefinition, options?: QueryOptions | null, callback?: (err: any, res: any) => void): Query<any, this>;
~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:484:123 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
484     update(update?: UpdateQuery, options?: QueryOptions | null, callback?: (err: CallbackError, res: any) => void): Query<any, this>;
~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:487:126 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
487     updateOne(update?: UpdateQuery, options?: QueryOptions | null, callback?: (err: CallbackError, res: any) => void): Query<any, this>;
~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:529:58 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
529     count(callback?: (err: any, count: number) => void): Query<number, T>;
~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:530:82 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
530     count(filter: FilterQuery, callback?: (err: any, count: number) => void): Query<number, T>;
~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:533:67 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
533     countDocuments(callback?: (err: any, count: number) => void): Query<number, T>;
~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:534:91 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
534     countDocuments(filter: FilterQuery, callback?: (err: any, count: number) => void): Query<number, T>;
~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:572:151 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
572     findOne(filter?: FilterQuery, projection?: any | null, options?: QueryOptions | null, callback?: (err: CallbackError, count: number) => void): Query<T | null, T>;
~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:632:42 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
632     $where(argument: string | Function): Query<Array, T>;
~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:644:101 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
644     distinct(field: string, filter?: FilterQuery, callback?: (err: any, count: number) => void): Query<Array, T>;
~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:647:99 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
647     estimatedDocumentCount(options?: QueryOptions, callback?: (err: any, count: number) => void): Query<number, T>;
~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:657:57 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
657     find(callback?: (err: any, count: number) => void): Query<Array, T>;
~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:658:81 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
658     find(filter: FilterQuery, callback?: (err: any, count: number) => void): Query<Array, T>;
~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:659:137 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
659     find(filter: FilterQuery, projection?: any | null, options?: QueryOptions | null, callback?: (err: any, count: number) => void): Query<Array, T>;
~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:662:140 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
662     findByIdAndDelete(id?: mongodb.ObjectId | any, options?: QueryOptions | null, callback?: (err: any, doc: T | null, res: any) => void): Query<T | null, T>;
~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:665:140 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
665     findByIdAndRemove(id?: mongodb.ObjectId | any, options?: QueryOptions | null, callback?: (err: any, doc: T | null, res: any) => void): Query<T | null, T>;
~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:668:165 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
668     findByIdAndUpdate(id?: mongodb.ObjectId | any, update?: UpdateQuery, options?: QueryOptions | null, callback?: (err: any, doc: T | null, res: any) => void): Query<T | null, T>;
~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:671:135 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
671     findOneAndDelete(filter?: FilterQuery, options?: QueryOptions | null, callback?: (err: any, doc: T | null, res: any) => void): Query<T | null, T>;
~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:674:135 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
674     findOneAndRemove(filter?: FilterQuery, options?: QueryOptions | null, callback?: (err: any, doc: T | null, res: any) => void): Query<T | null, T>;
~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:677:173 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
677     findOneAndReplace(filter?: FilterQuery, replacement?: DocumentDefinition, options?: QueryOptions | null, callback?: (err: any, doc: T | null, res: any) => void): Query<T | null, T>;
~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:680:160 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
680     findOneAndUpdate(filter?: FilterQuery, update?: UpdateQuery, options?: QueryOptions | null, callback?: (err: any, doc: T | null, res: any) => void): Query<T | null, T>;
~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:682:125 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
682     geoSearch(filter?: FilterQuery, options?: GeoSearchOptions, callback?: (err: CallbackError, res: Array) => void): Query<Array, T>;
~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:690:68 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
690     remove(filter?: any, callback?: (err: CallbackError) => void): Query<any, T>;
~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:693:151 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
693     replaceOne(filter?: FilterQuery, replacement?: DocumentDefinition, options?: QueryOptions | null, callback?: (err: any, res: any) => void): Query<any, T>;
~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:696:173 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
696     findOneAndReplace(filter?: FilterQuery, replacement?: DocumentDefinition, options?: QueryOptions | null, callback?: (err: any, doc: T | null, res: any) => void): Query<T | null, T>;
~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:699:135 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
699     update(filter?: FilterQuery, update?: UpdateQuery, options?: QueryOptions | null, callback?: (err: any, res: any) => void): Query<any, T>;
~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:702:139 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
702     updateMany(filter?: FilterQuery, update?: UpdateQuery, options?: QueryOptions | null, callback?: (err: any, res: any) => void): Query<any, T>;
~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:705:138 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
705     updateOne(filter?: FilterQuery, update?: UpdateQuery, options?: QueryOptions | null, callback?: (err: any, res: any) => void): Query<any, T>;
~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:708:37 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
708     where(path: string, val?: any): Query<Array, T>;
~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:919:20 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
919     post<T extends Query<any, any> = Query<any, any>>(method: string | RegExp, fn: (this: T, res: any, next: (err: CallbackError) => void) => void): this;
~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:919:38 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
919     post<T extends Query<any, any> = Query<any, any>>(method: string | RegExp, fn: (this: T, res: any, next: (err: CallbackError) => void) => void): this;
~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:924:20 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
924     post<T extends Query<any, any> = Query<any, any>>(method: string | RegExp, fn: (this: T, err: NativeError, res: any, next: (err: CallbackError) => void) => void): this;
~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:924:38 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
924     post<T extends Query<any, any> = Query<any, any>>(method: string | RegExp, fn: (this: T, err: NativeError, res: any, next: (err: CallbackError) => void) => void): this;
~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:930:19 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
930     pre<T extends Query<any, any> = Query<any, any>>(method: string | RegExp, fn: (this: T, next: (err: CallbackError) => void) => void): this;
~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:930:37 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
930     pre<T extends Query<any, any> = Query<any, any>>(method: string | RegExp, fn: (this: T, next: (err: CallbackError) => void) => void): this;
~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1504:13 - error TS2428: All declarations of 'Query' must have identical type parameters.
1504   interface Query<ResultType, DocType extends Document> {
~~~~~
node_modules/mongoose/index.d.ts:1504:13 - error TS2430: Interface 'Query<ResultType, DocType, T>' incorrectly extends interface 'DocumentQuery<T, any, {}>'.
Types of property 'all' are incompatible.
Type '{ (val: any[]): this; (path: string, val: any[]): this; }' is not assignable to type '{ (val: number): this; (path: string, val: number): this; (val: any[]): this; (path: string, val: any[]): this; }'.
Types of parameters 'val' and 'val' are incompatible.
Type 'number' is not assignable to type 'any[]'.
1504   interface Query<ResultType, DocType extends Document> {
~~~~~
node_modules/mongoose/index.d.ts:1508:42 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1508     $where(argument: string | Function): Query<Array, DocType>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1544:58 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1544     count(callback?: (err: any, count: number) => void): Query<number, DocType>;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1545:90 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1545     count(criteria: FilterQuery, callback?: (err: any, count: number) => void): Query<number, DocType>;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1548:67 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1548     countDocuments(callback?: (err: any, count: number) => void): Query<number, DocType>;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1549:99 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1549     countDocuments(criteria: FilterQuery, callback?: (err: any, count: number) => void): Query<number, DocType>;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1562:123 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1562     deleteMany(filter?: FilterQuery, options?: QueryOptions, callback?: (err: CallbackError, res: any) => void): Query<any, DocType>;
~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1569:122 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1569     deleteOne(filter?: FilterQuery, options?: QueryOptions, callback?: (err: CallbackError, res: any) => void): Query<any, DocType>;
~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1572:107 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1572     distinct(field: string, filter?: FilterQuery, callback?: (err: any, count: number) => void): Query<Array, DocType>;
~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1589:99 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1589     estimatedDocumentCount(options?: QueryOptions, callback?: (err: any, count: number) => void): Query<number, DocType>;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1607:57 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1607     find(callback?: (err: any, count: number) => void): Query<Array, DocType>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1608:87 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1608     find(filter: FilterQuery, callback?: (err: any, count: number) => void): Query<Array, DocType>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1609:153 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1609     find(filter: FilterQuery, projection?: any | null, options?: QueryOptions | null, callback?: (err: CallbackError, count: number) => void): Query<Array, DocType>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1612:157 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1612     findOne(filter?: FilterQuery, projection?: any | null, options?: QueryOptions | null, callback?: (err: CallbackError, count: number) => void): Query<DocType | null, DocType>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1615:147 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1615     findOneAndDelete(filter?: FilterQuery, options?: QueryOptions | null, callback?: (err: any, doc: DocType | null, res: any) => void): Query<DocType | null, DocType>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1618:147 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1618     findOneAndRemove(filter?: FilterQuery, options?: QueryOptions | null, callback?: (err: any, doc: DocType | null, res: any) => void): Query<DocType | null, DocType>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1621:178 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1621     findOneAndUpdate(filter?: FilterQuery, update?: UpdateQuery, options?: QueryOptions | null, callback?: (err: any, doc: DocType | null, res: any) => void): Query<DocType | null, DocType>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1624:146 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1624     findByIdAndDelete(id?: mongodb.ObjectId | any, options?: QueryOptions | null, callback?: (err: any, doc: DocType | null, res: any) => void): Query<DocType | null, DocType>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1627:177 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1627     findByIdAndUpdate(id?: mongodb.ObjectId | any, update?: UpdateQuery, options?: QueryOptions | null, callback?: (err: any, doc: DocType | null, res: any) => void): Query<DocType | null, DocType>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1676:32 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1676     lean(val?: boolean | any): Query<LeanDocument, DocType>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1693:56 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1693     map(fn: (doc: DocType) => MappedType): Query<MappedType, DocType>;
~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1710:19 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1710     merge(source: Query<any, any>): this;
~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1773:123 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1773     remove(filter?: FilterQuery, callback?: (err: CallbackError, res: mongodb.WriteOpResult['result']) => void): Query<mongodb.WriteOpResult['result'], DocType>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1780:163 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1780     replaceOne(filter?: FilterQuery, replacement?: DocumentDefinition, options?: QueryOptions | null, callback?: (err: any, res: any) => void): Query<any, DocType>;
~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1846:85 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1846     toConstructor(): new (filter?: FilterQuery, options?: QueryOptions) => Query<ResultType, DocType>;
~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1849:157 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1849     update(filter?: FilterQuery, update?: UpdateQuery, options?: QueryOptions | null, callback?: (err: CallbackError, res: any) => void): Query<any, DocType>;
~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1857:161 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1857     updateMany(filter?: FilterQuery, update?: UpdateQuery, options?: QueryOptions | null, callback?: (err: CallbackError, res: any) => void): Query<any, DocType>;
~~~~~~~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:1863:160 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).
1863     updateOne(filter?: FilterQuery, update?: UpdateQuery, options?: QueryOptions | null, callback?: (err: CallbackError, res: any) => void): Query<any, DocType>;

Duplicate issue #5848: Cannot build new Project because of wrong mongoose types
Created: 2020-12-02T20:43:54Z
Bug Report
Current behavior

I have created a new project with mongo and mongoose for the database, by running the project in dev mode
it can build because of types error found in the mongoose types
Input Code

node_modules/@nestjs/mongoose/dist/factories/schema.factory.d.ts:4:60 - error TS2315: Type 'Schema' is not generic.

4     static createForClass<T = any>(target: Type<unknown>): mongoose.Schema<T>;
                                                             ~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:79:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: DocumentDefinition, FilterQuery, UpdateQuery, NativeError, Mongoose, CastError, Collection, Connection, Error, QueryCursor, VirtualType, Schema, Subdocument, Array, DocumentArray, Buffer, ObjectIdConstructor, Decimal128, Map, Aggregate, SchemaType, Document

79 declare module "mongoose" {
   ~~~~~~~

  node_modules/mongoose/index.d.ts:1:1
    1 declare module "mongoose" {
      ~~~~~~~
    Conflicts are in this file.

node_modules/@types/mongoose/index.d.ts:226:14 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'SchemaTypes' must be of type 'typeof Types', but here has type 'typeof Types'.

226   export var SchemaTypes: typeof Schema.Types;
                 ~~~~~~~~~~~

  node_modules/mongoose/index.d.ts:45:14
    45   export var SchemaTypes: typeof Schema.Types;
                    ~~~~~~~~~~~
    'SchemaTypes' was also declared here.

node_modules/@types/mongoose/index.d.ts:822:24 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

822     constructor(query: Query<T>, options: any);
                           ~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1013:19 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1013     pre<T extends Query<any> = Query<any>>(
                       ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1013:32 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1013     pre<T extends Query<any> = Query<any>>(
                                    ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1036:48 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1036     pre<T extends Document | Model<Document> | Query<any> | Aggregate<any>>(
                                                    ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1048:19 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1048     pre<T extends Query<any> = Query<any>>(
                       ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1048:32 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1048     pre<T extends Query<any> = Query<any>>(
                                    ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1074:48 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1074     pre<T extends Document | Model<Document> | Query<any> | Aggregate<any>>(
                                                    ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1183:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'collation' must be of type 'CollationDocument', but here has type 'CollationOptions'.

1183     collation?: CollationOptions;
         ~~~~~~~~~

  node_modules/mongoose/index.d.ts:990:5
    990     collation?: mongodb.CollationDocument;
            ~~~~~~~~~
    'collation' was also declared here.

node_modules/@types/mongoose/index.d.ts:1205:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'strictQuery' must be of type 'boolean | "throw"', but here has type 'boolean'.

1205     strictQuery?: boolean;
         ~~~~~~~~~~~

  node_modules/mongoose/index.d.ts:1046:5
    1046     strictQuery?: boolean | "throw";
             ~~~~~~~~~~~
    'strictQuery' was also declared here.

node_modules/@types/mongoose/index.d.ts:1209:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'toJSON' must be of type 'ToObjectOptions', but here has type 'DocumentToObjectOptions'.

1209     toJSON?: DocumentToObjectOptions;
         ~~~~~~

  node_modules/mongoose/index.d.ts:1053:5
    1053     toJSON?: ToObjectOptions;
             ~~~~~~
    'toJSON' was also declared here.

node_modules/@types/mongoose/index.d.ts:1211:5 - error TS2717: Subsequent property declarations must have the same type.  Property 'toObject' must be of type 'ToObjectOptions', but here has type 'DocumentToObjectOptions'.

1211     toObject?: DocumentToObjectOptions;
         ~~~~~~~~

  node_modules/mongoose/index.d.ts:1060:5
    1060     toObject?: ToObjectOptions;
             ~~~~~~~~
    'toObject' was also declared here.

node_modules/@types/mongoose/index.d.ts:1264:5 - error TS2374: Duplicate string index signature.

1264     [path: string]: SchemaTypeOpts<any> | Schema | SchemaType;
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1627:76 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1627     replaceOne(replacement: any, callback?: (err: any, raw: any) => void): Query<any>;
                                                                                ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1630:64 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1630     update(doc: any, callback?: (err: any, raw: any) => void): Query<any>;
                                                                    ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1632:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1632       callback?: (err: any, raw: any) => void): Query<any>;
                                                     ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1635:67 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1635     updateOne(doc: any, callback?: (err: any, raw: any) => void): Query<any>;
                                                                       ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1637:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1637       callback?: (err: any, raw: any) => void): Query<any>;
                                                     ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1920:36 - error TS2344: Type 'MongooseDocument' does not satisfy the constraint 'Document'.
  Type 'MongooseDocument' is missing the following properties from type 'Document': $ignore, $isDeleted, $isEmpty, $isValid, and 16 more.

1920       parentArray(): DocumentArray<MongooseDocument>;
                                        ~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:1962:9 - error TS2415: Class 'Query<ResultType, DocType, T>' incorrectly extends base class 'DocumentQuery<T, any, {}>'.

1962   class Query<T> extends DocumentQuery<T, any> { }
             ~~~~~

node_modules/@types/mongoose/index.d.ts:1962:9 - error TS2428: All declarations of 'Query' must have identical type parameters.

1962   class Query<T> extends DocumentQuery<T, any> { }
             ~~~~~

node_modules/@types/mongoose/index.d.ts:2047:58 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2047     count(callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                              ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2048:90 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2048     count(criteria: FilterQuery<DocType>, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                                              ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2069:67 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2069     countDocuments(callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                       ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2070:99 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2070     countDocuments(criteria: FilterQuery<DocType>, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                                                       ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2082:75 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2082     estimatedDocumentCount(callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                               ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2083:89 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2083     estimatedDocumentCount(options: any, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                                             ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2092:58 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2092     distinct(callback?: (err: any, res: any[]) => void): Query<any[]> & QueryHelpers;
                                                              ~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2093:73 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2093     distinct(field: string, callback?: (err: any, res: any[]) => void): Query<any[]> & QueryHelpers;
                                                                             ~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2094:45 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2094     distinct(field: string, criteria: any | Query<any>,
                                                 ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2095:51 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2095       callback?: (err: any, res: any[]) => void): Query<any[]> & QueryHelpers;
                                                       ~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2098:32 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2098     elemMatch(criteria: (elem: Query<any>) => void): this;
                                    ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2100:63 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2100     elemMatch(path: string | any | Function, criteria: (elem: Query<any>) => void): this;
                                                                   ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2136:54 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2136       callback?: (err: any, res: T | null) => void): Query<DocumentDefinition<DocType>> & QueryHelpers;
                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2153:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2153         : Query<mongodb.FindAndModifyWriteOpResultObject<DocType | null>> & QueryHelpers;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2173:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2173         : Query<mongodb.FindAndModifyWriteOpResultObject<DocType>> & QueryHelpers;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2179:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2179         : Query<mongodb.FindAndModifyWriteOpResultObject<DocType | null>> & QueryHelpers;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2183:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2183         : Query<DocumentDefinition<DocType>> & QueryHelpers;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2256:69 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2256     lean<P = DocumentDefinition<DocType>>(bool?: boolean | object): Query<T extends Array<any> ? P[] : (P | null)> & QueryHelpers;
                                                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2300:25 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2300     merge(source: any | Query<any>): this;
                             ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2413:44 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2413     remove(callback?: (err: any) => void): Query<mongodb.WriteOpResult['result']> & QueryHelpers;
                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2414:45 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2414     remove(criteria: FilterQuery<DocType> | Query<any>, callback?: (err: any) => void): Query<mongodb.WriteOpResult['result']> & QueryHelpers;
                                                 ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2414:89 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2414     remove(criteria: FilterQuery<DocType> | Query<any>, callback?: (err: any) => void): Query<mongodb.WriteOpResult['result']> & QueryHelpers;
                                                                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2491:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2491     toConstructor<T>(): new (...args: any[]) => Query<T> & QueryHelpers;
                                                     ~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2499:66 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2499     update(callback?: (err: any, affectedRows: number) => void): Query<number> & QueryHelpers;
                                                                      ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2500:93 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2500     update(doc: UpdateQuery<DocType>, callback?: (err: any, affectedRows: number) => void): Query<number> & QueryHelpers;
                                                                                                 ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2502:61 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2502       callback?: (err: any, affectedRows: number) => void): Query<number> & QueryHelpers;
                                                                 ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:2504:61 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2504       callback?: (err: any, affectedRows: number) => void): Query<number> & QueryHelpers;
                                                                 ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3274:86 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3274     count(conditions: FilterQuery<T>, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                                          ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3288:67 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3288     countDocuments(callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                       ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3289:93 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3289     countDocuments(criteria: FilterQuery<T>, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                                                 ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3301:75 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3301     estimatedDocumentCount(callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                               ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3302:89 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3302     estimatedDocumentCount(options: any, callback?: (err: any, count: number) => void): Query<number> & QueryHelpers;
                                                                                             ~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3337:73 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3337     distinct(field: string, callback?: (err: any, res: any[]) => void): Query<any[]> & QueryHelpers;
                                                                             ~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3339:51 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3339       callback?: (err: any, res: any[]) => void): Query<any[]> & QueryHelpers;
                                                       ~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3393:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3393       callback?: (err: any, res: T[]) => void): Query<DocumentDefinition<T>[]> & QueryHelpers;
                                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3408:54 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3408       callback?: (err: any, res: T | null) => void): Query<DocumentDefinition<T>> & QueryHelpers;
                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3430:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3430         : Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3449:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3449         : Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3470:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3470         : Query<mongodb.FindAndModifyWriteOpResultObject<T>> & QueryHelpers;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3474:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3474         : Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3478:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3478         : Query<DocumentDefinition<T>> & QueryHelpers;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3493:54 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3493       callback?: (err: any, res: T | null) => void): Query<DocumentDefinition<T>> & QueryHelpers;
                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3513:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3513         : Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3529:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3529         : Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3547:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3547         : Query<mongodb.FindAndModifyWriteOpResultObject<T>> & QueryHelpers;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3554:11 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3554         : Query<mongodb.FindAndModifyWriteOpResultObject<T | null>> & QueryHelpers;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3557:77 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3557       callback?: (err: any, doc: DocumentDefinition<T>, res: any) => void): Query<DocumentDefinition<T>> & QueryHelpers;
                                                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3637:72 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3637     remove(conditions: FilterQuery<T>, callback?: (err: any) => void): Query<mongodb.DeleteWriteOpResultObject['result'] & { deletedCount?: number }> & QueryHelpers;
                                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3638:75 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3638     deleteOne(conditions: FilterQuery<T>, callback?: (err: any) => void): Query<mongodb.DeleteWriteOpResultObject['result'] & { deletedCount?: number }> & QueryHelpers;
                                                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3639:98 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3639     deleteOne(conditions: FilterQuery<T>, options: ModelOptions, callback?: (err: any) => void): Query<mongodb.DeleteWriteOpResultObject['result'] & { deletedCount?: number }> & QueryHelpers;
                                                                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3640:76 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3640     deleteMany(conditions: FilterQuery<T>, callback?: (err: any) => void): Query<mongodb.DeleteWriteOpResultObject['result'] & { deletedCount?: number }> & QueryHelpers;
                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3641:99 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3641     deleteMany(conditions: FilterQuery<T>, options: ModelOptions, callback?: (err: any) => void): Query<mongodb.DeleteWriteOpResultObject['result'] & { deletedCount?: number }> & QueryHelpers;
                                                                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3647:104 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3647     replaceOne(conditions: FilterQuery<T>, replacement: any, callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
                                                                                                            ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3654:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3654       callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
                                                     ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3656:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3656       callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
                                                     ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3658:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3658       callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
                                                     ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3660:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3660       callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
                                                     ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3662:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3662       callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
                                                     ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3664:49 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3664       callback?: (err: any, raw: any) => void): Query<any> & QueryHelpers;
                                                     ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3667:37 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

3667     where(path: string, val?: any): Query<any> & QueryHelpers;
                                         ~~~~~~~~~~

node_modules/@types/mongoose/index.d.ts:3734:5 - error TS2374: Duplicate string index signature.

3734     [k: string]: string;
         ~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: DocumentDefinition, FilterQuery, UpdateQuery, NativeError, Mongoose, CastError, Collection, Connection, Error, QueryCursor, VirtualType, Schema, Subdocument, Array, DocumentArray, Buffer, ObjectIdConstructor, Decimal128, Map, Aggregate, SchemaType, Document

1 declare module "mongoose" {
  ~~~~~~~

  node_modules/@types/mongoose/index.d.ts:79:1
    79 declare module "mongoose" {
       ~~~~~~~
    Conflicts are in this file.

node_modules/mongoose/index.d.ts:346:37 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

346     delete(options?: QueryOptions): Query<any, this>;
                                        ~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:350:40 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

350     deleteOne(options?: QueryOptions): Query<any, this>;
                                           ~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:459:37 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

459     remove(options?: QueryOptions): Query<any, this>;
                                        ~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:462:129 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

462     replaceOne(replacement?: DocumentDefinition<this>, options?: QueryOptions | null, callback?: (err: any, res: any) => void): Query<any, this>;
                                                                                                                                    ~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:484:123 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

484     update(update?: UpdateQuery<this>, options?: QueryOptions | null, callback?: (err: CallbackError, res: any) => void): Query<any, this>;
                                                                                                                              ~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:487:126 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

487     updateOne(update?: UpdateQuery<this>, options?: QueryOptions | null, callback?: (err: CallbackError, res: any) => void): Query<any, this>;
                                                                                                                                 ~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:529:58 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

529     count(callback?: (err: any, count: number) => void): Query<number, T>;
                                                             ~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:530:82 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

530     count(filter: FilterQuery<T>, callback?: (err: any, count: number) => void): Query<number, T>;
                                                                                     ~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:533:67 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

533     countDocuments(callback?: (err: any, count: number) => void): Query<number, T>;
                                                                      ~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:534:91 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

534     countDocuments(filter: FilterQuery<T>, callback?: (err: any, count: number) => void): Query<number, T>;
                                                                                              ~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:572:151 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

572     findOne(filter?: FilterQuery<T>, projection?: any | null, options?: QueryOptions | null, callback?: (err: CallbackError, count: number) => void): Query<T | null, T>;
                                                                                                                                                          ~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:632:42 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

632     $where(argument: string | Function): Query<Array<T>, T>;
                                             ~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:644:101 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

644     distinct(field: string, filter?: FilterQuery<T>, callback?: (err: any, count: number) => void): Query<Array<any>, T>;
                                                                                                        ~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:647:99 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

647     estimatedDocumentCount(options?: QueryOptions, callback?: (err: any, count: number) => void): Query<number, T>;
                                                                                                      ~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:657:57 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

657     find(callback?: (err: any, count: number) => void): Query<Array<T>, T>;
                                                            ~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:658:81 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

658     find(filter: FilterQuery<T>, callback?: (err: any, count: number) => void): Query<Array<T>, T>;
                                                                                    ~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:659:137 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

659     find(filter: FilterQuery<T>, projection?: any | null, options?: QueryOptions | null, callback?: (err: any, count: number) => void): Query<Array<T>, T>;
                                                                                                                                            ~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:662:140 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

662     findByIdAndDelete(id?: mongodb.ObjectId | any, options?: QueryOptions | null, callback?: (err: any, doc: T | null, res: any) => void): Query<T | null, T>;
                                                                                                                                               ~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:665:140 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

665     findByIdAndRemove(id?: mongodb.ObjectId | any, options?: QueryOptions | null, callback?: (err: any, doc: T | null, res: any) => void): Query<T | null, T>;
                                                                                                                                               ~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:668:165 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

668     findByIdAndUpdate(id?: mongodb.ObjectId | any, update?: UpdateQuery<T>, options?: QueryOptions | null, callback?: (err: any, doc: T | null, res: any) => void): Query<T | null, T>;
                                                                                                                                                                        ~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:671:135 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

671     findOneAndDelete(filter?: FilterQuery<T>, options?: QueryOptions | null, callback?: (err: any, doc: T | null, res: any) => void): Query<T | null, T>;
                                                                                                                                          ~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:674:135 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

674     findOneAndRemove(filter?: FilterQuery<T>, options?: QueryOptions | null, callback?: (err: any, doc: T | null, res: any) => void): Query<T | null, T>;
                                                                                                                                          ~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:677:173 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

677     findOneAndReplace(filter?: FilterQuery<T>, replacement?: DocumentDefinition<T>, options?: QueryOptions | null, callback?: (err: any, doc: T | null, res: any) => void): Query<T | null, T>;
                                                                                                                                                                                ~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:680:160 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

680     findOneAndUpdate(filter?: FilterQuery<T>, update?: UpdateQuery<T>, options?: QueryOptions | null, callback?: (err: any, doc: T | null, res: any) => void): Query<T | null, T>;
                                                                                                                                                                   ~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:682:125 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

682     geoSearch(filter?: FilterQuery<T>, options?: GeoSearchOptions, callback?: (err: CallbackError, res: Array<T>) => void): Query<Array<T>, T>;
                                                                                                                                ~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:690:68 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

690     remove(filter?: any, callback?: (err: CallbackError) => void): Query<any, T>;
                                                                       ~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:693:151 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

693     replaceOne(filter?: FilterQuery<T>, replacement?: DocumentDefinition<T>, options?: QueryOptions | null, callback?: (err: any, res: any) => void): Query<any, T>;
                                                                                                                                                          ~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:696:173 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

696     findOneAndReplace(filter?: FilterQuery<T>, replacement?: DocumentDefinition<T>, options?: QueryOptions | null, callback?: (err: any, doc: T | null, res: any) => void): Query<T | null, T>;
                                                                                                                                                                                ~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:699:135 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

699     update(filter?: FilterQuery<T>, update?: UpdateQuery<T>, options?: QueryOptions | null, callback?: (err: any, res: any) => void): Query<any, T>;
                                                                                                                                          ~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:702:139 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

702     updateMany(filter?: FilterQuery<T>, update?: UpdateQuery<T>, options?: QueryOptions | null, callback?: (err: any, res: any) => void): Query<any, T>;
                                                                                                                                              ~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:705:138 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

705     updateOne(filter?: FilterQuery<T>, update?: UpdateQuery<T>, options?: QueryOptions | null, callback?: (err: any, res: any) => void): Query<any, T>;
                                                                                                                                             ~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:708:37 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

708     where(path: string, val?: any): Query<Array<T>, T>;
                                        ~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:919:20 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

919     post<T extends Query<any, any> = Query<any, any>>(method: string | RegExp, fn: (this: T, res: any, next: (err: CallbackError) => void) => void): this;
                       ~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:919:38 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

919     post<T extends Query<any, any> = Query<any, any>>(method: string | RegExp, fn: (this: T, res: any, next: (err: CallbackError) => void) => void): this;
                                         ~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:924:20 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

924     post<T extends Query<any, any> = Query<any, any>>(method: string | RegExp, fn: (this: T, err: NativeError, res: any, next: (err: CallbackError) => void) => void): this;
                       ~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:924:38 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

924     post<T extends Query<any, any> = Query<any, any>>(method: string | RegExp, fn: (this: T, err: NativeError, res: any, next: (err: CallbackError) => void) => void): this;
                                         ~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:930:19 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

930     pre<T extends Query<any, any> = Query<any, any>>(method: string | RegExp, fn: (this: T, next: (err: CallbackError) => void) => void): this;
                      ~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:930:37 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

930     pre<T extends Query<any, any> = Query<any, any>>(method: string | RegExp, fn: (this: T, next: (err: CallbackError) => void) => void): this;
                                        ~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1504:13 - error TS2428: All declarations of 'Query' must have identical type parameters.

1504   interface Query<ResultType, DocType extends Document> {
                 ~~~~~

node_modules/mongoose/index.d.ts:1504:13 - error TS2430: Interface 'Query<ResultType, DocType, T>' incorrectly extends interface 'DocumentQuery<T, any, {}>'.
  Types of property 'all' are incompatible.
    Type '{ (val: any[]): this; (path: string, val: any[]): this; }' is not assignable to type '{ (val: number): this; (path: string, val: number): this; (val: any[]): this; (path: string, val: any[]): this; }'.
      Types of parameters 'val' and 'val' are incompatible.
        Type 'number' is not assignable to type 'any[]'.

1504   interface Query<ResultType, DocType extends Document> {
                 ~~~~~

node_modules/mongoose/index.d.ts:1508:42 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1508     $where(argument: string | Function): Query<Array<DocType>, DocType>;
                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1544:58 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1544     count(callback?: (err: any, count: number) => void): Query<number, DocType>;
                                                              ~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1545:90 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1545     count(criteria: FilterQuery<DocType>, callback?: (err: any, count: number) => void): Query<number, DocType>;
                                                                                              ~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1548:67 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1548     countDocuments(callback?: (err: any, count: number) => void): Query<number, DocType>;
                                                                       ~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1549:99 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1549     countDocuments(criteria: FilterQuery<DocType>, callback?: (err: any, count: number) => void): Query<number, DocType>;
                                                                                                       ~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1562:123 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1562     deleteMany(filter?: FilterQuery<DocType>, options?: QueryOptions, callback?: (err: CallbackError, res: any) => void): Query<any, DocType>;
                                                                                                                               ~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1569:122 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1569     deleteOne(filter?: FilterQuery<DocType>, options?: QueryOptions, callback?: (err: CallbackError, res: any) => void): Query<any, DocType>;
                                                                                                                              ~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1572:107 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1572     distinct(field: string, filter?: FilterQuery<DocType>, callback?: (err: any, count: number) => void): Query<Array<any>, DocType>;
                                                                                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1589:99 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1589     estimatedDocumentCount(options?: QueryOptions, callback?: (err: any, count: number) => void): Query<number, DocType>;
                                                                                                       ~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1607:57 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1607     find(callback?: (err: any, count: number) => void): Query<Array<DocType>, DocType>;
                                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1608:87 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1608     find(filter: FilterQuery<DocType>, callback?: (err: any, count: number) => void): Query<Array<DocType>, DocType>;
                                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1609:153 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1609     find(filter: FilterQuery<DocType>, projection?: any | null, options?: QueryOptions | null, callback?: (err: CallbackError, count: number) => void): Query<Array<DocType>, DocType>;
                                                                                                                                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1612:157 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1612     findOne(filter?: FilterQuery<DocType>, projection?: any | null, options?: QueryOptions | null, callback?: (err: CallbackError, count: number) => void): Query<DocType | null, DocType>;
                                                                                                                                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1615:147 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1615     findOneAndDelete(filter?: FilterQuery<DocType>, options?: QueryOptions | null, callback?: (err: any, doc: DocType | null, res: any) => void): Query<DocType | null, DocType>;
                                                                                                                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1618:147 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1618     findOneAndRemove(filter?: FilterQuery<DocType>, options?: QueryOptions | null, callback?: (err: any, doc: DocType | null, res: any) => void): Query<DocType | null, DocType>;
                                                                                                                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1621:178 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1621     findOneAndUpdate(filter?: FilterQuery<DocType>, update?: UpdateQuery<DocType>, options?: QueryOptions | null, callback?: (err: any, doc: DocType | null, res: any) => void): Query<DocType | null, DocType>;
                                                                                                                                                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1624:146 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1624     findByIdAndDelete(id?: mongodb.ObjectId | any, options?: QueryOptions | null, callback?: (err: any, doc: DocType | null, res: any) => void): Query<DocType | null, DocType>;
                                                                                                                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1627:177 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1627     findByIdAndUpdate(id?: mongodb.ObjectId | any, update?: UpdateQuery<DocType>, options?: QueryOptions | null, callback?: (err: any, doc: DocType | null, res: any) => void): Query<DocType | null, DocType>;
                                                                                                                                                                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1676:32 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1676     lean(val?: boolean | any): Query<LeanDocument<DocType>, DocType>;
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1693:56 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1693     map<MappedType>(fn: (doc: DocType) => MappedType): Query<MappedType, DocType>;
                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1710:19 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1710     merge(source: Query<any, any>): this;
                       ~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1773:123 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1773     remove(filter?: FilterQuery<DocType>, callback?: (err: CallbackError, res: mongodb.WriteOpResult['result']) => void): Query<mongodb.WriteOpResult['result'], DocType>;
                                                                                                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1780:163 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1780     replaceOne(filter?: FilterQuery<DocType>, replacement?: DocumentDefinition<DocType>, options?: QueryOptions | null, callback?: (err: any, res: any) => void): Query<any, DocType>;
                                                                                                                                                                       ~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1846:85 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1846     toConstructor(): new (filter?: FilterQuery<DocType>, options?: QueryOptions) => Query<ResultType, DocType>;
                                                                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1849:157 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1849     update(filter?: FilterQuery<DocType>, update?: UpdateQuery<DocType>, options?: QueryOptions | null, callback?: (err: CallbackError, res: any) => void): Query<any, DocType>;
                                                                                                                                                                 ~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1857:161 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1857     updateMany(filter?: FilterQuery<DocType>, update?: UpdateQuery<DocType>, options?: QueryOptions | null, callback?: (err: CallbackError, res: any) => void): Query<any, DocType>;
                                                                                                                                                                     ~~~~~~~~~~~~~~~~~~~

node_modules/mongoose/index.d.ts:1863:160 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1863     updateOne(filter?: FilterQuery<DocType>, update?: UpdateQuery<DocType>, options?: QueryOptions | null, callback?: (err: CallbackError, res: any) => void): Query<any, DocType>;

Expected behavior
Should build
Possible Solution
Update types
Environment

Nest version: 7.5.3
 
For Tooling issues:
- Node version: v14.13.0
- Platform: Linux

Others:
Using NVM

Closing comment (2020-12-02T20:49:01Z): This isn't a problem with Nest, but a problem with Mongoose ^5.11.0. Mongoose released their own types that broke pretty much any project relying on it. Duplicate of #5845