小编Som*_*kar的帖子

../@types/mongodb/index.d.ts:35:18 - 错误 TS2724:“bson”没有名为“ObjectID”的导出成员。您指的是“ObjectId”吗?

出现此错误。我的打字稿版本是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)

types mongoose mongodb bson

6
推荐指数
1
解决办法
2703
查看次数

猫鼬命名空间没有导出成员“OptionalId”

运行 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 。

mongoose mongodb node.js

4
推荐指数
1
解决办法
1759
查看次数

标签 统计

mongodb ×2

mongoose ×2

bson ×1

node.js ×1

types ×1