Repository navigation
[styled-components]: Add withConfig method and 5.1 support - #43718
Conversation
|
@danilofuchs Thank you for submitting this PR! 🔔 @Igorbek @Igmat @lavoaster @Jessidhia @jkillian @eps1lon @flavordaaave @wagerfield @Lazyuki @mgoszcz2 - please review this PR in the next few days. Be sure to explicitly select If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
|
CMIIW, but I think the |
It is optional on the consumer end. The library always provides the second argument. As you can see in this test, the client can omit If I changed it to be optional, every time someone might want to use shouldForwardProp: (prop, defaultValidatorFn) => defaultValidatorFn && defaultValidatorFn(prop)
// OR
shouldForwardProp: (prop, defaultValidatorFn) => defaultValidatorFn?.(prop) |
ff38490 to
5e96304
Compare
|
@danilofuchs Ah, I didn't see that test. All is good on my end, then. |
|
After 5 days, no one has reviewed the PR 😞. A maintainer will be reviewing the PR in the next few days and will either merge it or request revisions. Thank you for your patience! |
|
I just published |
Closes #43693
Adds types for
styled("div").withConfig({})and theshouldForwardPropconfig.I made this method generic, so the user can provide correct prop types before filtering (but this may be confusing).
I realized
withConfigis a validstyled-componentsprop for a while now, and https://github.com/styled-components/styled-components/pull/3006/files#diff-b97c58d0b5d2df2981674fb8779b99bbR72 has all the flow type definitions for this function's parameters. A further PR is needed to provide these parameter types.npm test.)npm run lint package-name(ortscif notslint.jsonis present).Select one of these and delete the others:
If changing an existing definition:
https://github.com/styled-components/styled-components/pull/3006/files
https://github.com/styled-components/styled-components/releases/tag/v5.1.0