type someType = {
keyOne: string,
keyTwo: string,
};
type someOtherType = {
keyOne: string,
keyTwo: string,
keyThree: string,
};
这些类型的两个创建的流类型是包含keyOne
和keyTwo
,唯一的区别是后者延伸前者与keyThree
额外密钥对象。流速:由延伸的另一类型
而不是编写重复代码,是否可以通过扩展someType
来构建someOtherType
流类型?在我看来,ES6对象休息/传播浮现在脑海,但我不知道如何在Flow中完成这样的事情。
谢谢!
的可能的复制[流动型:类型继承(A类型是B型的一个子集...)](http://stackoverflow.com/questions/42281539/flowtype-inheritance-of-types- type-a-is-a-subset-of-b) –
很酷,感谢您的链接。 –