"Expected Application or Application" Error in Angular2 (or TypeScript)

I am completely new to Angular2 and TypeScript. I follow the tutorial, but I continue to cope with this error. Is this a bug caused by the compiler or something else?

enter image description here

+7
angular typescript
source share
2 answers

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

You need to download and install TypeScript 1.5 beta (or later) in order to use ES6 style import and annotations.

You can check the version that you just installed using:

tsc --version 

It should give you Version 1.5.0-beta .

If you already installed it, your PATH variable may still point to the old folder, so change the PATH variable to the most recent folder, i.e.

 C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.5\; 
+12
source share

Since you did not 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 the following:

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

Command line options:

-m amd -t ES5

Compiler Versions:

/ Usr / local / library / node_modules / typescript / library

That way, it will capture your global typescript instead of having one Webstorm set for you by default.

+3
source share

All Articles