首页 > 解决方案 > 流检查器还检查临时目录并抛出错误

问题描述

当我运行 flow 时,flow 还会检查 flow 生成的 tmp 文件夹,它会从 react-dom.js 抛出错误。错误看起来像这样

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ tmp/flowlib_235c5126/react-dom.js:181:31

KeyboardEvent [1] is incompatible with Event [2] in type argument E.

 [2] 118│ declare class SyntheticEvent<+T: EventTarget = EventTarget, +E: Event = Event> {
        :
     178│
     179│ declare class SyntheticKeyboardEvent<
     180│   +T: EventTarget = EventTarget,
 [1] 181│ > extends SyntheticUIEvent<T, KeyboardEvent> {
     182│   altKey: boolean;
     183│   charCode: number;
     184│   ctrlKey: boolean;


Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ tmp/flowlib_235c5126/react-dom.js:181:31

KeyboardEvent [1] is incompatible with Event [2] in type argument E.

 [2] 167│   +E: Event = Event,
        :
     178│
     179│ declare class SyntheticKeyboardEvent<
     180│   +T: EventTarget = EventTarget,
 [1] 181│ > extends SyntheticUIEvent<T, KeyboardEvent> {
     182│   altKey: boolean;
     183│   charCode: number;
     184│   ctrlKey: boolean;

我试图忽略 .flowconfig 中的 tmp 文件夹,但它不起作用

这是我的 .flowconfig

[ignore]
; We fork some components by platform
.*/*[.]android.js

.*/tmp/.*
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*

; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js

; Ignore polyfills
.*/Libraries/polyfills/.*

; Ignore metro
.*/node_modules/metro/.*

.*/node_modules/redux-persist/.*
.*/node_modules/react-navigation-redux-helpers/.*
.*/node_modules/react-native-linear-gradient/.*
.*/__tests__/.*

[untyped]
.*/node_modules/react-native/Libraries/react-native/react-native-implementation.js
.*/node_modules/react-native/Libraries/Utilities/differ/pointsDiffer.js
.*/node_modules/react-native/Libraries/Vibration/Vibration.js
.*/node_modules/react-native/Libraries/YellowBox/UI/YellowBoxInspectorHeader.js
.*/node_modules/react-native/Libraries/Utilities/Dimensions.js
.*/node_modules/react-native/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.j
.*/node_modules/react-native/Libraries/Utilities/differ/insetsDiffer.js
.*/node_modules/react-native/Libraries/Lists/VirtualizedList.js
.*/node_modules/react-native/Libraries/Alert/Alert.js
.*/node_modules/react-native/Libraries/Animated/src/Animated.js
.*/node_modules/react-native/Libraries/Animated/src/AnimatedEvent.js
.*/node_modules/react-native/Libraries/Animated/src/AnimatedImplementation.js
.*/node_modules/react-native/Libraries/Animated/src/Easing.js
.*/node_modules/react-native/Libraries/Animated/src/bezier.js
.*/node_modules/react-native/Libraries/Animated/src/nodes/AnimatedProps.js
.*/node_modules/react-native/Libraries/Components/RefreshControl/RefreshControl.js
.*/node_modules/react-native/Libraries/Components/ScrollView/ScrollView.js
.*/node_modules/react-native/Libraries/Linking/Linking.js
.*/node_modules/react-native/Libraries/Lists/ListView/ListView.js
.*/node_modules/react-native/Libraries/Lists/MetroListView.js
.*/node_modules/react-native/Libraries/Lists/SectionList.js
.*/node_modules/react-native/Libraries/Components/Touchable/TouchableHighlight.js
.*/node_modules/react-native/Libraries/EventEmitter/NativeEventEmitter.js
.*/node_modules/react-native/Libraries/Experimental/SwipeableRow/SwipeableFlatList.js
.*/node_modules/react-native/Libraries/Experimental/SwipeableRow/SwipeableListView.js
.*/node_modules/react-native/Libraries/Experimental/SwipeableRow/SwipeableRow.js
.*/node_modules/react-native/Libraries/Image/ImageBackground.js
.*/node_modules/react-native/Libraries/Image/resolveAssetSource.js
.*/node_modules/react-native/Libraries/Interaction/InteractionManager.js
.*/node_modules/react-native/Libraries/Interaction/TaskQueue.js
.*/node_modules/react-native/Libraries/LayoutAnimation/LayoutAnimation.js
.*/node_modules/react-native/Libraries/Lists/FlatList.js
.*/node_modules/react-native/Libraries/Image/AssetSourceResolver.js
.*/node_modules/react-native/Libraries/Inspector/BorderBox.js
.*/node_modules/react-native/Libraries/Inspector/BoxInspector.js
.*/node_modules/react-native/Libraries/Inspector/ElementProperties.js
.*/node_modules/react-native/Libraries/Inspector/Inspector.js
.*/node_modules/react-native/Libraries/Inspector/InspectorPanel.js
.*/node_modules/react-native/Libraries/Animated/src/nodes/AnimatedStyle.js
.*/node_modules/react-native/Libraries/Components/Switch/Switch.js
.*/node_modules/react-native/Libraries/Components/TextInput/InputAccessoryView.js
.*/node_modules/react-native/Libraries/Components/TextInput/TextInput.js
.*/node_modules/react-native/Libraries/Components/TextInput/TextInputState.js
.*/node_modules/react-native/Libraries/Components/Touchable/TouchableOpacity.js
.*/node_modules/react-native/Libraries/Components/View/PlatformViewPropTypes.js
.*/node_modules/react-native/Libraries/Components/View/View.js
.*/node_modules/react-native/Libraries/Components/View/ViewPropTypes.js
.*/node_modules/react-native/Libraries/EventEmitter/RCTDeviceEventEmitter.js
.*/node_modules/react-native/Libraries/Animated/src/nodes/AnimatedInterpolation.js
.*/node_modules/react-native/Libraries/Animated/src/nodes/AnimatedValue.js
.*/node_modules/react-native/Libraries/Components/ScrollResponder.js
.*/node_modules/react-native/Libraries/Components/ScrollView/ScrollViewStickyHeader.js
.*/node_modules/react-native/Libraries/Components/ScrollView/processDecelerationRate.js
.*/node_modules/react-native/Libraries/Components/Slider/Slider.js
.*/node_modules/react-native/Libraries/Components/StatusBar/StatusBar.js
.*/node_modules/react-native/Libraries/AppState/AppState.js
.*/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js
.*/node_modules/react-native/Libraries/BatchedBridge/NativeModules.js
.*/node_modules/react-native/Libraries/Components/AppleTV/TVEventHandler.js
.*/node_modules/react-native/Libraries/Components/Button.js
.*/node_modules/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js
.*/node_modules/react-native/Libraries/Components/Picker/Picker.js
.*/node_modules/react-native/Libraries/CameraRoll/CameraRoll.js
.*/node_modules/react-native/Libraries/CameraRoll/ImagePickerIOS.js
.*/node_modules/react-native/Libraries/Color/normalizeColor.js
.*/node_modules/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js
[include]


[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/
node_modules/react-native/flow-github/

flow-typed/

[options]
emoji=true
munge_underscores=true

module.system=haste
module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js
module.file_ext=.web.js
module.file_ext=.android.js
module.file_ext=.ios.js

module.name_mapper.extension='\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)' -> 'RelativeImageStub'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState

module.system.haste.use_name_reducers=true
# keep the following in sync with server/haste/hasteImpl.js
# get basename
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
# strip .js or .js.flow suffix
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
# strip .ios suffix
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
suppress_comment=\\(.\\|\n\\)*\\$FIXME

[version]
0.90

目前我正在使用flow v0.90。我也阅读了 changlogs,但没有人谈论这个问题。谁能帮我这个?

标签: javascriptreactjsflowtype

解决方案


推荐阅读