Typescript 如何使用泛型参数装饰器

Typescript 如何使用泛型参数装饰器,typescript,Typescript,我想根据方法参数的类型声明decorator的参数 我试过: function someDecorator<T> (someParam: T){ return (target: any, methodName: string, paramIndex: number) => { }; } class SomeClass{ someMethod (@someDecorator("asd"/** it should be error **/) id:

我想根据方法参数的类型声明decorator的参数

我试过:

function someDecorator<T> (someParam: T){
  return (target: any, methodName: string, paramIndex: number) => {
  };
}

class SomeClass{
  someMethod (@someDecorator("asd"/** it should be error **/) id: number){
  }
函数someDecorator(someParam:T){
return(target:any,methodName:string,paramIndex:number)=>{
};
}
上课{
someMethod(@someDecorator(“asd”/**应该是错误**/)id:number){
}
但似乎“T”总是有意义的

这是一项工作:

class SomeClass{
  someMethod (@someDecorator<number>(1) id: number){
  }
}
class-SomeClass{
someMethod(@someDecorator(1)id:number){
}
}
但是有没有不添加类型的方法呢?没有方法获得装饰器所在的类型吗