I am writing a Vanilla Typescript Program, as shown below
class DecoratorClass{
@HelloWorld
public property1:string="Siddu Rocks"
}
function HelloWorld(target:any,propertyName:string){
console.log("The Class Target and prop names are:"+target[propertyName] + "," +
propertyName)
}
I am getting the output as The Class Target and prop names are:undefined,property1 instead of The Class Target and prop names are: Siddu Rocks,property1
Why I am getting the property value as undefined, Is there anything I am missing here? I tried checking multiple blogs but no avail
Kindly help me
Property decorators are modifying the class not the instance. So property1 is not set at the time
HelloWorldis called.