gpt4 book ai didi

typescript - Webstorm、TypeScript、Angular2、Transpiler、重复标识符错误消息

转载 作者:太空狗 更新时间:2023-10-29 18:02:48 32 4
gpt4 key购买 nike

操作系统:Windows Pro 10
Webstorm:ver 11.0.1
AngularJS:ver 2.0.0-alpha.46

WebStorm 设置

  1. 工具 – 文件观察器:Babal

  2. 语言和框架 – JavaScript:
    JavaScript 语言版本:ECMAScript 6

  3. 语言和框架 – TypeScript:
    启用 TypeScript 编译器(选中):
    使用 tsconfig.json(选中)

项目结构:

- bin
- node_modules/angular2
- src/tsconfig.json
- package.json

Package.json

{
"name": "TypeScriptHTMLApp2",
"version": "1.0.0",
"dependencies": {
"angular2": "2.0.0-alpha.46",
"es6-shim": "^0.33.13",
"systemjs": "0.19.6"
},
"devDependencies": {
"babel-preset-es2015": "^6.3.13"
}
}

tsconfig.json

{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules"
]
}

注意:webstorm 项目窗口中的 node_modules 文件夹,也已设置为“排除”。

因此 webstorm 抛出以下重复标识符错误消息:

C:\Program Files (x86)\JetBrains\WebStorm 11.0.1\plugins\JavaScriptLanguage\typescriptCompiler\external\lib.es6.d.ts
Error:(3841, 14) TS2300: Duplicate identifier 'PropertyKey'.
Error:(4034, 5) TS2300: Duplicate identifier 'EPSILON'.
Error:(4069, 5) TS2300: Duplicate identifier 'MAX_SAFE_INTEGER'.
Error:(4076, 5) TS2300: Duplicate identifier 'MIN_SAFE_INTEGER'.
Error:(4362, 5) TS2300: Duplicate identifier 'done'.
Error:(4363, 5) TS2300: Duplicate identifier 'value'.
Error:(4592, 5) TS2300: Duplicate identifier 'flags'.
Error:(4620, 5) TS2300: Duplicate identifier 'size'.
Error:(4630, 5) TS2300: Duplicate identifier 'prototype'.
Error:(4647, 5) TS2300: Duplicate identifier 'prototype'.
Error:(4659, 5) TS2300: Duplicate identifier 'size'.
Error:(4669, 5) TS2300: Duplicate identifier 'prototype'.
Error:(4685, 5) TS2300: Duplicate identifier 'prototype'.
Error:(5072, 5) TS2300: Duplicate identifier 'prototype'.
C:\Users\Theo\Documents\WebStorm\Projects\TypeScriptHTMLApp2\TypeScriptHTMLApp2\node_modules\angular2\typings\es6-shim\es6-shim.d.ts
Error:(6, 14) TS2300: Duplicate identifier 'PropertyKey'.
Error:(9, 5) TS2300: Duplicate identifier 'done'.
Error:(10, 5) TS2300: Duplicate identifier 'value'.
Error:(248, 5) TS2300: Duplicate identifier 'EPSILON'.
Error:(283, 5) TS2300: Duplicate identifier 'MAX_SAFE_INTEGER'.
Error:(290, 5) TS2300: Duplicate identifier 'MIN_SAFE_INTEGER'.
Error:(346, 5) TS2300: Duplicate identifier 'flags'.
Error:(498, 5) TS2300: Duplicate identifier 'prototype'.
Error:(561, 5) TS2300: Duplicate identifier 'size'.
Error:(570, 5) TS2300: Duplicate identifier 'prototype'.
Error:(581, 5) TS2300: Duplicate identifier 'size'.
Error:(590, 5) TS2300: Duplicate identifier 'prototype'.
Error:(605, 5) TS2300: Duplicate identifier 'prototype'.
Error:(619, 5) TS2300: Duplicate identifier 'prototype'.

我该如何解决这个问题?

提前致谢

最佳答案

当两个文件都在编辑器中打开时会发生这种情况。如果您关闭其中一个文件,错误就会消失...

看这里:Webstorm marks duplicate identifier error for variables from separate files

关于typescript - Webstorm、TypeScript、Angular2、Transpiler、重复标识符错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34198676/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com