Reputation: 5212
I need help in understanding why my tsconfig.json is being ignored? The tsconfig.json has a target of es5
and yet I'm still getting this error?
I have directory with the following:
test.ts
let passcode = "roscoes"
class Employee {
private _fullName: String
get fullName(): String {
return this._fullName
}
set fullName(newName: String) {
if (passcode && passcode === "roscoes") {
this._fullName = newName
} else {
console.log("Error: Not authorized ")
}
}
}
let employee = new Employee()
employee.fullName = "Johnny Appleseed"
if (employee.fullName) {
console.log(employee.fullName)
}
console.log('testing')
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"target": "es6"
},
"files": [
"./**/*.ts"
]
}
when I run tsc test.ts
I get:
test.ts(6,6): error TS1056: Accessors are only available when targeting ECMAScript 5 and
higher.
test.ts(10,6): error TS1056: Accessors are only available when targeting ECMAScript 5 an
d higher.
Upvotes: 4
Views: 1661