出现此错误。我的打字稿版本是4.5.4和“@types/mongodb”:“〜3.3.1”,“@types/mongoose”:“〜5.5.17”。知道如何解决
../@types/mongodb/index.d.ts:49:74 - error TS2724: '"bson"' has no exported member named 'ObjectID'. Did you mean 'ObjectId'?
49 export { Binary, DBRef, Decimal128, Double, Int32, Long, MaxKey, MinKey, ObjectID, ObjectId, Timestamp } from 'bson';
~~~~~~~~
../bson/bson.d.ts:939:22
939 export declare class ObjectId extends BSONValue {
~~~~~~~~
'ObjectId' is declared here.
Run Code Online (Sandbox Code Playgroud) 运行 npm i 时出现此错误。
../@types/mongoose/index.d.ts:191:17 - 错误 TS2694: 命名空间 '"/Users/test-service/node_modules/@types/mongodb/index"' 没有导出成员 'OptionalId' ?mongodb.OptionalId & { _id: TId }>
我正在使用“@types/mongoose”:“^5.5.32”,“@types/mongodb”:“~3.3.1”。有人可以帮我解决这个问题。我的 tsc 版本是 Version 3.8.3 。