AngularJS 2.0 TypeScript Intellij想法(或webstorm) - ES6导入语法 [英] AngularJS 2.0 TypeScript Intellij idea (or webstorm) - ES6 import syntax

查看:198
本文介绍了AngularJS 2.0 TypeScript Intellij想法(或webstorm) - ES6导入语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试执行这些步骤以使 AngularJS 2.0示例应用运行。

Trying to make these steps to make AngularJS 2.0 sample app running.

在该步骤中,将代码放入app.ts:

On that step, putting code in app.ts:

/// <reference path="typings/angular2/angular2.d.ts" />
import {Component, View, bootstrap} from 'angular2/angular2';

得到最新的14.1.3 IntelliJ IDE

Got latest 14.1.3 IntelliJ IDE.

但似乎不理解'import'(突出显示抱怨)

But seems it does not understand 'import' (highlighting complain)

问:那是因为它还不支持TypeScript 1.5吗? (它的IDE设置我可以看到嵌入式1.4版本)。
可以用那个IDE编译吗?

Q: IS that because It does not support yet TypeScript 1.5? (it the IDE settings I can see embedded 1.4 version). Could it be compiled with that IDE?

推荐答案

看起来你没有指定编译器参数来告诉要使用哪个模块加载器,还要确保使用最新的TypeScript编译器,到目前为止最新版本为1.5.0 beta。

it look like you didn't specify the compiler arguments to tell which module loader to use, also you want to make sure you are using the latest TypeScript Compiler, to this date the latest was 1.5.0 beta.

First

您可以在GitHub存储库中下载TypeScript编译器 tsc 的bin和所有其他相关文件:
https://github.com/Microsoft/TypeScript/tree/master/bin

You can download the bin of the TypeScript compiler tsc and all other related files on their GitHub Repository: https://github.com/Microsoft/TypeScript/tree/master/bin

或者您也可以将其安装为Node.js套餐:

or you can also install it as a Node.js Package:

npm install -g typescript

Second

您需要通过将编译器版本更改为自定义并指向最新TypeScript bin文件夹的位置来正确配置intelliJ

You need to configure intelliJ properly by changing the Compiler version to custom and point to the location of the latest TypeScript bin folder

Ctrl + Alt + S ,搜索 TypeScript ,然后在语言&框架选择TypeScript,确保您的IntelliJ是最新的。

in IntelliJ press Ctrl+Alt+S, search for TypeScript and under Languages & Frameworks select TypeScript, make sure your IntelliJ is up to date though.

要解决此问题,请在此处指定以下命令行选项:

And to solve the problem you are asking here specify the following Command Line options:

--module "amd" --target "es5"

屏幕截图:

第三次

它值得一提的是TypeScript 1.5编译器和Angular 2都处于测试阶段,所以这个答案可能在接下来的几个星期或几个月内无关紧要。

It is worth mentioning that the TypeScript 1.5 compiler and Angular 2 are both in Beta so this answer could be irrelevant in the following weeks or month.

享受!

Dany

这篇关于AngularJS 2.0 TypeScript Intellij想法(或webstorm) - ES6导入语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆