vendredi 8 septembre 2023

How to apply a decorator to existing class

I have class A in external package

class A {
  mess: string;
}

And my method Decorator

function test(target: any, propertyKey: string, descriptor: PropertyDescriptor) {
  target.propertyKey = 'test';
};

I want to apply my decorator test to class A, but I can't get reflection of class A to apply

test(reflectionOfClassA, attributeKey)

How do I get reflection of class A? I can't update code of class A, because it is imported from other package





Aucun commentaire:

Enregistrer un commentaire