-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Promise polyfill flow type #22048
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only needed because AccessibilityInfo is requiring the Promise module instead of using Promise from global. That seems weird. Does everything else use it from global?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also fixes this Flow error that is showing up for me locally and some other people:
I don't know why this error isn't showing up on CircleCI (I also did a clean re-install of all
node_modules
and this still appears)Forgot to add that to the main PR message, sorry!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix seems detrimental to that particular issue.
require('Promise')
should be resolving toLibraries/Promise.js
via Haste (which does have @flow at the top so there is something else weird happening). By specifyingdeclare module 'Promise' {
inflow/Promise.js
it is bypassing the haste module which is probably not what we want.Can you try running flow get-def on
require('Promise')
in the statement you have above and see where Flow is trying to resolve that module from and debug from there?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's resolving to
node_modules/promise/index.js
.The particular version of
promise
RN is using doesn't have a Flow type stub which is probably why this is showing up asany
. The latest version (8.0.2
) has it, however:then/promise@c988089
A less ideal but simpler alternative however could be to just remove
strict-local
onpolyfillPromise
, since it's (supposed to be) the only place where promise is required directly.(I am still not sure why it's working on CircleCI but not on my machine however 🤔 )