我正在使用react@16.0.0-beta.5和flow-bin@0.54.0
我正在尝试在此组件上应用flowtype
// @flow
class SomeIcon extends Component<{}> {
render() {
return (
<i>
<img src="" />
<span>Hello</span>
</i>
)
}
}
Run Code Online (Sandbox Code Playgroud)
而流量说
14: <i>
^^^ React element `i`
14: <i>
^^^ React children array. This type is incompatible with
children?: React$Node,
^^^^^^^^^^ union: undefined | null | boolean | number | string | type application of type `React$Element` | type application of identifier `Iterable`
Run Code Online (Sandbox Code Playgroud)
当我删除<span>标签中的<i>标签时,流程就可以了.但是如果我使用多个孩子,则流出错误.
问题是什么?
我发现了这个 .flowconfig
[libs]
./node_modules/immutable/dist/immutable.js.flow
Run Code Online (Sandbox Code Playgroud)
Immutable.js流类型定义Immutable.Iterable
与类型定义冲突
declare type React$Node = ... | Iterable<React$Node>
当我将Immutable.js更新为immutable@4.0.0-rc.2时,冲突已解决.
| 归档时间: |
|
| 查看次数: |
584 次 |
| 最近记录: |