【发布时间】:2019-05-11 17:25:43
【问题描述】:
这是我的代码。
class BaseClass {
// some static method
static someMethod() {
}
}
class ChildClass extends BaseClass{
}
class AnotherClass {
protected variable: BaseClass; // It works while the type is any
protected someFunction() {
return this.variable.someMethod(); // Editor shows that there's no someMethod in BaseClass
}
}
问题是,我希望 AnotherClass 中的受保护变量存储类函数,而不是类实例。
有可能吗?
谢谢。
对不起,我的英语不好。
【问题讨论】:
标签: typescript