-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
RangeControl: Convert component to TypeScript #40535
Conversation
Size Change: +36 B (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
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.
Great job so far, @aaronrobertshaw !
I have a couple of observations / questions:
-
Is there particular reason why only some components are typed through
WordPressComponentProps
? (RangeMark
,RangeRail
,Marks
are not) -
Regarding the
value
prop:- we should consider if we should type it as
number | string
, and handle any parsing internally. - we should also try to align the
null
andundefined
instances, and try to pick one out of the two
- we should consider if we should type it as
I appreciate the early feedback @ciampo, thank you 👍
I don't believe there was any reason except that I missed
I think from the I'm probably missing something here so happy to take on board any further suggestions.
Thanks for the heads up. I've had a quick look at those PRs and it's probably best if they do land first given their importance and functional changes. I'll try and help out with reviews or testing on those, then resolve the ensuing conflicts on this PR. |
Thank you! And you're right re.
The point that you make is totally valid, and is actually the main point of debate around converting to TypeScript the
And so, by picking the Here's a few considerations off the top of my head:
Probably the best way to move forward, considering that We should also assess how (curious to know that @mirka thinks about this) (Coincidentally, we have a related conversation on the PR migrating
Agreed, thank you for understanding and prioritizing accordingly! |
This sounds reasonable to me. To be honest I don't have much useful thoughts to add here since I haven't actually fought this particular chain of dragons yet 😇 |
0013ca3
to
aaec90c
Compare
c8a8013
to
5150ade
Compare
5150ade
to
3ac6020
Compare
a7a5e07
to
78783d3
Compare
Thank you for the update! Let us know once this PR is ready for another round of review :) |
165ecdd
to
a94465f
Compare
See: #40535 (comment) for more information on why we are ignoring this error. TL;DR we are looking to address some conflicts between input control types for their value props.
a435f81
to
f19616e
Compare
Depends On:
Related:
What?
Converts the
RangeControl
component to TypeScript.(Unit tests and story TypeScript conversions are in separate PRs, #41444 & #41445)
Why?
While looking to create a new component combining both a
UnitControl
andRangeControl
(#40462) it presented an opportunity to improve the slider components we offered in a more composable way.The first step in this process was to type the
RangeControl
component.See #40507 for more details.
How?
Refactors the current
RangeControl
to TypeScript.Testing Instructions
npm run dev:package-types
and ensure no typing errorsnpm run test-unit packages/components/src/range-control/test/
and check they all pass