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
Continuation of Flow updates 0.57+ #9203
Conversation
A sample of the API diff it's introducing: | Name | Type | Default | Description |
|:-----|:-----|:--------|:------------|
| classes | Object | | Useful to extend the style applied to components. |
-| <span style="color: #31a148">component *</span> | ElementType | 'div' | The component used for the root node. Either a string to use a DOM element or a component. |
+| <span style="color: #31a148">component *</span> | ElementType | 'div': ElementType | The component used for the root node. Either a string to use a DOM element or a component. | I'm wondering if we can avoid |
I think we'll have to hack off the flow type cast when we process it. |
type DefaultProps
…to flow-defaultprops # Conflicts: # pages/api/dialog.md # pages/api/drawer.md # pages/api/fade.md # pages/api/grid.md # pages/api/slide.md # pages/api/snackbar.md
With this PR, docs should be back to normal. We are now on a temp branch package I have put in an issue for that. |
@@ -34,6 +34,9 @@ export type Color = 'inherit' | 'accent' | 'action' | 'contrast' | 'disabled' | | |||
|
|||
type ProvidedProps = { | |||
classes: Object, | |||
/** | |||
* @ignore | |||
*/ | |||
theme?: 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.
I have been wondering, why to we put the theme here in the first place? I have noticed we can remove them with no flow issue.
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.
If we can remove them now with @rsolomon's latest PR to react-flow-types, we should do that.
@rosskevin Awesome, thank you! |
Closes #9222
This is a follow-on for #8983 by @rsolomon
Now that flow's treatment of
defaultProps
changed with flow0.57.0
, we no longer need to specifytype DefaultProps
separate fromtype Props
.The only quirk is that sometimes when a defaultProp is a union, it needs to be cast to the type specified in
type Props
, as it doesn't seem to be able to resolve it. Regardless, overall, it's a cut in code and due to reduced duplication.Also, since
type Props
is the single source of truth, I have fixed the maybe types that were missing in #8983 (due to the difficulty of duplicating these properties in bothProps
andDefaultProps
)Regarding
SwitchBase
, it was used as a typicalComponent
in all butRadio
, and even inRadio
, it was effectively used as a normal component there. It raised some stateless function flow errors so I simply removed the factory wrapper and exposed the underlyingSwitchBase
, it left usage virtually unchanged.