dsanel / mongoose-delete

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

SoftDeleteDocument does not satisfy the constraint Document<any> while using type definitions. #95

Closed RsknCankov closed 3 years ago

RsknCankov commented 3 years ago

Hello, After updating mongoose type definitions (from @types/mongoose -> just use ones provided by mongoose package), all my interfaces that extend SoftDeleteDocument (type definition from mongoose delete) are throwing the following error :

does not satisfy the constraint 'Document'. delete option is different. Is needed this module to be rebuilt by using default mongoose typings in order for that to be fixed?
RsknCankov commented 3 years ago

Guys I am the only one with this problem?

dantehemerson commented 3 years ago

Same for me, I'm using

"mongoose": "^5.11.3",
"@types/mongoose-delete": "^0.5.2",
"mongoose-delete": "^0.5.3"

And I get this error on build:

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, SchemaTypes, STATES, connection, connections, models, mongo, version, CastError, ConnectionOptions, Collection, Connection, disconnected, connected, connecting, disconnecting, uninitialized, Error, QueryCursor, VirtualType, Schema, SchemaDefinition, SchemaTypeOpts, Subdocument, Array, DocumentArray, Buffer, ObjectId, ObjectIdConstructor, Decimal128, Map, mquery, Aggregate, SchemaType, Promise, PromiseProvider, Model, Document, ModelUpdateOptions

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:438:37 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

662     deleteMany(filter?: any, options?: QueryOptions, callback?: (err: CallbackError) => void): Query<any, T>;
                                                                                                   ~~~~~~~~~~~~~

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

669     deleteOne(filter?: any, options?: QueryOptions, callback?: (err: CallbackError) => void): Query<any, T>;
                                                                                                  ~~~~~~~~~~~~~

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

690     findById(id: any, projection?: any | null, options?: QueryOptions | null, callback?: (err: CallbackError, doc: T | null) => void): Query<T | null, T>;
                                                                                                                                           ~~~~~~~~~~~~~~~~~~

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

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

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

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

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

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

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

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

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

787     find(callback?: (err: any, docs: T[]) => void): Query<Array<T>, T>;
                                                        ~~~~~~~~~~~~~~~~~~

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

788     find(filter: FilterQuery<T>, callback?: (err: any, docs: T[]) => void): Query<Array<T>, T>;
                                                                                ~~~~~~~~~~~~~~~~~~

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

789     find(filter: FilterQuery<T>, projection?: any | null, options?: QueryOptions | null, callback?: (err: any, docs: T[]) => void): Query<Array<T>, T>;
                                                                                                                                        ~~~~~~~~~~~~~~~~~~

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

792     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:795:140 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

795     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:798:212 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

798     findByIdAndUpdate(id: mongodb.ObjectId | any, update: UpdateQuery<T>, options: QueryOptions & { rawResult: true }, callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject<T>, res: any) => void): Query<mongodb.FindAndModifyWriteOpResultObject<T>, T>;
                                                                                                                                                                                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

799     findByIdAndUpdate(id: mongodb.ObjectId | any, update: UpdateQuery<T>, options: QueryOptions & { upsert: true } & ReturnsNewDoc, callback?: (err: any, doc: T, res: any) => void): Query<T, T>;
                                                                                                                                                                                          ~~~~~~~~~~~

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

800     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:803:135 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

803     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:806:135 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

806     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:809:191 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

809     findOneAndReplace(filter: FilterQuery<T>, replacement: DocumentDefinition<T>, options: QueryOptions & { upsert: true } & ReturnsNewDoc, callback?: (err: any, doc: T, res: any) => void): Query<T, T>;
                                                                                                                                                                                                  ~~~~~~~~~~~

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

810     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:813:207 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

813     findOneAndUpdate(filter: FilterQuery<T>, update: UpdateQuery<T>, options: QueryOptions & { rawResult: true }, callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject<T>, res: any) => void): Query<mongodb.FindAndModifyWriteOpResultObject<T>, T>;
                                                                                                                                                                                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

814     findOneAndUpdate(filter: FilterQuery<T>, update: UpdateQuery<T>, options: QueryOptions & { upsert: true } & ReturnsNewDoc, callback?: (err: any, doc: T, res: any) => void): Query<T, T>;
                                                                                                                                                                                     ~~~~~~~~~~~

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

815     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:817:125 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

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

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

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

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

828     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:837:135 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

837     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:840:139 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

840     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:843:138 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

843     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:846:37 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

node_modules/mongoose/index.d.ts:1772: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[]'.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

1880     find(callback?: (err: any, docs: DocType[]) => void): Query<Array<DocType>, DocType>;
                                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

1881     find(filter: FilterQuery<DocType>, callback?: (err: any, docs: DocType[]) => void): Query<Array<DocType>, DocType>;
                                                                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

1882     find(filter: FilterQuery<DocType>, projection?: any | null, options?: QueryOptions | null, callback?: (err: CallbackError, docs: DocType[]) => void): Query<Array<DocType>, DocType>;
                                                                                                                                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

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

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

1888     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:1891:147 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1891     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:1894:225 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1894     findOneAndUpdate(filter: FilterQuery<DocType>, update: UpdateQuery<DocType>, options: QueryOptions & { rawResult: true }, callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject<DocType>, res: any) => void): Query<mongodb.FindAndModifyWriteOpResultObject<DocType>, DocType>;
                                                                                                                                                                                                                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

1895     findOneAndUpdate(filter: FilterQuery<DocType>, update: UpdateQuery<DocType>, options: QueryOptions & { upsert: true } & ReturnsNewDoc, callback?: (err: any, doc: DocType, res: any) => void): Query<DocType, DocType>;
                                                                                                                                                                                                        ~~~~~~~~~~~~~~~~~~~~~~~

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

1896     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:1899:146 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1899     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:1902:224 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1902     findByIdAndUpdate(id: mongodb.ObjectId | any, update: UpdateQuery<DocType>, options: QueryOptions & { rawResult: true }, callback?: (err: any, doc: mongodb.FindAndModifyWriteOpResultObject<DocType>, res: any) => void): Query<mongodb.FindAndModifyWriteOpResultObject<DocType>, DocType>;
                                                                                                                                                                                                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

1903     findByIdAndUpdate(id: mongodb.ObjectId | any, update: UpdateQuery<DocType>, options: QueryOptions & { upsert: true } & ReturnsNewDoc, callback?: (err: any, doc: DocType, res: any) => void): Query<DocType, DocType>;
                                                                                                                                                                                                       ~~~~~~~~~~~~~~~~~~~~~~~

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

1904     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:1953:82 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

1953     lean<LeanResultType = LeanDocumentOrArray<ResultType>>(val?: boolean | any): Query<LeanResultType, DocType>;
                                                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

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

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

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

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

2022     orFail(err?: NativeError | (() => NativeError)): Query<NonNullable<ResultType>, DocType>;
                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

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

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

2057     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:2123:46 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2123     toConstructor(): new (...args: any[]) => Query<ResultType, DocType>;
                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~

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

2126     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:2134:161 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2134     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:2140:160 - error TS2314: Generic type 'Query<ResultType, DocType, T>' requires 3 type argument(s).

2140     updateOne(filter?: FilterQuery<DocType>, update?: UpdateQuery<DocType>, options?: QueryOptions | null, callback?: (err: CallbackError, res: any) => void): Query<any, DocType>;
                                                                                                                                                                    ~~~~~~~~~~~~~~~~~~~
perebusquets commented 3 years ago

+1 here

lleseg commented 3 years ago

Same issue here, how did you guys fixed it?

RsknCankov commented 3 years ago

New implementation here is required. Just stuck to an older mongoose version for now...

dsanel commented 3 years ago

I just test this with the latest versions and didn't notice errors.