Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
metro-react-native-interop-tools added function type comparison
Summary: I added function type comparison, this is the first more complex type. In the returned type, the rules change because we are not calling native code from js anymore, but we are getting something back from native code, so we switched the left and right to keep the checking same as for previous types. We are updating the isInFunctionReturn flag to know that the left was switched with the right type. So this change is compatible in function parameters: ```(test: ?string) => string;``` ----> ```(test: string) => string``` Because js will call the native only with a string value, and the null case will not be handled by the native anymore. But if we are going from narrower to wider scope(non-nullable to nullable), native code doesn't know how to handle the null case so the app will crash/behave in an unexpected way. If the same change happens in the return type will cause an incompatibility: ```(test: string) => ?string``` -----> ```(test:string) => string``` In this case native can return null | void | string, and the flow will expect to always get a string. Reviewed By: GijsWeterings Differential Revision: D39353779 fbshipit-source-id: 72733b208e6d6d5ed535c572e788a852c6cbd1d1
- Loading branch information
1 parent
059e9ed
commit 26f7ec7
Showing
7 changed files
with
241 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters