var*_*ump 3 inheritance typescript
Flow的概念是,您可以编写以下类型定义来引用从另一个类继承的类:
function getHouseClass(): Class<House> {}
这是指类,而不是类的实例。
Typescript中有类似的概念吗?
Class<House>
显然在TS中不起作用。
谢谢!
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;
Run Code Online (Sandbox Code Playgroud)
TypeScript
class Test {};
type TestType = typeof Test;
Run Code Online (Sandbox Code Playgroud)
The following should then be the same:
function getHouseClass(): typeof House { return House; }
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1007 次 |
最近记录: |