Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error Importing "mongodb" with typescript

When compiling any typescript program that just imports mongodb, i get 12 errors like:

node_modules/mongodb/mongodb.d.ts:3309:5 - error TS2416: Property 'end' in type 'GridFSBucketWriteStream' is not assignable to the same property in base type 'WritableStream'

To reproduce is simple with node TLS (v16.13.1), & a empty directory, just run:

npm i mongodb typescript
echo "import mongodb  from 'mongodb'" > index.ts
npx tsc index
like image 983
k force Avatar asked Mar 31 '26 22:03

k force


1 Answers

i referred this https://github.com/mongodb/node-mongodb-native/pull/3088

npm i @types/[email protected] --save-dev

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!