-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 Flow type for withTheme #1397
Fix Flow type for withTheme #1397
Conversation
🦋 Changeset is good to goLatest commit: 0708342 We got this. Not sure what this means? Click here to learn what changesets are. |
3f3b536
to
e45175d
Compare
So there is a flow error present, and I'm not sure how to fix this as it's apparently a valid error according to the flow issue: facebook/flow#7612 It looks like this kind of error is due to the EDIT: Doing some more thinking - I could just disable flow on that line. This may only cause issues if a flow user is relying on the hoisted statics. |
I'd be happy with a |
e45175d
to
0708342
Compare
OK, thanks for the confirmation. I've pushed up a fix with the |
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!!
@@ -30,6 +30,7 @@ test(`withTheme(Comp) hoists non-react static class properties`, () => { | |||
const ComponentWithTheme = withTheme(ExampleComponent) | |||
|
|||
expect(ComponentWithTheme.displayName).toBe('WithTheme(foo)') | |||
// $FlowFixMe |
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 would have made sense to add an explanation of why this is needed, for future reference.
I guess it's too late.
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.
'tis never too late! Made a new PR #1399
What: Flow Typeing for
withTheme
isn't correctly altering props.Why: As mentioned in comment you can't use
withTheme
easily with flow prop types.How: Switching the
React.ComponentType
toReact.AbstractComponent
. To do this also changed it to a normal function as that displays the flow types in a more consise and clear way.Checklist: