Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

typeScript error 'module, class, interface, enum, import or statement' expected

I'm trying to understand why this line invokes an error:

const value = 20 * 30;

error TS1008: Unexpected token; 'module, class, interface, enum, import or statement' expected.

any idea?

like image 495
Dusty Avatar asked Dec 19 '22 21:12

Dusty


1 Answers

Here is the solution:

Earlier on my machine I had installed Visual Studio 2015 Pro Edition. that had installed TypeScript 1.0.3.0. and added its path to system environment.

Now I used npm install -g TypeScript and it did install, however from command line, typing tsc --version was always giving 1.0.3.0.

I removed the older path from environment and then restarted code and it worked fine.

Better you check your versions and the solution might help.

like image 142
ZAFMA Avatar answered Dec 21 '22 09:12

ZAFMA