9

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?

enter image description here

2 Answers 2

12

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

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

It should give you Version 1.5.0-beta.

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\;
Sign up to request clarification or add additional context in comments.

3 Comments

I was having the same issue. Switching to the new 1.5 beta release of tsc fixed it for me. @Chu Son, if this answer fixed your problem, you should select it as the accepted answer
You may also need to delete your old versions of TypeScript from the same directory Steve mentions above.
How to install the next version of tsc? tsc@next did not work!
3

Since you didn't accept the answer, I assume you are on OSx?

I had 2 instances of TS installed on my machine, I needed to point to the correct/newer one. Try this:

In Webstorm goto Preferences (Command + ,) -> Languages -> Typescript.

Command Line Options:

-m amd -t ES5

Compiler Versions:

/usr/local/lib/node_modules/typescript/lib

This way it will grab your global typescript instead of the one Webstorm may have set to default for you.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.