使用 v0.68.0 , defaultProps 似乎不受控制:
以下代码(来自 official doc)在声明“foo”defaultProp(作为字符串而不是数字)时不会引发错误:
// @flow
import * as React from "react";
type Props = {
foo: number,
};
class MyComponent extends React.Component<Props> {
static defaultProps = {
foo: 'bad string',
};
}
(参见 TryFlow example)
有什么想法吗? 谢谢
最佳答案
关于javascript - 流(flowtype)和 react : defaultProps are not controlled?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49372481/