I have a method signature of execute
How do I get the name of the TResult type?
Example:
As far as I know it is not possible to get the name of TResult
, but if you provide the accordingly constructor function you can get the name.
Declaration:
execute<TResult>(ctor: { new (): TResult }) : <TResult> {
console.log(ctor.name) //Prints out SomeClass
return <any>null;
}
Usage:
execute<SomeClass>(SomeClass);