Category Archives: angular

Angular 2 version 2-1-1 PhpStorm/Webstorm Typescript compile error

Making the jump to Angular 2 version 2.1.1 is pretty straight forward, all was fine when testing the quickstart using the npm lite server, went to run it in PhpStorm/Webstorm and got so many errors:

node_modules\@angular\common\src\directives\ng_class.d.ts
Error:(46, 34) TS2304: Cannot find name 'Set'.
node_modules\@angular\common\src\pipes\async_pipe.d.ts
Error:(44, 38) TS2304: Cannot find name 'Promise'.
\node_modules\@angular\core\src\change_detection\differs\default_keyvalue_differ.d.ts
Error:(24, 15) TS2304: Cannot find name 'Map'.

Like most things this is an easy fix, this one is caused by an out dated Typescript compiler which some lazy Google Fu brought to my attention see here.

Install type script compiler using npm

npm install -g typescript 

When you run the above command it will tell you the path it has downloaded to, for example:

C:\Users\_usr_\AppData\Roaming\npm\node_modules\typescript\bin\tsc

Then set PhpStorm/Webstorm to use the compiler.

I mainly threw this in a post to note that the tsc files have been moved to the “lib” folder, you will need to link to that rather than “bin”.

File>Settings>Language & Frameworks>Typescript

Set typescript version to the path we created and save, if your not sure where it went run the npm command again.

typescript_setcustom

All done! you should be fine to compile Angular 2.1.1 now.

Angular version: 2.1.1

Typescript version: 2.0.8

Previous Typescript version: 1.8.10