Home:ALL Converter>What is the type of a type in Typescript

What is the type of a type in Typescript

Ask Time:2017-06-14T17:40:00         Author:raduw

Json Formatter

Here's a valid typescript snippet:

class A{
}

// what is the type of x ?  i.e. f( x: <TYPE HERE>)...
function f(x) {
    return new x();
}

const t = f(A);

It is obvious that the type of x is the type of the constructor function but it is not clear to me how one would specify it in Typescript.

Is it possible to type the parameter x ?

If yes, what is the type?

Author:raduw,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/44540994/what-is-the-type-of-a-type-in-typescript
yy