[英]Typescript 2.1, browserify, Angular 2 Missing Types
`
vscode 1.7
Typescript 2.1.1
Angular 2 latest
package.json
"dependencies": {
"@angular/common": "^2.2.4",
"@angular/compiler": "^2.2.4",
"@angular/core": "^2.2.4",
"@angular/platform-browser": "^2.2.4",
"@angular/platform-browser-dynamic": "^2.2.4",
"@angular/router": "^3.2.4",
"@types/angular2": "0.0.2",
"@types/systemjs": "^0.19.32",
"angular2": "^2.0.0-beta.17",
"browserify": "^13.1.1",
"es6-shim": "^0.35.1",
"plugin-typescript": "^5.3.1",
"reflect-metadata": "^0.1.2",
"rxjs": "^5.0.0-beta.6",
"systemjs": "^0.19.41",
"tsify": "^2.0.3",
"typescript": "^2.1.1",
"zone.js": "^0.6.12"
}
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"removeComments": true,
"preserveConstEnums": true,
"experimentalDecorators": true,
"sourceMap": true,
"target": "es6",
"allowJs": true
},
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}
` `
I'm running the script tsc index.ts > ts.js && browserify ts.js > bundle.js
我正在运行脚本
tsc index.ts > ts.js && browserify ts.js > bundle.js
and the typescript compiler has various complaints: 打字稿编译器有很多抱怨:
node_modules/@angular/compiler/src/compile_metadata.d.ts(369,30): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/directive_normalizer.d.ts(38,72): error TS2304: Cannot find name 'Promise'.
and various others. 和其他各种。
通过将import "./node_modules/@types/es6-shim"
添加到我的index.ts中来解决
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.