Whenever I apply a decorator to a get accessor in my TypeScript code, everything compiles fine but at runtime I consistently encounter the error message:
Uncaught TypeError: Invalid property descriptor. Cannot specify both accessors and a value or writable attribute
What causes this issue and how can I resolve it? Just to clarify, I am using only a getter and not a setter.
Here is an example of my code:
class ThingBox {
private things = [1,2,3,4,5]
@MyDecorator
get totalTings(): number { return this.things.length }
}