我试图在React中使用flow,但发现了一些奇怪的行为,如果我尝试将React中的HTMLProps包含到组件Props类型中,则会抛出错误“无法获取React.HTMLProps,因为模块中缺少属性HTMLProps”
零件:
const Row = (
{
jc,
ai,
children,
...rest
}: RowProps & React.HTMLProps<HTMLDivElement>
) => (
<RowW
justifyContent={jc}
alignItems={ai}
{...rest}>
{children}
</RowW>
)
Flow的错误:
Cannot get React.HTMLProps because property HTMLProps is missing in module react [1].
[1] 2│ import * as React from 'react'
:
21│ ai,
22│ children,
23│ ...rest
24│ }: RowProps & React.HTMLProps<HTMLDivElement>
25│ ) => (
26│ <RowW
27│ justifyContent={jc}
我怎么能告诉Flow我想要传递给这个组件任何'div'元素的支柱?