WebStorm 2016.1中的TypeScript转换

时间:2016-04-21 20:23:40

标签: typescript webstorm

升级到WebStorm 2016.1后,我的TypeScript转换将所有import语句更改为不同的语句。继续收到JS错误'要求未定义'。

TS档案:

    import {bootstrap} from 'angular2/platform/browser';
    import {ROUTER_PROVIDERS} from 'angular2/router';
    import {AppComponent} from './application/app.component'
    import {HTTP_PROVIDERS} from "angular2/http";
    import {Observable} from 'rxjs/Rx';

    bootstrap(AppComponent, [ROUTER_PROVIDERS, HTTP_PROVIDERS, Observable]);

WebStorm 11转换版本:

System.register(['angular2/platform/browser', 'angular2/router', './application/app.component', "angular2/http", 'rxjs/Rx'], function(exports_1) {
    var browser_1, router_1, app_component_1, http_1;
    return {
        setters:[
            function (browser_1_1) {
                browser_1 = browser_1_1;
            },
            function (router_1_1) {
                router_1 = router_1_1;
            },
            function (app_component_1_1) {
                app_component_1 = app_component_1_1;
            },
            function (http_1_1) {
                http_1 = http_1_1;
            },
            function (_1) {}],
        execute: function() {
            browser_1.bootstrap(app_component_1.AppComponent, [router_1.ROUTER_PROVIDERS, http_1.HTTP_PROVIDERS]);
        }
    }
});

WebStorm 2016.1已编译版本:

"use strict";
var browser_1 = require('angular2/platform/browser');
var router_1 = require('angular2/router');
var app_component_1 = require('./application/app.component');
var http_1 = require("angular2/http");
var Rx_1 = require('rxjs/Rx');
browser_1.bootstrap(app_component_1.AppComponent, [router_1.ROUTER_PROVIDERS, http_1.HTTP_PROVIDERS, Rx_1.Observable]);

tsconfig.json文件:

{
  "compilerOptions": {
    "target": "ES5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors":true
  },
  "exclude": [
    "node_modules",
    "bower-components"
  ]
}

TypeScript编译器设置为使用我的TypeScript npm包而不是捆绑的包。

0 个答案:

没有答案