TypeScript error TS1005: ';' expected (II)


First of all, I've already seen the other posts about error TS1005. Same error code, but totally different.

A simple let x: number; will generate the error TS1005 during compilation. It's not about a missing semicolon as what the error message says, but the compiler does not recognize the let keyword. I read that maybe because of an outdated compiler.

Here's my typescript version installed using npm install -g typescript

  • TypeScript version: 2.5.2
  • Compiler (tsc) version:

Maybe somebody can help?

This question is tagged with typescript

~ Asked on 2017-09-25 06:33:10

The Best Answer is


Your installation is wrong; you are using a very old compiler version (

tsc --version should return a version of 2.5.2.

Check where that old compiler is located using: which tsc (or where tsc) and remove it.

Try uninstalling the "global" typescript

npm uninstall -g typescript

Installing as part of a local dev dependency of your project

npm install typescript --save-dev

Execute it from the root of your project


~ Answered on 2017-09-25 07:24:16


On Windows you can have in your PATH

PATH = ...;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\; ...

remove it from PATH env, then

npm install -g [email protected]

it worked for me to solve the

"TypeScript error TS1005: ';' expected"

See also how to update TypeScript to latest version with npm?

~ Answered on 2017-12-24 12:20:22

Most Viewed Questions: