我的流程代码如下所示。当我 flow check
我收到错误 1: const docs: Array<LeadDoc> = property docType of LeadDoc. Property not found in
Flow 尚不支持此功能吗?
export interface LeadDoc {
docType(): string;
}
class Foo {
docType(): string {
return 'foo';
}
}
const docs: Array<LeadDoc> = [
Foo,
];
最佳答案
docType
是 Foo
的实例的属性,但是[Foo]
是 Foo
的 statics 的单例数组。 [new Foo]
类型为Array<LeadDoc>
.
关于javascript - 如何获得正确检查类型所实现的接口(interface)的流程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37934633/