I'm trying to get the name type of a type given in a generic function.
This is for a nodeJS app.
I would like to do something like this:
static Get<T>(): string {
return typeof T;
}
But this exemple results as an error: "'T' only refers to a type, but is being used as a value here."
I would like "string" as a result if I call:
let strType: string = Get<string>();
stringwhereas my answer gives you the exact literal string type e.g.number,objectetc