TS2663
error TS2663: Cannot find name ‘
firstName
‘. Did you mean the instance member ‘this.firstName
‘?
Broken Code ❌
1 |
|
Fixed Code ✔️
If you want to use a getter, you need to back it up with a private property:
1 |
|
Starting from TypeScript 4.9, you can also use an auto-accessor field:
1 |
|