如何使用第三方.flow文件?

Zac*_*olf 5 javascript reactjs flowtype

我正在努力将添加到React.js应用程序.我使用flow-typed来添加几个包,这似乎是有效的.

这个问题是我使用的是Material-UI测试版.他们没有流式输入的回购,但他们确实提供了Component.js.flow文件.

但是,我收到此错误:

Error: src/NotFound/NotFound.js:6
  6: import Button from 'material-ui/Button'
                        ^^^^^^^^^^^^^^^^^^^^ material-ui/Button. Required module not found

Error: src/NotFound/NotFound.js:8
  8: import { withStyles } from 'material-ui/styles'
                                ^^^^^^^^^^^^^^^^^^^^ material-ui/styles. Required module not found
Run Code Online (Sandbox Code Playgroud)

我的.flowconfig:

[ignore]
<PROJECT_ROOT>/node_modules/.*
<PROJECT_ROOT>/build/.*
<PROJECT_ROOT>/scripts/.*
<PROJECT_ROOT>/coverage/.*
<PROJECT_ROOT>/config/.*
.*\.test\.js

[include]

[libs]
<PROJECT_ROOT>/flow-typed/.*

[lints]

[options]
emoji=true
Run Code Online (Sandbox Code Playgroud)

我在支持论坛中尝试了几种解决方案,但我仍然不了解如何连接它.

重要包装版本:

react@15.5.4
material-ui@1.0.0-beta.8
flow-bin@0.54.0
Run Code Online (Sandbox Code Playgroud)

Ros*_*mon 2

Flow 认为不material-ui存在,因为您明确忽略node_modules.flowconfig. [ignore]删除( )下的第一行<PROJECT_ROOT>/node_modules/.*,您就可以开始了。

请注意,其他一些库可能会导致流量问题。您应该选择性地忽略这些库,而不是一揽子忽略所有第 3 方库。