TS1056
Accessors are only available when targeting ECMAScript 5 and higher.
Broken Code ❌
class User {
constructor(
private firstName: string,
private lastName: string
) {}
get fullName() {
return `${this.firstName} ${this.lastName}`;
}
}{
"compilerOptions": {
"target": "es3"
}
}Fixed Code ✔️
Set the "target" property in your "tsconfig.json" file to "es5" or higher:
{
"compilerOptions": {
"target": "es5"
}
}