Condition: I'm working on Win10, TypeScript 1.8, and Visual Studio Code 1.0.0. I have code like
///<reference path = "./typings/lib.es6.d.ts" />
and, later
let z = "0".repeat(4 - str.length)
This is the let z
line.
VS Code put red underlines under "repeat" and reported
[ts] Property 'repeat' does not exist on type 'string'.
I compiled at the command line with
tsc <filename>.ts
Pointing at the start of repeat
in the let z
line, the compiler reported
error TS2339: Property 'repeat' does not exist on type 'string'.
Beggin' to differ, TypeScript, but that was added with ES2015 (ES6).
Question: How can I get a clean compile?
EDITS: Shortened.
In my case, I only changed this line on tsconfig.json
file:
Before:
"compilerOptions": {
"target": "es5"
}
After:
"compilerOptions": {
"target": "es6"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With