"宣言或声明预期"在Angular2(或打字稿)错误 [英] "Declaration or statement expected" Error in Angular2 (or TypeScript)

查看:152
本文介绍了"宣言或声明预期"在Angular2(或打字稿)错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是完全新的Angular2和打字稿。我下面的教程,但我一直应对这个错误。它是引起编译或什么错误?

I'm completely new to Angular2 and TypeScript. I'm following Tutorial but I keep coping this error. Is it an error caused by the compiler or something?

推荐答案

看起来你正在使用的编译器的早期版本。

It looks like you are using an older version of the compiler.

您需要下载并安装<一href=\"https://visualstudiogallery.msdn.microsoft.com/107f89a0-a542-4264-b0a9-eb91037cf7af\">TypeScript为了使用ES6风格的进口和注解1.5 Beta版(或更新版本)。

You need to download and install the TypeScript 1.5 beta (or newer) in order to use ES6 style imports and annotations.

您可以检查您目前已经使用安装的版本:

You can check the version you currently have installed using:

tsc --version

这应该给你版本1.5.0-β

如果您已经安装它,也许你的 PATH 变量仍然指向旧的文件夹,所以编辑PATH变量指向最新的文件夹,即

If you already have it installed, perhaps your PATH variable still points to the old folder, so edit your PATH variable to point to the latest folder, i.e.

C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.5\;

这篇关于&QUOT;宣言或声明预期&QUOT;在Angular2(或打字稿)错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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