【发布时间】:2022-01-05 16:53:44
【问题描述】:
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;
~~~
之前是对的,但是当我添加了将静态文件(图像)上传到 s3 存储桶的功能(使用 multer 和 multer-s3)时,我在执行 yarn dev 启动运行的服务器时遇到此错误这个"dev": "NODE_ENV=dev nodemon -e ts --exec \"npm run compile\"",
我的 package.json 脚本
"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"
},
更新:它以某种方式适用于 start 脚本,但不适用于 dev 脚本。此外,它还夺走了我的“开发”权力:(
【问题讨论】:
标签: node.js mongodb multer multer-s3