-
Notifications
You must be signed in to change notification settings - Fork 630
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 modified the error structure
Summary: I changed the error structure from a string to an object with message (a human readable string) and the typeLoc(source location of the code). This structure is more useful if I'm creating more helpers that are handling the errors for different types. When I will add the pointing to the code, the final error for this code ``` foo.js old version: 23| type T = string; foo.js new version: 23| type T = ?string; ``` will be something like this: ``` Error: cannot change string to nullable string because it will break the native code. path/to/foo.js: 23| type T = ?string; ^^^^^^^^^^^^^^^^^ ``` Instead of appending the code source in every helper (basicError, literalError, etc.), I store the source location to process all the array of errors in an additional function. The new parameter in compareTypeAnnotation(newVersion) is used to give the context from the previous recursion. This is useful when I have the return type of the function. In that case, the left is switched with the right for comparison because I'm not calling the native code from js, instead the native returns something to js. ```() => boolean? -> () => boolean``` this will cause an incompatibility because nullable boolean is changed to boolean in the returned type Reviewed By: motiz88 Differential Revision: D39271900 fbshipit-source-id: e7ed4d5a99b48814fbae24a1773f25843600500e
- Loading branch information
1 parent
93d1a53
commit 2995129
Showing
3 changed files
with
95 additions
and
50 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