SelectControl: mark the children prop as optional#37872
Conversation
|
Size Change: 0 B Total Size: 1.13 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
This looks good to me.
I just wonder why InputBaseProps requires children in the first place. It doesn't make much sense to me.
Edit: Oh, okay! It looks like InputBase is just a wrapper for an input field. Maybe SelectControl should use InputControlProps instead?
aaronrobertshaw
left a comment
There was a problem hiding this comment.
Thanks for fixing this one @ciampo 👍
✅ Confirmed the typing errors prior to checking out this PR
✅ Confirmed the error was resolved after applying these changes
✅ Tests pass
Edit: Oh, okay! It looks like InputBase is just a wrapper for an input field. Maybe SelectControl should use InputControlProps instead?
I gave this a quick test and it looks like we need to then omit other props e.g. value, onChange etc. The current use of InputBaseProps appears cleanest to me.
andrewserong
left a comment
There was a problem hiding this comment.
Thanks @ciampo! Just adding another ✅ while I'm here, too. Confirmed the TS error in color-picker/component.tsx before this PR, and that it's resolved after applying the PR 👍
|
Thanks all for the review! Will rebase, solve conflicts, and merge as soon as checks are ✅
I tend to agree with @aaronrobertshaw |
5e8d598 to
e84fbcb
Compare
* `SelectControl`: mark the `children` prop as optional * Update prop documentation * Rename Storybook example * Changelog
Description
This PR fixes a regression introduced by #29540, where the
childrenprop of theSelectControlcomponent was introduced and marked as non-optional.This PR sets the
childrenprop as optional in the TypeScript definitions. It also updates the docs and the storybook example (although these changes are minor)How has this been tested?
Without changes from this PR
packages/components/src/color-picker/component.tsxfile in a text editor that supports TypeScript lintingSelectControlcomponent about not definingchildrenWith changes from this PR
Types of changes
Checklist:
*.native.jsfiles for terms that need renaming or removal).