Reputation: 804
I am studying typescript and I'm trying to create a simple let and it won't work because it says I need to use ECMA6 or higher. This is is the error message I'm getting in the typescript compiler:
Error:(11, 5) TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher.
And this is the code:
class website{
url:string;
facebookLikes:number;
}
let google = new website();
google.url = "google.com";
google.facebookLikes = 23124;
I searched online and I found an answer that says to go to settings and langauges and frameworks and go to javascript and change it to EcmaScript6. I done this but I still get the same error.
If anyone can shed some light on this I would really appreciate it. Thanks.
Upvotes: 0
Views: 472
Reputation: 164367
You need to use the ES6
target just as the error suggests.
I don't know how you compile your typescript files, if it's using the builtin compiler or a file watcher, but in any case the compiler options have the target property which should be ES6
if you want to use let
(and other es6 features).
If for example you are using tsconfig.json
then it should look like this:
{
"compilerOptions": {
"target": "ES6",
...
}
}
Upvotes: 3