2016-12-06 56 views
0
` 
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" 
    ] 
} 

`打字稿2.1,browserify,角2種人失蹤類型

我運行腳本 tsc index.ts > ts.js && browserify ts.js > bundle.js

和打字稿編譯器有各種投訴:

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'. 

和各種其他。

回答

0

通過將 import "./node_modules/@types/es6-shim"加到我的index.ts