I've made custom property decorator:
export function Attr(label: MemberInfo) {
return function (target: any, key: any) {
if (!target.params) {
target.params = [];
}
label.name = key;
target.params.push(label);
};}
So now, I am able to wrte, something like that:
@Attr{...}
test:any;
And then, some info about member test is added to array params. The problem is that I have few levels of inheritance, and the target, passed to function decorator is always parent of particular class, i.e I would like to have such a structure:
classA -> ClassB
classA -> ClassC
ClassA is base class of classB and ClassC. ClassB and ClassC are inheriting array params from base class. Base classA adds some decorators, and that's what should be visible to both subclasses. The problem is that when I use decorator in ClassB an ClassC, everything is added to array params from base class.
As I understand inheritance, both classed have another "copy" of array params. What can I do to separate those two classes arrays, but still use core of params, declared in base class? Please help me :)