我最近将flow-bin
和.flowconfig
从0.53
升级到0.64
,现在流量导致反应原生框架文件中出现了大量新错误。
我可以对这种情况做些什么?
Error: node_modules/react-native/Libraries/Components/ScrollResponder.js:480
480: var { animated, ...rect } = rect;
^^^^^^^ rect. This type is incompatible with
472: rect: { x: number, y: number, width: number, height: number, animated?: boolean },
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ object type
Property `animated` is incompatible:
472: rect: { x: number, y: number, width: number, height: number, animated?: boolean },
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ property `animated`. Property not found in
480: var { animated, ...rect } = rect;
^^^^^^^ rect
Error: node_modules/react-native/Libraries/Inspector/Inspector.js:104
104: clearTimeout(_hideWait);
^^^^^^^^^ null. This type is incompatible with the expected param type of
733: declare function clearTimeout(timeoutId?: TimeoutID): void;
^^^^^^^^^ TimeoutID. See lib: /tmp/flow/flowlib_213409a3/core.js:733
Error: node_modules/react-native/Libraries/Interaction/InteractionManager.js:171
171: _nextUpdateHandle = setTimeout(_processUpdate, 0 + DEBUG_DELAY);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TimeoutID. This type is incompatible with
182: _nextUpdateHandle = 0;
^ number
Error: node_modules/react-native/Libraries/Lists/FlatList.js:465
v--------------------------------
465: this._virtualizedListPairs.push({
466: viewabilityConfig: this.props.viewabilityConfig,
467: onViewableItemsChanged: this._createOnViewableItemsChanged(
...:
470: });
-^ rest parameter array of call of method `push`. Has some incompatible type argument with
249: push(...items: Array<T>): number;
^^^^^^^^ array type. See lib: /tmp/flow/flowlib_213409a3/core.js:249
Type argument `T` is incompatible:
v
465: this._virtualizedListPairs.push({
466: viewabilityConfig: this.props.viewabilityConfig,
467: onViewableItemsChanged: this._createOnViewableItemsChanged(
...:
470: });
^ object literal. This type is incompatible with
476: _virtualizedListPairs: Array<ViewabilityConfigCallbackPair> = [];
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ViewabilityConfigCallbackPair
Property `viewabilityConfig` is incompatible:
466: viewabilityConfig: this.props.viewabilityConfig,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ undefined. Inexact type is incompatible with exact type
26: viewabilityConfig: ViewabilityConfig,
^^^^^^^^^^^^^^^^^ ViewabilityConfig. See: node_modules/react-native/Libraries/Lists/ViewabilityHelper.js:26
Error: node_modules/react-native/Libraries/Lists/FlatList.js:558
558: return keyExtractor(items, index);
^^^^^ array type. This type is incompatible with the expected param type of
151: keyExtractor: (item: ItemT, index: number) => string,
^^^^^ ItemT
Error: node_modules/react-native/Libraries/Lists/ViewabilityHelper.js:91
91: this._timers.forEach(clearTimeout);
^^^^^^^^^^^^ function type. This type is incompatible with the expected param type of
572: forEach(callbackfn: (value: T, index: T, set: Set<T>) => mixed, thisArg?: any): void;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function type. See lib: /tmp/flow/flowlib_213409a3/core.js:572
The first parameter is incompatible:
77: _timers: Set<number> = new Set();
^^^^^^ number. This type is incompatible with
733: declare function clearTimeout(timeoutId?: TimeoutID): void;
^^^^^^^^^ TimeoutID. See lib: /tmp/flow/flowlib_213409a3/core.js:733
Error: node_modules/react-native/Libraries/Lists/ViewabilityHelper.js:200
200: this._timers.delete(handle);
^^^^^^ TimeoutID. This type is incompatible with the expected param type of
77: _timers: Set<number> = new Set();
^^^^^^ number
Error: node_modules/react-native/Libraries/Lists/ViewabilityHelper.js:207
207: this._timers.add(handle);
^^^^^^ TimeoutID. This type is incompatible with the expected param type of
77: _timers: Set<number> = new Set();
^^^^^^ number
Error: node_modules/react-native/Libraries/Lists/VirtualizedList.js:484
v
484: this.scrollToIndex({
485: animated: false,
486: index: this.props.initialScrollIndex,
487: }),
^ object literal. This type is incompatible with the expected param type of
v
266: scrollToIndex(params: {
267: animated?: ?boolean,
268: index: number,
...:
271: }) {
^ object type
Property `index` is incompatible:
486: index: this.props.initialScrollIndex,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ null or undefined. This type is incompatible with
268: index: number,
^^^^^^ number
Error: node_modules/react-native/Libraries/Lists/VirtualizedList.js:484
v
484: this.scrollToIndex({
485: animated: false,
486: index: this.props.initialScrollIndex,
487: }),
^ object literal. This type is incompatible with the expected param type of
v
266: scrollToIndex(params: {
267: animated?: ?boolean,
268: index: number,
...:
271: }) {
^ object type
Property `index` is incompatible:
486: index: this.props.initialScrollIndex,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ undefined. This type is incompatible with
268: index: number,
^^^^^^ number
Error: node_modules/react-native/Libraries/Lists/VirtualizedList.js:500
500: clearTimeout(this._initialScrollIndexTimeout);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ number. This type is incompatible with the expected param type of
733: declare function clearTimeout(timeoutId?: TimeoutID): void;
^^^^^^^^^ TimeoutID. See lib: /tmp/flow/flowlib_213409a3/core.js:733
Error: node_modules/react-native/Libraries/Lists/VirtualizedList.js:1016
1016: distanceFromEnd < onEndReachedThreshold * visibleLength &&
^^^^^^^^^^^^^^^^^^^^^ null or undefined. The operand of an arithmetic operation must be a number.
Error: node_modules/react-native/Libraries/Lists/VirtualizedList.js:1016
1016: distanceFromEnd < onEndReachedThreshold * visibleLength &&
^^^^^^^^^^^^^^^^^^^^^ undefined. The operand of an arithmetic operation must be a number.
Error: node_modules/react-native/Libraries/Lists/VirtualizedList.js:1094
1094: this.props.onEndReachedThreshold * visibleLength / 2;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ null or undefined. The operand of an arithmetic operation must be a number.
Error: node_modules/react-native/Libraries/Lists/VirtualizedList.js:1094
1094: this.props.onEndReachedThreshold * visibleLength / 2;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ undefined. The operand of an arithmetic operation must be a number.
Error: node_modules/react-native/Libraries/Lists/VirtualizedList.js:1170
1170: distanceFromEnd < onEndReachedThreshold * visibleLength
^^^^^^^^^^^^^^^^^^^^^ null or undefined. The operand of an arithmetic operation must be a number.
Error: node_modules/react-native/Libraries/Lists/VirtualizedList.js:1170
1170: distanceFromEnd < onEndReachedThreshold * visibleLength
^^^^^^^^^^^^^^^^^^^^^ undefined. The operand of an arithmetic operation must be a number.
Error: node_modules/react-native/Libraries/Lists/VirtualizedList.js:1247
1247: return frame;
^^^^^ object type. This type is incompatible with the expected return type of
v
1210: ): ?{
1211: length: number,
1212: offset: number,
...:
1215: } => {
^ object type
Property `inLayout` is incompatible:
v
1210: ): ?{
1211: length: number,
1212: offset: number,
...:
1215: } => {
^ property `inLayout`. Property not found in
1247: return frame;
^^^^^ object type
Error: node_modules/react-native/Libraries/Lists/VirtualizedSectionList.js:236
236: key: keyExtractor(viewable.item, info.index),
^^^^^^^^^^ null or undefined. This type is incompatible with the expected param type of
101: keyExtractor: (item: Item, index: number) => string,
^^^^^^ number
Error: node_modules/react-native/Libraries/StyleSheet/flattenStyle.js:36
36: return getStyle(style);
^^^^^^^^^^^^^^^ number. This type is incompatible with the expected return type of
29: function flattenStyle(style: ?StyleObj): ?Object {
^^^^^^ object type
Found 30 errors
error Command failed with exit code 2.