The process of wrapping a class with a decorator causes superclasses to be unable to access that classes\' properties. Why?
I have some code that:
This is the more modern approach using the latest TS (3.2.4). The below also uses the decorator factory pattern so you can pass in attributes:
function DecoratorName(attr: any) {
return function _DecoratorName(constr: T){
return class extends constr {
constructor(...args: any[]) {
super(...args)
console.log('Did something after the original constructor!')
console.log('Here is my attribute!', attr.attrName)
}
}
}
}
See here for more info: https://www.typescriptlang.org/docs/handbook/decorators.html#class-decorators