functiontestDecorator(){returnfunction<Textendsnew(...args:any[])=>any>(constructor:T){returnclassextends constructor {
name ='lee';// 装饰后就更改了之前的name值getName(){returnthis.name;}};};}// 变相的装饰器这样的装饰器可以有提示const Test =testDecorator()(class{
name:string;constructor(name:string){this.name = name;}});const test =newTest('dell');console.log(test.getName());// lee