我正在运行“tsc”并收到以下错误
typings/browser/ambient/es6-shim/index.d.ts(554,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'any', but here has type 'PromiseConstructor'.
typings/globals/require/index.d.ts(367,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'require' must be of type 'NodeRequire', but here has type 'Require'.
打字.json
{
"ambientDependencies": {
"es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654",
"jasmine": "registry:dt/jasmine#2.2.0+20160412134438"
},
"dependencies": {
"requirejs": "registry:npm/requirejs#2.2.0+20160319062357"
}
}
包.json
"dependencies": {
"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"@angular/platform-browser": "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"@angular/router": "2.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.1",
"@angular/upgrade": "2.0.0-rc.1",
"angular2-in-memory-web-api": "0.0.7",
"bootstrap": "^3.3.6",
"es6-shim": "^0.35.0",
"express": "^4.13.4",
"promise": "^7.1.1",
"reflect-metadata": "^0.1.3",
"request": "^2.72.0",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.27",
"xml2js": "^0.4.16",
"zone.js": "^0.6.12"
},
最佳答案
我能够通过逐字编辑它并修改它提示的行来解决这个问题,但我确信这是一种解决方法,而不是正确的解决方法
typings/browser/ambient/es6-shim/index.d.ts 第 554 行让它输入任何 typings/globals/require/index.d.ts 第 367 行使其键入 NodeRequire
关于node.js - 编译 Node App 时出错 - 变量 'Promise' 的类型必须为 'any',但此处的类型为 'PromiseConstructor',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37398967/