小编ali*_*ana的帖子

错误 TS6200 和错误 TS2403:以下标识符的定义与另一个文件中的定义冲突

我正在尝试在打字稿中设置一个节点项目。

导致错误的两个文件:

  1. node_modules@types\mongoose\index.d.ts
  2. node_modules\mongoose\index.d.ts

[错误][1][1]:https://i.stack.imgur.com/46vDU.jpg

node_modules/@types/mongoose/index.d.ts:79:1 - 错误 TS6200:以下标识符的定义与另一个文件中的标识符冲突:DocumentDefinition、FilterQuery、UpdateQuery、NativeError、Mongoose、CastError、ConnectionOptions、Collection、Connection、断开连接、连接、连接、断开连接、未初始化、错误、QueryCursor、VirtualType、Schema、SchemaTypeOpts、Subdocument、Array、DocumentArray、Buffer、ObjectIdConstructor、Decimal128、Map、Aggregate、SchemaType、Document、ModelUpdateOptions

79 声明模块“猫鼬”{


node_modules/mongoose/index.d.ts:1:1
 1 declare module "mongoose" {
   ~~~~~~~
 Conflicts are in this file.

node_modules/@types/mongoose/index.d.ts:226:14 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'SchemaTypes' must be of type 'typeof Types', but here has type 'typeof Types'.

226   export var SchemaTypes: typeof Schema.Types;
                  ~~~~~~~~~~~



Run Code Online (Sandbox Code Playgroud)

mongoose node.js typescript

13
推荐指数
3
解决办法
4091
查看次数

标签 统计

mongoose ×1

node.js ×1

typescript ×1