Typescript error TS1005: ';' expected but I don't see where I'm missing a semicolon

Is that everything you have in your ts file? Or do you have some reference comments in there too?

That error doesn't complain about missing semicolon, as TypeScript doesn't require you to use them at all, just like JS in that regard.

The error you're getting instead is because something else didn't make sense to the compiler, like a declaration that didn't end properly. ( see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/4004 ). For example:

let deck: Number of Date;

Will produce that exact error.

Depending on your setup you might be compiling more than you might think.

In your case since your compiler is so old, it might just be that it doesn't understand the keyword let which was introduced in TS 1.4.

UPDATE

To clarify, the command you used to install typescript installed latest. But in order to use it, you need to run node.js command prompt instead of the normal Windows command prompt, assuming you are on Windows.


when you install tsc maybe you used npm install tsc -g

Following this link: https://www.npmjs.com/package/tsc this package where discontinued.

Now you should use npm install typescript -g then you will have the newer version.

Today tsc -v return Version 2.8.1

With newer version you do not will get ts1005

Tags:

Typescript