node_modules/mongodb/mongodb.d.ts:3314:5 - error TS2416: Property 'end' in type 'GridFSBucketWriteStream' is not assignable to the same property in base type 'Writable'.
Type '{ (): void; (chunk: Buffer): void; (callback: Callback<void | GridFSFile>): void; (chunk: Buffer, callback: Callback<void | GridFSFile>): void; (chunk: Buffer, encoding: BufferEncoding): void; (chunk: Buffer, encoding: BufferEncoding, callback: Callback<...>): void; }' is not assignable to type '{ (cb?: () => void): this; (chunk: any, cb?: () => void): this; (chunk: any, encoding: BufferEncoding, cb?: () => void): this; }'.
3314 end(chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<GridFSFile | void>): void;
~~~
Earlier it was right, but when i added the feature to upload static files (images) to s3 bucket (using multer and multer-s3), I am getting this error on doing yarn dev to start the server which runs like this "dev": "NODE_ENV=dev nodemon -e ts --exec \"npm run compile\"",
My package.json scripts
"scripts": {
"compile": "tsc && node build/index.js | pino-pretty",
"dev": "NODE_ENV=dev nodemon -e ts --exec \"npm run compile\"",
"start": "NODE_ENV=prod node build/index.js | pino-pretty",
"lint": "eslint . --ext .ts"
},
Update: It works somehow with the start script but not with the dev script. Also, it has taken the "dev" powers from me :(
My problem was solved with this question: Conversion 'GridFSBucketWriteStream' to type 'WritableStream' impossible?
Solution: Downgrade the @types/node to 16 as node 17 has breaking changes. Use
npm i -D @types/node@16 or yarn add -D @types/node@16 to do so
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With