[英]tsconfig.json is apparently being ignored?
我需要帮助了解为什么我的tsconfig.json被忽略了吗? tsconfig.json的目标是es5
,但我仍然收到此错误?
我有以下目录:
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"
]
}
当我运行tsc test.ts
我得到:
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.
当您运行tsc filename.ts
编译指定文件时, tsconfig.json
将被忽略。 请参考这个问题 。
可以使用tsc
代替tsc filename
,这将始终获得tsconfig.json
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.