為什么會出現此錯誤以及更多此類錯誤?我在下面添加了指向倉庫的鏈接以及關鍵代碼段。我認為我對依賴關系和“包含”鏈接的工作方式有一個基本的誤解。csvproc(master)> tscnode_modules/typescript/bin/lib.core.d.ts(83,5): error TS2300: Duplicate identifier 'configurable'.node_modules/typescript/bin/lib.core.d.ts(84,5): error TS2300: Duplicate identifier 'enumerable'.node_modules/typescript/bin/lib.core.d.ts(85,5): error TS2300: Duplicate identifier 'value'.node_modules/typescript/bin/lib.core.d.ts(86,5): error TS2300: Duplicate identifier 'writable'.所有代碼都可以在這里找到。我的tsconfig.json:{ "compilerOptions": { "module": "commonjs", "noImplicitAny": false, "outDir": "built/", "sourceMap": true, "target": "es5" }}我的tsd.json:{ "version": "v4", "repo": "borisyankov/DefinitelyTyped", "ref": "master", "path": "typings", "bundle": "typings/tsd.d.ts", "installed": { "node/node-0.10.d.ts": { "commit": "6387999eb899d0ba02d37dd8697647718caca230" }, "should/should.d.ts": { "commit": "e1182d56ccb192379eade6055d9ba3fb6a0bacc4" } }}我的tsd.d.ts:{ "version": "v4", "repo": "borisyankov/DefinitelyTyped", "ref": "master", "path": "typings", "bundle": "typings/tsd.d.ts", "installed": { "node/node-0.10.d.ts": { "commit": "6387999eb899d0ba02d37dd8697647718caca230" }, "should/should.d.ts": { "commit": "e1182d56ccb192379eade6055d9ba3fb6a0bacc4" } }}
3 回答

肥皂起泡泡
TA貢獻1829條經驗 獲得超6個贊
Typings的1.0版更改了輸出結構,以下答案與1.0版之前的版本有關。
如果您使用的是Typings并排除在tsconfig.json中,則可能會遇到重復類型的問題,并且需要以下內容:
{
"exclude": [
"typings/browser.d.ts",
"typings/browser",
"node_modules"
]
}
為了簡化與TypeScript的集成,將生成兩個文件-鍵入/main.d.ts和鍵入/browser.d.ts-引用項目中安裝的所有鍵入,一次只能使用其中一個。
因此,根據所需的版本,應排除(或包括)“瀏覽器”或“主”類型的文件,但不能同時包括兩者,因為這是重復項的來源。

眼眸繁星
TA貢獻1873條經驗 獲得超9個贊
解決問題的方法很簡單:
刪除
node_modules
文件夾運行
npm install
以獲取所有具有正確版本的軟件包
就我而言,問題是在更改Git分支后發生的,其中一個新分支正在使用一組不同的節點模塊。舊分支使用TypeScript v1.8,新分支使用v2.0
添加回答
舉報
0/150
提交
取消