Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Flow为React本机类型定义/代码提供错误_Javascript_Reactjs_React Native_Babeljs_Flowtype - Fatal编程技术网

Javascript Flow为React本机类型定义/代码提供错误

Javascript Flow为React本机类型定义/代码提供错误,javascript,reactjs,react-native,babeljs,flowtype,Javascript,Reactjs,React Native,Babeljs,Flowtype,我刚开始使用Flow,在使用它扫描React本机项目后,出现了一系列错误: Error --------------------------- node_modules Missing type annotation for `U`. v-------------------------- 353| return range.map(function(value) { 354| if (typeof value !== '

我刚开始使用Flow,在使用它扫描React本机项目后,出现了一系列错误:

Error --------------------------- node_modules

Missing type annotation for `U`.

                   v--------------------------
   353|     return range.map(function(value) {
   354|       if (typeof value !== 'string') {
   355|         return value;
   356|       }
   357|       if (/deg$/.test(value)) {
   358|         const degrees = parseFloat(value) || 0;
   359|         const radians = degrees * Math.PI / 180.0;
   360|         return radians;
   361|       } else {
   362|         // Assume radians
   363|         return parseFloat(value) || 0;
   364|       }
   365|     });
            -^


Error ------------------------------------ node_modules/react-native/Librarie

Property `update` is missing in `AnimatedNode` [1].

   node_modules/react-native/Libraries/Animated/src/nodes/AnimatedValue.js:54
   54|     if (typeof node.update === 'function') {
                      ^^^^^^^^^^^

References:
   node_modules/react-native/Libraries/Animated/src/nodes/AnimatedWithChildre
   70|   __getChildren(): Array<AnimatedNode> {
                                ^^^^^^^^^^^^ [1]


Error -------------------------------------------- node_modules/react-native/

Cannot assign `!this.props.disabled` to `props.enabled` because property `ena

   node_modules/react-native/Libraries/Components/Switch/Switch.js:105:7
   105|       props.enabled = !this.props.disabled;
              ^^^^^^^^^^^^^

References:
   node_modules/react-native/Libraries/Components/Switch/Switch.js:101:19
   101|     const props = {...this.props};
                          ^^^^^^^^^^^^^^^ [1]


Error -------------------------------------------- node_modules/react-native/

Cannot assign `this.props.value` to `props.on` because property `on` is missi

   node_modules/react-native/Libraries/Components/Switch/Switch.js:106:7
   106|       props.on = this.props.value;
              ^^^^^^^^

References:
   node_modules/react-native/Libraries/Components/Switch/Switch.js:101:19
   101|     const props = {...this.props};
                          ^^^^^^^^^^^^^^^ [1]


Error -------------------------------------------- node_modules/react-native/

Cannot assign `this.props.value ? this.props.onTintColor : this.props.tintCol
property `trackTintColor` is missing in object literal [1].

   node_modules/react-native/Libraries/Components/Switch/Switch.js:108:7
   108|       props.trackTintColor = this.props.value ? this.props.onTintColo
              ^^^^^^^^^^^^^^^^^^^^

References:
   node_modules/react-native/Libraries/Components/Switch/Switch.js:101:19
   101|     const props = {...this.props};
                          ^^^^^^^^^^^^^^^ [1]


Error ------------------------ node_modules/react-native/Libraries/Experiment

Property `setNativeProps` is missing in `React.Element` [1].

   node_modules/react-native/Libraries/Experimental/SwipeableRow/SwipeableLis
   145|     if (this._listViewRef && typeof this._listViewRef.setNativeProps
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

References:
   node_modules/react-native/Libraries/Experimental/SwipeableRow/SwipeableLis
    58|   _listViewRef: ?React.Element<any> = null;
                         ^^^^^^^^^^^^^^^^^^ [1]


Error ------------------------ node_modules/react-native/Libraries/Experiment

Property `getScrollResponder` is missing in `React.Element` [1].

   node_modules/react-native/Libraries/Experimental/SwipeableRow/SwipeableLis
   154|     if (this._listViewRef && typeof this._listViewRef.getScrollRespon
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

References:
   node_modules/react-native/Libraries/Experimental/SwipeableRow/SwipeableLis
    58|   _listViewRef: ?React.Element<any> = null;
                         ^^^^^^^^^^^^^^^^^^ [1]


Error ----------------------------------------------- node_modules/react-nati

Cannot assign array literal to `scrollProps.style` because property `style` i

   node_modules/react-native/Libraries/Lists/VirtualizedList.js:908:7
   908|       scrollProps.style = [inversionStyle, this.props.style];
              ^^^^^^^^^^^^^^^^^

References:
   node_modules/react-native/Libraries/Lists/VirtualizedList.js:893:25
                                v
   893|     const scrollProps = {
   894|       ...this.props,
   895|       onContentSizeChange: this._onContentSizeChange,
   896|       onLayout: this._onLayout,
   897|       onScroll: this._onScroll,
   898|       onScrollBeginDrag: this._onScrollBeginDrag,
   899|       onScrollEndDrag: this._onScrollEndDrag,
   900|       onMomentumScrollEnd: this._onMomentumScrollEnd,
   901|       scrollEventThrottle: this.props.scrollEventThrottle, // TODO: A
   902|       invertStickyHeaders: this.props.invertStickyHeaders !== undefin
   903|         ? this.props.invertStickyHeaders
   904|         : this.props.inverted,
   905|       stickyHeaderIndices,
   906|     };
            ^ [1]


Error --------------------------------------------- node_modules/react-native

Property `inLayout` is missing in object type [1].

   node_modules/react-native/Libraries/Lists/VirtualizedList.js:1125:11
   1125|       if (frame.inLayout) {
                   ^^^^^^^^^^^^^^

References:
   node_modules/react-native/Libraries/Lists/VirtualizedList.js:1474:6
   1474|   ): {length: number, offset: number} => {
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1]


Error --------------------------------------------- node_modules/react-native

Property `debug` is missing in object type [1].

   node_modules/react-native/Libraries/Lists/VirtualizedList.js:1649:25
   1649|       getItemLayout && !parentProps.debug && !fillRateHelper.enabled
                                 ^^^^^^^^^^^^^^^^^

References:
   node_modules/react-native/Libraries/Lists/VirtualizedList.js:1567:18
                          v
   1567|     parentProps: {
   1568|       getItemLayout?: ?Function,
   1569|       renderItem: renderItemType,
   1570|     },
             ^ [1]


Error ----------------------------------------------- node_modules/react-nati

Property `disableYellowBox` is missing in object type [1].

   node_modules/react-native/Libraries/ReactNative/YellowBox.js:108:7
   108|   if (console.disableYellowBox) {
              ^^^^^^^^^^^^^^^^^^^^^^^^

References:
   C:\cygwin64\tmp\flow\flowlib_1ec88eef\core.js:806:22
                             v-
   806| declare var console: {
   807|   assert(condition: mixed, ...data: Array<any>): void;
   808|   clear(): void;
   809|   count(label: string): void;
   810|   debug(...data: Array<any>): void;
   811|   dir(...data: Array<any>): void;
   812|   dirxml(...data: Array<any>): void;
   813|   error(...data: Array<any>): void;
   814|   _exception(...data: Array<any>): void;
   815|   group(...data: Array<any>): void;
   816|   groupCollapsed(...data: Array<any>): void;
   817|   groupEnd(): void;
   818|   info(...data: Array<any>): void;
   819|   log(...data: Array<any>): void;
   820|   profile(name?: string): void;
   821|   profileEnd(name?: string): void;
   822|   table(tabularData: { [key: string]: any } | Array<{ [key: string]:
   823|   time(label: string): void;
   824|   timeEnd(label: string): void;
   825|   timeStamp(label?: string): void;
   826|   trace(...data: Array<any>): void;
   827|   warn(...data: Array<any>): void;
   828| };
        ^ [1]


Error ---------------------------------------------- node_modules/react-nativ

Property `ignoredYellowBox` is missing in object type [1].

   node_modules/react-native/Libraries/ReactNative/YellowBox.js:181:19
   181|     Array.isArray(console.ignoredYellowBox) &&
                          ^^^^^^^^^^^^^^^^^^^^^^^^

References:
   C:\cygwin64\tmp\flow\flowlib_1ec88eef\core.js:806:22
                             v-
   806| declare var console: {
   807|   assert(condition: mixed, ...data: Array<any>): void;
   808|   clear(): void;
   809|   count(label: string): void;
   810|   debug(...data: Array<any>): void;
   811|   dir(...data: Array<any>): void;
   812|   dirxml(...data: Array<any>): void;
   813|   error(...data: Array<any>): void;
   814|   _exception(...data: Array<any>): void;
   815|   group(...data: Array<any>): void;
   816|   groupCollapsed(...data: Array<any>): void;
   817|   groupEnd(): void;
   818|   info(...data: Array<any>): void;
   819|   log(...data: Array<any>): void;
   820|   profile(name?: string): void;
   821|   profileEnd(name?: string): void;
   822|   table(tabularData: { [key: string]: any } | Array<{ [key: string]:
   823|   time(label: string): void;
   824|   timeEnd(label: string): void;
   825|   timeStamp(label?: string): void;
   826|   trace(...data: Array<any>): void;
   827|   warn(...data: Array<any>): void;
   828| };
        ^ [1]


Error ----------------------------------------------- node_modules/react-nati

Property `disableYellowBox` is missing in object type [1].

   node_modules/react-native/Libraries/ReactNative/YellowBox.js:382:9
   382|     if (console.disableYellowBox || this.state.warningMap.size === 0)
                ^^^^^^^^^^^^^^^^^^^^^^^^

References:
   C:\cygwin64\tmp\flow\flowlib_1ec88eef\core.js:806:22
                             v-
   806| declare var console: {
   807|   assert(condition: mixed, ...data: Array<any>): void;
   808|   clear(): void;
   809|   count(label: string): void;
   810|   debug(...data: Array<any>): void;
   811|   dir(...data: Array<any>): void;
   812|   dirxml(...data: Array<any>): void;
   813|   error(...data: Array<any>): void;
   814|   _exception(...data: Array<any>): void;
   815|   group(...data: Array<any>): void;
   816|   groupCollapsed(...data: Array<any>): void;
   817|   groupEnd(): void;
   818|   info(...data: Array<any>): void;
   819|   log(...data: Array<any>): void;
   820|   profile(name?: string): void;
   821|   profileEnd(name?: string): void;
   822|   table(tabularData: { [key: string]: any } | Array<{ [key: string]:
   823|   time(label: string): void;
   824|   timeEnd(label: string): void;
   825|   timeStamp(label?: string): void;
   826|   trace(...data: Array<any>): void;
   827|   warn(...data: Array<any>): void;
   828| };
        ^ [1]


Error ---------------------------------------- node_modules/react-native/Libr

Property `prototype` is missing in `React.StatelessFunctionalComponent` [1].

   node_modules/react-native/Libraries/ReactNative/renderApplication.js:41:5
   41|     RootComponent.prototype != null &&
           ^^^^^^^^^^^^^^^^^^^^^^^

References:
   node_modules/react-native/Libraries/ReactNative/renderApplication.js:24:18
   24|   RootComponent: React.ComponentType<Props>,
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^ [1]


Error --------------------------------- node_modules/react-native/Libraries/R

Property `__propTypesSecretDontUseThesePlease` is missing in `React.Stateless

   node_modules/react-native/Libraries/ReactNative/requireNativeComponent.js:
   122|         typeof componentInterface.__propTypesSecretDontUseThesePlease
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

References:
   node_modules/react-native/Libraries/ReactNative/requireNativeComponent.js:
    50|   componentInterface?: ?ComponentInterface,
                                ^^^^^^^^^^^^^^^^^^ [1]


Error -----------------------------------------------------------------------
错误------------------------------------------节点\u模块
缺少“U”的类型批注。
五--------------------------
353 |返回范围.map(函数(值){
354 |如果(值的类型!=“字符串”){
355 |返回值;
356|       }
357 |如果(/度$/测试(值)){
358 | const degrees=parseFloat(值)| 0;
359 |常数弧度=度*Math.PI/180.0;
360 |返回弧度;
361 |}其他{
362 |//假设弧度
363 |返回浮点(值)| 0;
364|       }
365|     });
-^
错误------------------节点\模块/反应本机/库
'AnimatedNode`[1]中缺少属性'update'。
node_modules/react native/Libraries/Animated/src/nodes/AnimatedValue.js:54
54 |如果(typeof node.update==‘function’){
^^^^^^^^^^^
参考资料:
node_modules/react native/Libraries/Animated/src/nodes/AnimatedWithChildre
70 | u getChildren():数组{
^^^^^^^^^^^^ [1]
错误------------------------------------------节点\模块/反应本机/
无法将“!this.props.disabled”分配给“props.enabled”,因为属性为
node_modules/react native/Libraries/Components/Switch/Switch.js:105:7
105 | props.enabled=!this.props.disabled;
^^^^^^^^^^^^^
参考资料:
node_modules/react native/Libraries/Components/Switch/Switch.js:101:19
101 | const props={…this.props};
^^^^^^^^^^^^^^^ [1]
错误------------------------------------------节点\模块/反应本机/
无法将'this.props.value'分配给'props.on',因为'on'上的属性'misi
node_modules/react native/Libraries/Components/Switch/Switch.js:106:7
106 | props.on=此.props.value;
^^^^^^^^
参考资料:
node_modules/react native/Libraries/Components/Switch/Switch.js:101:19
101 | const props={…this.props};
^^^^^^^^^^^^^^^ [1]
错误------------------------------------------节点\模块/反应本机/
无法分配'this.props.value?this.props.onTintColor:this.props.tintCol
对象文字[1]中缺少属性“trackTintColor”。
node_modules/react native/Libraries/Components/Switch/Switch.js:108:7
108 | props.trackTintColor=this.props.value?this.props.onTintColo
^^^^^^^^^^^^^^^^^^^^
参考资料:
node_modules/react native/Libraries/Components/Switch/Switch.js:101:19
101 | const props={…this.props};
^^^^^^^^^^^^^^^ [1]
错误-----------------节点\模块/反应本机/库/实验
'React.Element`[1]中缺少属性'setNativeProps'。
节点\模块/反应本机/库/实验/SwipeableRow/SwipeableLis
145 |如果(此._listViewRef&&typeof此._listViewRef.setNativeProps
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
参考资料:
节点\模块/反应本机/库/实验/SwipeableRow/SwipeableLis
58 | u listViewRef:?React.Element=null;
^^^^^^^^^^^^^^^^^^ [1]
错误-----------------节点\模块/反应本机/库/实验
'React.Element`[1]中缺少属性'getScrollResponder'。
节点\模块/反应本机/库/实验/SwipeableRow/SwipeableLis
154 | if(this._listViewRef&&typeof this._listViewRef.getScrollRespon
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
参考资料:
节点\模块/反应本机/库/实验/SwipeableRow/SwipeableLis
58 | u listViewRef:?React.Element=null;
^^^^^^^^^^^^^^^^^^ [1]
错误------------------------------------------节点\模块/react nati
无法将数组文字分配给'scrollProps.style',因为属性'style'i
node_modules/react native/Libraries/list/VirtualizedList.js:908:7
908 | scrollProps.style=[inversionStyle,this.props.style];
^^^^^^^^^^^^^^^^^
参考资料:
node_modules/react native/Libraries/list/VirtualizedList.js:893:25
v
893 |常数滚动道具={
894 |…这个。道具,
895 | onContentSizeChange:这个。| onContentSizeChange,
896 |在线排版:这个。|在线排版,
897 |昂斯克罗尔:这个。|昂斯克罗尔,
这个,
这个,
900 | onMomentumScrollEnd:这个,
901 | scrollEventThrottle:this.props.scrollEventThrottle,//TODO:A
902 | invertStickyHeaders:this.props.invertStickyHeaders!==undefin
903 |?this.props.invertStickyHeaders
904 |:这个。道具。倒置,
905 |粘头骰子,
906|     };
^ [1]
错误------------------------------------------node_模块/react本机
对象类型[1]中缺少属性'inLayout'。
node_modules/react native/Libraries/list/VirtualizedList.js:1125:11
1125 |如果(框架镶嵌){
^^^^^^^^^^^^^^
参考资料:
node_modules/react native/Libraries/list/VirtualizedList.js:1474:6
1474 |):{length:number,offset:number}=>{
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1]
错误------------------------------------------node_模块/react本机
对象类型[1]中缺少属性“debug”。
node_modules/react native/Libraries/list/VirtualizedList.js:1649:25
1649 | getItemLayout&&!parentProps.debug&&!fillRateHelper.enabled
^^^^^^^^^^^^^^^^^
参考资料:
node_modules/react native/Libraries/list/VirtualizedList.js:1567:18
v
1567 |家长支持:{
1568 | getItemLayout
map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
function XXX(YYYY): (some_type | number)[] { // <-- you should explicitly declare return type here
  ...

  return range.map(function(value: some_type|string) { // <--- probably, more explicit typehint here as well
    if (typeof value !== 'string') {
      return value; // <-- return value is a 'some_type' here
    }
    if (/deg$/.test(value)) {
      const degrees = parseFloat(value) || 0;
      const radians = degrees * Math.PI / 180.0;
      return radians; // <-- return value is 'number' here
    } else {
      // Assume radians
      return parseFloat(value) || 0; // <-- return value is 'number' here
    }
  });
}