proyecto26 / react-native-inappbrowser

📱InAppBrowser for React Native (Android & iOS) 🤘
https://www.npmjs.com/package/react-native-inappbrowser-reborn
MIT License
1.31k stars 223 forks source link

fix(flow): check #460

Open renanmav opened 2 months ago

renanmav commented 2 months ago

PR Checklist

What is the current behavior?

Flow check is broken. Run yarn flow on develop branch.

$ yarn flow

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ utils.js:46:33

Cannot assign Linking.addEventListener(...) to _linkingEventSubscription because
inexact EventSubscription [1] is incompatible with exact object type [2].
[incompatible-exact]

     utils.js
 [2] 29│ let _linkingEventSubscription: ?EmitterSubscription;
       :
     43│       }
     44│     };
     45│
     46│     _linkingEventSubscription = Linking.addEventListener(
     47│       'url',
     48│       _redirectHandler
     49│     );
     50│   });
     51│ }
     52│

     node_modules/react-native/Libraries/Linking/Linking.js
 [1] 45│   ): EventSubscription {

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ utils.js:48:7

Cannot call Linking.addEventListener with _redirectHandler bound to listener because
string literal string [1] is incompatible with string [2] in property url of the first
argument. [incompatible-call]

     utils.js
     45│
     46│     _linkingEventSubscription = Linking.addEventListener(
     47│       'url',
     48│       _redirectHandler
     49│     );
     50│   });
     51│ }

     node_modules/react-native/Libraries/Linking/Linking.js
 [2] 21│   url: [{url: string}],

     types.js
 [1]  7│   url: 'string',

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ utils.js:79:33

Cannot assign AppState.addEventListener(...) to appStateEventSubscription because
inexact EventSubscription [1] is incompatible with exact object type [2].
[incompatible-exact]

     utils.js
 [2] 58│     let appStateEventSubscription: ?EmitterSubscription;
       :
     76│       }
     77│     }
     78│
     79│     appStateEventSubscription = AppState.addEventListener(
     80│       'change',
     81│       handleAppStateChange
     82│     );
     83│   });
     84│ }
     85│

     node_modules/react-native/Libraries/AppState/AppState.js
 [1] 99│   ): EventSubscription {

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ utils.js:166:42

Cannot call Linking.removeEventListener with _redirectHandler bound to listener because
string literal string [1] is incompatible with string [2] in property url of the first
argument. [incompatible-call]

     utils.js
     163│       _linkingEventSubscription.remove();
     164│       _linkingEventSubscription = null;
     165│     } else {
     166│       Linking.removeEventListener('url', _redirectHandler);
     167│     }
     168│     _redirectHandler = null;
     169│   }

     node_modules/react-native/Libraries/Linking/Linking.js
 [2]  21│   url: [{url: string}],

     types.js
 [1]   7│   url: 'string',

Found 4 errors

What is the new behavior?

Fix flow check. Run yarn flow on this branch.

$ yarn flow
Found 0 errors
✨  Done in 6.29s.