My code is similar to the following scenario, where I am attempting to replace a property based on a decorator
export function DecorateMe() {
return function(component: any, propertyKey: string) {
Object.defineProperty(component, propertyKey, {
get: () => {
...
},
set: (value: boolean) => {
...
}
});
};
}
class Parent {}
@Component()
class Child extends Parent {
@DecorateMe()
public property: string;
}
However, during runtime, I am observing that property
is being defined as normal, thus hiding the added get/set
methods in the prototype.
Based on resources like the TypeScript documentation and this tutorial, I was under the impression that this should work.
Since I am using Angular, I am uncertain if that could be a contributing factor influencing the behavior.