に「必要」私は私の角度のプロジェクト内のすべての活字体をコンパイルしていますが、私はよく知られてエラーを取得しています:エラーTS2300:重複識別子が活字体のコンパイル処理
error TS2300: Duplicate identifier 'require'.
は、しかし、この問題を持っているほとんどの人はに実行されています重複エラーの原因となる2つのファイルがあるためです。私の場合は、と同じファイルでは、単語「requires」が2回使用されているためです。
/typings/globals/angular/index.d.ts(1707,9):
と
/typings/globals/angular/index.d.ts(1717,9):
それはDTソースから引かれているデフォルトの角度タイピング定義ファイルです。
私はTypeScriptをローカルにもグローバルにも持っています。私はローカルコピーを削除しようとしましたが、そのエラーはありません。ここに私のtsconfig.jsonは次のとおりです。
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true
},
"files": [
"typings/index.d.ts"
]
}
と私のtypings.json:
{
"globalDependencies": {
"angular": "registry:dt/angular#1.5.0+20160627014139",
"bootstrap": "registry:dt/bootstrap#3.3.5+20160619023404",
"jquery": "registry:dt/jquery#1.10.0+20160620094458"
}
}
そして最後に私のメインindex.d.ts:
/// <reference path="globals/angular/index.d.ts" />
/// <reference path="globals/bootstrap/index.d.ts" />
/// <reference path="globals/jquery/index.d.ts" />