broken compatibility with latest @types/mongodb
See original GitHub issueDo you want to request a feature or report a bug? BUG mongoose@5.11.16 with @types/mongodb@3.6.7
What is the current behavior?
src/loaders/mongoose.ts:25:5 - error TS2322: Type 'import("node_modules/mongoose/node_modules/@types/mongodb/index").Db' is not assignable to type 'import("node_modules/@types/mongodb/index").Db'.
Types of property 'collection' are incompatible.
Type '{ <TSchema = any>(name: string, callback?: import("node_modules/mongoose/node_modules/@types/mongodb/index").MongoCallback<import("node_modules/mongoose/node_modules/@types/mongodb/index").Collection<TSchema>>):...' is not assignable to type '{ <TSchema = any>(name: string, callback?: import("node_modules/@types/mongodb/index").MongoCallback<import("node_modules/@types/mongodb/index").Collection<TSchema>>): import("node_modules...'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'result' and 'result' are incompatible.
Type 'import("node_modules/mongoose/node_modules/@types/mongodb/index").Collection<any>' is not assignable to type 'import("node_modules/@types/mongodb/index").Collection<any>'.
Types of property 'aggregate' are incompatible.
Type '{ <T = any>(callback: import("node_modules/mongoose/node_modules/@types/mongodb/index").MongoCallback<import("node_modules/mongoose/node_modules/@types/mongodb/index").AggregationCursor<T>>): import("/mnt/c/dev/...' is not assignable to type '{ <T = any>(callback: import("node_modules/@types/mongodb/index").MongoCallback<import("node_modules/@types/mongodb/index").AggregationCursor<T>>): import("node_modules...'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'result' and 'result' are incompatible.
Type 'import("node_modules/mongoose/node_modules/@types/mongodb/index").AggregationCursor<any>' is not assignable to type 'import("node_modules/@types/mongodb/index").AggregationCursor<any>'.
The types returned by 'group(...).addCursorFlag(...).project(...)[Symbol.asyncIterator]()' are incompatible between these types.
Type 'AsyncIterableIterator<U>' is not assignable to type 'AsyncIterableIterator<U>'. Two different types with this name exist, but they are unrelated.
Type 'U' is not assignable to type 'U'. Two different types with this name exist, but they are unrelated.
'U' could be instantiated with an arbitrary type which could be unrelated to 'U'.
reverting to @types/mongodb@3.6.3 does work
If the current behavior is a bug, please provide the steps to reproduce. use mongoose@5.11.16 with @types/mongodb@3.6.7 and use mongodb.Db type in typescript
What is the expected behavior? no typescript error
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that “latest” is not a version. mongoose@5.11.16 node@14.15.5 typescript@4.1.5
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Compatibility Changes in MongoDB 5.0
Starting in MongoDB 5.0, the serverStatus command does not output opReadConcernCounters , which contained the read concern level specified by query operations.
Read more >Compatibility Changes in MongoDB 6.0
This page describes changes introduced in MongoDB 6.0 that can affect compatibility with older versions of MongoDB. MongoDB 6.0 is a Major Release, ......
Read more >Compatibility Changes in MongoDB 3.6
Array Operation Compatibility Changes In 3.4 and earlier versions of MongoDB, the query only returns those documents in which the array field a...
Read more >Compatibility Changes in MongoDB 4.0
The following 4.0 changes can affect the compatibility with older versions of MongoDB. ... New type conversion operators and enhancements.
Read more >Release Notes for MongoDB 4.2
Official MongoDB 4.2+ compatible drivers and the MongoDB 4.2 or later mongo shell support explicitly encrypting or decrypting fields with a specific data ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
latest
5.12.x
version no longer has the issueTake a look at your lockfile and make sure all instances of
@types/mongodb
have the exact same version.