Flow has the concept that you can write the following type definition to refer to a class that inherits from another class:
function getHouseClass(): Class<House> {}
This refers to the class, not an instance of the class.
Is there a similar concept in Typescript?
Class<House> apparently doesn't work in TS.
Thanks!
I think @toskv is correct. If you look at this comparison between the two (below 'Accessing the type of a Class' headline):
Flow
class Test {};
type TestType = Class<Test>;
// This should be equivalent to (if you can confirm, please send a PR):
type TestType = typeof Test;
TypeScript
class Test {};
type TestType = typeof Test;
The following should then be the same:
function getHouseClass(): typeof House { return House; }
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With