-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[Flow] Define Flow types for style and stylesheet objects, more checking #8882
Conversation
By analyzing the blame information on this pull request, we identified @sahrens and @prometheansacrifice to be potential reviewers. |
@yungsters can you take a look? |
Oh this is actually not adding any new strictness, I can just ship it, thanks |
@facebook-github-bot shipit |
Thanks for importing. If you are an FB employee go to Phabricator to review internal test results. |
Can you rebase? |
- Define a Styles type for the object that gets passed into StyleSheet.create - Define a StyleSheet type that is returned from StyleSheet.create - Clean up the type declarations in StyleSheet.create Test Plan: `flow`
276ece9
to
23d77dd
Compare
I tried to merge this pull request into the Facebook internal repo but some checks failed. To unblock yourself please check the following: Does this pull request pass all open source tests on GitHub? If not please fix those. Does the code still apply cleanly on top of GitHub master? If not can please rebase. In all other cases this means some internal test failed, for example a part of a fb app won't work with this pull request. I've added the Import Failed label to this pull request so it is easy for someone at fb to find the pull request and check what failed. If you don't see anyone comment in a few days feel free to comment mentioning one of the core contributors to the project so they get a notification. |
@facebook-github-bot shipit |
@@ -17,6 +17,9 @@ var StyleSheetValidation = require('StyleSheetValidation'); | |||
|
|||
var flatten = require('flattenStyle'); | |||
|
|||
export type Styles = {[key: string]: Object}; |
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.
Could be {[key: string]: {[key: string]: any} }
right?
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.
Isn't {[key: string]: any}
the same as Object?
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.
@ide Not exactly sure how Flow works here. Do arrays also count as objects? If not then they are same :)
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.
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.
@ide Cool then
Thanks for importing. If you are an FB employee go to Phabricator to review internal test results. |
It finds some more internal bad code. Someone needs to fix them internally first. |
I tried to merge this pull request into the Facebook internal repo but some checks failed. To unblock yourself please check the following: Does this pull request pass all open source tests on GitHub? If not please fix those. Does the code still apply cleanly on top of GitHub master? If not can please rebase. In all other cases this means some internal test failed, for example a part of a fb app won't work with this pull request. I've added the Import Failed label to this pull request so it is easy for someone at fb to find the pull request and check what failed. If you don't see anyone comment in a few days feel free to comment mentioning one of the core contributors to the project so they get a notification. |
For some reason, internally this is failing with
|
That error doesn't make sense to me, reading the code and running @facebook-github-bot shipit |
I will not rubber stamp and land your change for you @ide! I can import it for you and you can get your change reviewed by someone though :) |
@facebook-github-bot shipit |
Thanks for importing.If you are an FB employee go to Phabricator to review internal test results. |
I tried to merge this pull request into the Facebook internal repo but some checks failed. To unblock yourself please check the following: Does this pull request pass all open source tests on GitHub? If not please fix those. Does the code still apply cleanly on top of GitHub master? If not can please rebase. In all other cases this means some internal test failed, for example a part of a fb app won't work with this pull request. I've added the Import Failed label to this pull request so it is easy for someone at fb to find the pull request and check what failed. If you don't see anyone comment in a few days feel free to comment mentioning one of the core contributors to the project so they get a notification. |
It's possible that improving the types like this exposes mistakes in user code. If you need help I can assist in the merge on Monday |
Ok, fixed this up and landing it! The flow error wasn't occurring within the react-native code, but rather in some code that uses react-native. Specifically, it was a jest mock that mocked |
8eed600
@gabelevi thanks so much for looking into the issue and merging this =) |
Summary: - Define a Styles type for the object that gets passed into StyleSheet.create - Define a StyleSheet type that is returned from StyleSheet.create - Clean up the type declarations in StyleSheet.create Closes facebook#8882 Differential Revision: D3587964 Pulled By: gabelevi fbshipit-source-id: 629e0176484436848be69b1417638e1200a3669a
Summary: - Define a Styles type for the object that gets passed into StyleSheet.create - Define a StyleSheet type that is returned from StyleSheet.create - Clean up the type declarations in StyleSheet.create Closes facebook#8882 Differential Revision: D3587964 Pulled By: gabelevi fbshipit-source-id: 629e0176484436848be69b1417638e1200a3669a
Test Plan:
flow