InstanceType<Type>

Extracts the type of an instance created by a constructor function or class.

It is useful for inferring the result of new MyClass(), especially when you are working with arbitrary classes.

This is useful in real situations where you want to dynamically create a class.

Also works with constructor functions.

Was this page helpful?