类型定义文件中的Typescript编译错误

类型定义文件中的Typescript编译错误,typescript,typescript1.8,Typescript,Typescript1.8,我尝试将现有的ES6代码库迁移到TypeScript 1.8。为了平滑路径,我尝试应用以下typescript编译器设置: { "compilerOptions": { "target": "es6", "allowJs": true, "sourceMap": true, "jsx": "react", "outDir": "built" }, "exclude": [ "node_modules" ] } 在使用tsc编译之后

我尝试将现有的ES6代码库迁移到TypeScript 1.8。为了平滑路径,我尝试应用以下typescript编译器设置:

{
  "compilerOptions": {
    "target": "es6",
    "allowJs": true,
    "sourceMap": true,
    "jsx": "react",
    "outDir": "built"
  },
  "exclude": [
    "node_modules"
  ]
}
在使用
tsc
编译之后,我在类型定义文件中出现了大量编译错误

例如:

typings/main/definitions/sinon/sinon.d.ts(436,1): error TS2300: Duplicate identifier 'export='.
typings/main/definitions/sinon/sinon.d.ts(440,1): error TS2300: Duplicate identifier 'export='.
类型定义由
打字
维护


希望有人能给我一个提示,我的环境出了什么问题。

您这里的问题可能是sinon被包含了两次。原因是打字创建了
main.d.ts
browser.d.ts
并复制了一些文件。阅读更多关于这方面的内容

简言之,您要做的是将tsconfig更改为类似以下内容:

{
  "compilerOptions": {
    "target": "es6",
    "allowJs": true,
    "sourceMap": true,
    "jsx": "react",
    "outDir": "built"
  },
  "exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts"
  ]
}