1
我在我的React项目中使用material-ui
。我正在尝试将Flow引入混音中。如何为从库导入的React组件添加定义
一个例子:
import Paper from 'material-ui/Paper';
type Props = {
ruleName: string,
rules: Object[],
actions: string[],
allowSubmit: boolean,
onSubmit: ?Function,
}
const NotifyRule = (props: Props) => (
<Paper style={{ padding: 10, width: '100%' }}>
....
</Paper>
);
我试着写了材料UI定义为
declare module 'material-ui' {
declare type Paper = any;
declare var exports: 'material-ui';
}
这是行不通的。我得到一个错误:
import Paper from 'material-ui/Paper'; ^^^^^^^^^^^^^^^^^^^ material-ui/Paper. Required module not found
解决,这将是非常有帮助的任何指针。
你在.flowconfig中指定了[libs]节吗? – Kafo
是的,我相信我有正确的库。 – sheki
你能发布更多的代码吗?任何与此有关的事情 – Kafo