I've been trying to understand if there is any difference between using InstanceType to assign a type, or simply using the Class name.
In particular, given the class:
MyClass {
public static foo: string = 'abc'
public makeFoo() {
// awesome maker
}
}
When I want to use an instance of the class, it seems that there is no difference between:
// inside some other Class
private myClassInstance: InstanceType<typeof MyClass>
...
this.myClassInstance = new MyClass()
and
// inside some other Class
private myClassInstance: MyClass
...
this.myClassInstance = new MyClass()
At least in VSCode I don't get any visible difference in using any of the two. However I guess a difference must exist, if TS has implemented InstanceType<>.
Anyone knows if there is a difference?