[英]Flowtype Warning: This module only has a default export
I have a utils/index.js
file which looks something like this to give me quick access to all the utils within my app. 我有一个
utils/index.js
文件,看起来像这样,可以快速访问应用程序中的所有utils。
/**
* @providesModule utils
* @flow
*/
import isValidEmail from './isValidEmail';
import isWithinVersionRange from './isWithinVersionRange';
...more util functions
export {
isValidEmail,
isWithinVersionRange,
}
When I import one of these functions in another file like so... 当我将这些功能之一导入另一个文件时,就像这样...
import { isValidEmail } from 'utils';
Flow throws a warning saying This module only has a default export
. Flow发出警告,说
This module only has a default export
。
Am I doing something wrong? 难道我做错了什么?
I fixed this by changing my flow import to a capital and all references to it to a capital: 我通过将流导入更改为大写并将所有对它的引用更改为大写来解决此问题:
/**
* @providesModule Utils
* @flow
*/
And then did a find and replace for all 'utils'
-> 'Utils'
然后找到并替换所有
'utils'
-> 'Utils'
import { isValidEmail, isWithinVersionRange } from 'Utils';
Then my flow errors were gone and our functions were properly flow typed. 然后我的流程错误消失了,我们的函数被正确地按流程键入了。
If someone knows why , that'd interesting. 如果有人知道为什么 ,那会很有趣。 But here's the fix.
但是,解决办法就在这里。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.