3

I upgraded my Angular version from version 2.4.0 to 4.0.0 while compiling, I am getting following errors.

enter image description here

How can I resolve those errors?

halfer
  • 19,824
  • 17
  • 99
  • 186
Pradeep
  • 5,101
  • 14
  • 68
  • 140

4 Answers4

2

For me, this problem was caused by The Visual Studio project file referencing the wrong TypeScript compiler version - see my answer at https://stackoverflow.com/a/43963664/236860 and Allen Conway's excellent post.

Community
  • 1
  • 1
Neilski
  • 4,385
  • 5
  • 41
  • 74
0

change the version of typescript to TypeScript 2.1.

This happens because there were breaking changes in typescript 2.1 Example :

declare const TEST_FIXTURE: string

now gets output as

declare const TEST_FIXTURE = "whatever";
Parth Ghiya
  • 6,929
  • 2
  • 30
  • 37
  • 2
    I'm having the same problem and I'm using typescript 2.2. What should I do ? – Frederico Jesus Apr 10 '17 at 19:18
  • 3
    I have the same issue. I am using Angular2 with typescript ^2.2.2 in Asp.net core. Any one with a suggestion will be appreciated. – Yoky Apr 11 '17 at 01:46
  • Strange...did you do a npm clean and install ?? Can you post the line which causes error. – Parth Ghiya Apr 11 '17 at 01:52
  • I'm also facing the same issue, here is detailed issue - http://stackoverflow.com/questions/43394163/error-in-ionic-build-android-initializers-are-not-allowed-in-ambient-contexts please any pointer – Rakesh Apr 13 '17 at 14:32
0

I have the same error. Global changes on TS version do not work, but when i change TS version to newest in devDependencies on package.json file, error goes away.

Kamil Naja
  • 6,267
  • 6
  • 33
  • 47
0

I had a similar problem. Just installing typescript solve the problem.

npm install -g typescript
Amit Kumar
  • 5,888
  • 11
  • 47
  • 85