类装饰器
function age(args:number = 0) {return function (target:Function):void {target.prototype.age = args;}}@age(2)class Hello{public name:string;;constructor(){this.name = 'name';}}const hello1 = new Hello();console.log(hello1.name);console.log(hello1.age); // 2
