Alberto Cruz Alberto Cruz - 6 months ago 37
TypeScript Question

TypeScript error: ';' expected when using "let" keyword

I'm taking my first steps into TypeScript and discovered

let
keyword, which I found very helpful.

However, TypeScript compiler throws
error TS1005: ';' expected.
when trying to compile the following code:

let one = 1;


The command I use to compile is
$ tsc file.tsc


Any help you can provide will be great!

Answer Source

You are using a really really old version of TypeScript (at least in TypeScript term of long) e.g. 1.0.1 will give that error as it does not understand let:

enter image description here

Plese use a newer TypeScript version e.g. 1.8

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download