-
-
Notifications
You must be signed in to change notification settings - Fork 668
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
react-intl types: Move definitions out of flow-typed libdef #5311
Conversation
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.
Thanks @chrisbobbe! This all looks good except one item below.
flow-typed/react-intl_vx.x.x.js
Outdated
{| | ||
formats: mixed, | ||
messages: mixed, | ||
timeZone: mixed, |
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 isn't quite right -- to match the intended behavior it needs to be timeZone?: mixed
, unfortunately:
* A limitation: this implementation can't tell which properties are
* *optional* in T, i.e. spelled with `?:`, as in `foo?: number`. Instead,
* properties in the result will be optional or required based on how they
* are in U. To avoid confusion, be sure to make the same properties
* optional in U as are optional in T.
I.e., IntlConfig
has timeZone
optional, so this needs to have timeZone
optional as well in order to make it optional in the result.
(Similarly some other properties.)
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.
Thanks for catching this! I think I've got them all in the new revision.
We moved this stuff to our types/@react-navigation/ in zulip#5263, and we already have a line for that in this file.
This doesn't actually improve Flow coverage or change any types; both Omit and Exclude are utility types in TypeScript that Flow doesn't have. But in the original TypeScript, the use of Exclude for these was a mistake; they should have been Omit; see discussion at zulip#5308 (comment) We're about to go through all uses of Omit and replace them with something that works; these will then be fixed.
…onfig As suggested by Greg at zulip#5308 (comment)
The React$Component type asks for a type argument, and one wasn't getting passed. Instead of working out what exactly to pass, use this form, which is more concise and probably more appropriate anyway.
…lity As suggested by Greg: zulip#5308 (comment) This definition is copied from our src/generics.js. When we move this libdef to a .js.flow file, we'll deduplicate the definition by importing it from src/generics.
…lity As suggested by Greg: zulip#5308 (comment)
To see that only whitespace is changed, view the diff with git diff -w
84a2abd
to
96524ab
Compare
Thanks for the review! Revision pushed. |
Thanks! Looks good -- merging. |
This covers Greg's responses starting from #5308 (comment) and moves the react-intl libdef into a .js.flow file.