react-native: Flow 0.34.0 reports lots of errors
Description
Using Flow 0.34.0 I get a lot of errors in core libraries
Reproduction
$ node_modules/.bin/flow version
Flow, a static type checker for JavaScript, version 0.34.0
$ node_modules/.bin/flow
node_modules/react-native/Libraries/JSInspector/NetworkAgent.js:277
277: XMLHttpRequest.setInterceptor(this._interceptor);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `setInterceptor`
277: XMLHttpRequest.setInterceptor(this._interceptor);
^^^^^^^^^^^^^^^^^ Interceptor. Covariant property `dataReceived` incompatible with invariant use in
136: static setInterceptor(interceptor: ?XHRInterceptor) {
^^^^^^^^^^^^^^ object type. See: node_modules/react-native/Libraries/Network/XMLHttpRequest.js:136
node_modules/react-native/Libraries/JSInspector/NetworkAgent.js:277
277: XMLHttpRequest.setInterceptor(this._interceptor);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `setInterceptor`
277: XMLHttpRequest.setInterceptor(this._interceptor);
^^^^^^^^^^^^^^^^^ Interceptor. Covariant property `loadingFailed` incompatible with invariant use in
136: static setInterceptor(interceptor: ?XHRInterceptor) {
^^^^^^^^^^^^^^ object type. See: node_modules/react-native/Libraries/Network/XMLHttpRequest.js:136
node_modules/react-native/Libraries/JSInspector/NetworkAgent.js:277
277: XMLHttpRequest.setInterceptor(this._interceptor);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `setInterceptor`
277: XMLHttpRequest.setInterceptor(this._interceptor);
^^^^^^^^^^^^^^^^^ Interceptor. Covariant property `loadingFinished` incompatible with invariant use in
136: static setInterceptor(interceptor: ?XHRInterceptor) {
^^^^^^^^^^^^^^ object type. See: node_modules/react-native/Libraries/Network/XMLHttpRequest.js:136
node_modules/react-native/Libraries/JSInspector/NetworkAgent.js:277
277: XMLHttpRequest.setInterceptor(this._interceptor);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `setInterceptor`
277: XMLHttpRequest.setInterceptor(this._interceptor);
^^^^^^^^^^^^^^^^^ Interceptor. Covariant property `requestSent` incompatible with invariant use in
136: static setInterceptor(interceptor: ?XHRInterceptor) {
^^^^^^^^^^^^^^ object type. See: node_modules/react-native/Libraries/Network/XMLHttpRequest.js:136
node_modules/react-native/Libraries/JSInspector/NetworkAgent.js:277
277: XMLHttpRequest.setInterceptor(this._interceptor);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call of method `setInterceptor`
277: XMLHttpRequest.setInterceptor(this._interceptor);
^^^^^^^^^^^^^^^^^ Interceptor. Covariant property `responseReceived` incompatible with invariant use in
136: static setInterceptor(interceptor: ?XHRInterceptor) {
^^^^^^^^^^^^^^ object type. See: node_modules/react-native/Libraries/Network/XMLHttpRequest.js:136
node_modules/react-native/Libraries/ReactNative/YellowBox.js:60
60: console.error = function() {
^^^^^^^ object type. Covariant property `error` incompatible with contravariant use in
60: console.error = function() {
^^^^^^^^^^^^^ assignment of property `error`
node_modules/react-native/Libraries/ReactNative/YellowBox.js:68
68: console.warn = function() {
^^^^^^^ object type. Covariant property `warn` incompatible with contravariant use in
68: console.warn = function() {
^^^^^^^^^^^^ assignment of property `warn`
node_modules/react-native/Libraries/Renderer/src/renderers/native/ReactNativeAttributePayload.js:34
34: { diff: AttributeDiffer, process: AttributePreprocessor } |
^^^^^^^^^^^^^^^ function type. Callable signature not found in
40: CustomAttributeConfiguration | AttributeConfiguration /*| boolean*/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ object type
node_modules/react-native/Libraries/Renderer/src/renderers/native/ReactNativeAttributePayload.js:34
34: { diff: AttributeDiffer, process: AttributePreprocessor } |
^^^^^^^^^^^^^^^ function type. Callable signature not found in
40: CustomAttributeConfiguration | AttributeConfiguration /*| boolean*/
^^^^^^^^^^^^^^^^^^^^^^ object type
node_modules/react-native/Libraries/Renderer/src/renderers/native/ReactNativeAttributePayload.js:34
34: { diff: AttributeDiffer, process: AttributePreprocessor } |
^^^^^^^^^^^^^^^^^^^^^ function type. Callable signature not found in
40: CustomAttributeConfiguration | AttributeConfiguration /*| boolean*/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ object type
node_modules/react-native/Libraries/Renderer/src/renderers/native/ReactNativeAttributePayload.js:34
34: { diff: AttributeDiffer, process: AttributePreprocessor } |
^^^^^^^^^^^^^^^^^^^^^ function type. Callable signature not found in
40: CustomAttributeConfiguration | AttributeConfiguration /*| boolean*/
^^^^^^^^^^^^^^^^^^^^^^ object type
node_modules/react-native/Libraries/Renderer/src/renderers/native/ReactNativeAttributePayload.js:35
35: { diff: AttributeDiffer } |
^^^^^^^^^^^^^^^ function type. Callable signature not found in
40: CustomAttributeConfiguration | AttributeConfiguration /*| boolean*/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ object type
node_modules/react-native/Libraries/Renderer/src/renderers/native/ReactNativeAttributePayload.js:35
35: { diff: AttributeDiffer } |
^^^^^^^^^^^^^^^ function type. Callable signature not found in
40: CustomAttributeConfiguration | AttributeConfiguration /*| boolean*/
^^^^^^^^^^^^^^^^^^^^^^ object type
node_modules/react-native/Libraries/Renderer/src/renderers/native/ReactNativeAttributePayload.js:36
36: { process: AttributePreprocessor };
^^^^^^^^^^^^^^^^^^^^^ function type. Callable signature not found in
40: CustomAttributeConfiguration | AttributeConfiguration /*| boolean*/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ object type
node_modules/react-native/Libraries/Renderer/src/renderers/native/ReactNativeAttributePayload.js:36
36: { process: AttributePreprocessor };
^^^^^^^^^^^^^^^^^^^^^ function type. Callable signature not found in
40: CustomAttributeConfiguration | AttributeConfiguration /*| boolean*/
^^^^^^^^^^^^^^^^^^^^^^ object type
node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactChildFiber.js:76
76: previousSibling.sibling = child;
^^^^^^^^^^^^^^^^^^^^^^^ assignment of property `sibling`. Property cannot be assigned on any member of intersection type
76: previousSibling.sibling = child;
^^^^^^^^^^^^^^^ intersection
Member 1:
60: export type Fiber = Instance & {
^^^^^^^^ Instance. See: node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:60
Error:
76: previousSibling.sibling = child;
^^^^^^^ property `sibling`. Property not found in
60: export type Fiber = Instance & {
^^^^^^^^ object type. See: node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:60
Member 2:
60: export type Fiber = Instance & {
^ object type. See: node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:60
Error:
248: function createFiberFromElementType(type : mixed, key : null | string) {
^^^^^ mixed. This type is incompatible with. See: node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:248
44: key: null | string,
^^^^^^^^^^^^^ union: null | string. See: node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:44
Member 1:
44: key: null | string,
^^^^ null. See: node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:44
Error:
248: function createFiberFromElementType(type : mixed, key : null | string) {
^^^^^ mixed. This type is incompatible with. See: node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:248
44: key: null | string,
^^^^ null. See: node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:44
Member 2:
44: key: null | string,
^^^^^^ string. See: node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:44
Error:
248: function createFiberFromElementType(type : mixed, key : null | string) {
^^^^^ mixed. This type is incompatible with. See: node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:248
44: key: null | string,
^^^^^^ string. See: node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:44
node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:248
248: function createFiberFromElementType(type : mixed, key : null | string) {
^^^^^ mixed. This type is incompatible with
41: tag: TypeOfWork,
^^^^^^^^^^ number enum
node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:248
248: function createFiberFromElementType(type : mixed, key : null | string) {
^^^^^ mixed. This type is incompatible with
44: key: null | string,
^^^^^^^^^^^^^ union: null | string
Member 1:
44: key: null | string,
^^^^ null
Error:
248: function createFiberFromElementType(type : mixed, key : null | string) {
^^^^^ mixed. This type is incompatible with
44: key: null | string,
^^^^ null
Member 2:
44: key: null | string,
^^^^^^ string
Error:
248: function createFiberFromElementType(type : mixed, key : null | string) {
^^^^^ mixed. This type is incompatible with
44: key: null | string,
^^^^^^ string
node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:248
248: function createFiberFromElementType(type : mixed, key : null | string) {
^^^^^ mixed. This type is incompatible with
60: export type Fiber = Instance & {
^^^^^^^^ object type
node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:248
248: function createFiberFromElementType(type : mixed, key : null | string) {
^^^^^ mixed. This type is incompatible with
60: export type Fiber = Instance & {
^ object type
node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:248
248: function createFiberFromElementType(type : mixed, key : null | string) {
^^^^^ mixed. This type is incompatible with
74: ref: null | (handle : ?Object) => void,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ union: null | function type
Member 1:
74: ref: null | (handle : ?Object) => void,
^^^^ null
Error:
248: function createFiberFromElementType(type : mixed, key : null | string) {
^^^^^ mixed. This type is incompatible with
74: ref: null | (handle : ?Object) => void,
^^^^ null
Member 2:
74: ref: null | (handle : ?Object) => void,
^^^^^^^^^^^^^^^^^^^^^^^^^^ function type
Error:
248: function createFiberFromElementType(type : mixed, key : null | string) {
^^^^^ mixed. This type is incompatible with
74: ref: null | (handle : ?Object) => void,
^^^^^^^^^^^^^^^^^^^^^^^^^^ function type
node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:248
248: function createFiberFromElementType(type : mixed, key : null | string) {
^^^^^ mixed. This type is incompatible with
100: pendingWorkPriority: PriorityLevel,
^^^^^^^^^^^^^ number enum
node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:248
248: function createFiberFromElementType(type : mixed, key : null | string) {
^^^^^ mixed. This type is incompatible with
105: progressedPriority: PriorityLevel,
^^^^^^^^^^^^^ number enum
node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:248
248: function createFiberFromElementType(type : mixed, key : null | string) {
^^^^^ mixed. This type is incompatible with
22: export type UpdateQueue = UpdateQueueNode & {
^^^^^^^^^^^^^^^ object type. See: node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiberUpdateQueue.js:22
node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiber.js:248
248: function createFiberFromElementType(type : mixed, key : null | string) {
^^^^^ mixed. This type is incompatible with
22: export type UpdateQueue = UpdateQueueNode & {
^ object type. See: node_modules/react-native/Libraries/Renderer/src/renderers/shared/fiber/ReactFiberUpdateQueue.js:22
node_modules/react-native/Libraries/Text/TextStylePropTypes.js:21
21: fontFamily: ReactPropTypes.string,
^^^^^^^^^^^^^^^^^^^^^ property `isRequired` of object type. Property not found in
18: shape: {[key: string]: ReactPropsCheckType}
^^^^^^^^^^^^^^^^^^^ function type. See: node_modules/react-native/Libraries/StyleSheet/StyleSheetPropType.js:18
node_modules/react-native/Libraries/Text/TextStylePropTypes.js:22
22: fontSize: ReactPropTypes.number,
^^^^^^^^^^^^^^^^^^^^^ property `isRequired` of object type. Property not found in
18: shape: {[key: string]: ReactPropsCheckType}
^^^^^^^^^^^^^^^^^^^ function type. See: node_modules/react-native/Libraries/StyleSheet/StyleSheetPropType.js:18
node_modules/react-native/Libraries/Text/TextStylePropTypes.js:23
23: fontStyle: ReactPropTypes.oneOf(['normal', 'italic']),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ property `isRequired` of object type. Property not found in
18: shape: {[key: string]: ReactPropsCheckType}
^^^^^^^^^^^^^^^^^^^ function type. See: node_modules/react-native/Libraries/StyleSheet/StyleSheetPropType.js:18
node_modules/react-native/Libraries/Text/TextStylePropTypes.js:29
29: fontWeight: ReactPropTypes.oneOf(
^ property `isRequired` of object type. Property not found in
18: shape: {[key: string]: ReactPropsCheckType}
^^^^^^^^^^^^^^^^^^^ function type. See: node_modules/react-native/Libraries/StyleSheet/StyleSheetPropType.js:18
node_modules/react-native/Libraries/Text/TextStylePropTypes.js:36
36: fontVariant: ReactPropTypes.arrayOf(
^ property `isRequired` of object type. Property not found in
18: shape: {[key: string]: ReactPropsCheckType}
^^^^^^^^^^^^^^^^^^^ function type. See: node_modules/react-native/Libraries/StyleSheet/StyleSheetPropType.js:18
node_modules/react-native/Libraries/Text/TextStylePropTypes.js:45
45: textShadowOffset: ReactPropTypes.shape(
^ property `isRequired` of object type. Property not found in
18: shape: {[key: string]: ReactPropsCheckType}
^^^^^^^^^^^^^^^^^^^ function type. See: node_modules/react-native/Libraries/StyleSheet/StyleSheetPropType.js:18
node_modules/react-native/Libraries/Text/TextStylePropTypes.js:48
48: textShadowRadius: ReactPropTypes.number,
^^^^^^^^^^^^^^^^^^^^^ property `isRequired` of object type. Property not found in
18: shape: {[key: string]: ReactPropsCheckType}
^^^^^^^^^^^^^^^^^^^ function type. See: node_modules/react-native/Libraries/StyleSheet/StyleSheetPropType.js:18
node_modules/react-native/Libraries/Text/TextStylePropTypes.js:53
53: letterSpacing: ReactPropTypes.number,
^^^^^^^^^^^^^^^^^^^^^ property `isRequired` of object type. Property not found in
18: shape: {[key: string]: ReactPropsCheckType}
^^^^^^^^^^^^^^^^^^^ function type. See: node_modules/react-native/Libraries/StyleSheet/StyleSheetPropType.js:18
node_modules/react-native/Libraries/Text/TextStylePropTypes.js:54
54: lineHeight: ReactPropTypes.number,
^^^^^^^^^^^^^^^^^^^^^ property `isRequired` of object type. Property not found in
18: shape: {[key: string]: ReactPropsCheckType}
^^^^^^^^^^^^^^^^^^^ function type. See: node_modules/react-native/Libraries/StyleSheet/StyleSheetPropType.js:18
node_modules/react-native/Libraries/Text/TextStylePropTypes.js:59
59: textAlign: ReactPropTypes.oneOf(
^ property `isRequired` of object type. Property not found in
18: shape: {[key: string]: ReactPropsCheckType}
^^^^^^^^^^^^^^^^^^^ function type. See: node_modules/react-native/Libraries/StyleSheet/StyleSheetPropType.js:18
node_modules/react-native/Libraries/Text/TextStylePropTypes.js:65
65: textAlignVertical: ReactPropTypes.oneOf(
^ property `isRequired` of object type. Property not found in
18: shape: {[key: string]: ReactPropsCheckType}
^^^^^^^^^^^^^^^^^^^ function type. See: node_modules/react-native/Libraries/StyleSheet/StyleSheetPropType.js:18
node_modules/react-native/Libraries/Text/TextStylePropTypes.js:68
68: textDecorationLine: ReactPropTypes.oneOf(
^ property `isRequired` of object type. Property not found in
18: shape: {[key: string]: ReactPropsCheckType}
^^^^^^^^^^^^^^^^^^^ function type. See: node_modules/react-native/Libraries/StyleSheet/StyleSheetPropType.js:18
node_modules/react-native/Libraries/Text/TextStylePropTypes.js:74
74: textDecorationStyle: ReactPropTypes.oneOf(
^ property `isRequired` of object type. Property not found in
18: shape: {[key: string]: ReactPropsCheckType}
^^^^^^^^^^^^^^^^^^^ function type. See: node_modules/react-native/Libraries/StyleSheet/StyleSheetPropType.js:18
node_modules/react-native/Libraries/Text/TextStylePropTypes.js:84
84: writingDirection: ReactPropTypes.oneOf(
^ property `isRequired` of object type. Property not found in
18: shape: {[key: string]: ReactPropsCheckType}
^^^^^^^^^^^^^^^^^^^ function type. See: node_modules/react-native/Libraries/StyleSheet/StyleSheetPropType.js:18
Found 39 errors
Solution
- Fix type errors
- Add flow suppress comments
Additional Information
- React Native version: 0.38.0
- Platform: both
- Operating System: macOS
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 17 (12 by maintainers)
Getting a lot of errors with flow ^0.37.4, had to install
flow-bin
to start with and am getting various errors (see below) that occur prior and post suggested regex fixes:RN 0.39.2
I think the only way to fix this is to upgrade to
0.42
. Really sorry about the inconvenience- we are going to be careful with flow errors from here on