Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
NumberControl: Add TypeScript prop types #43791
NumberControl: Add TypeScript prop types #43791
Changes from 7 commits
0f5a389
8f6edb1
786c1af
cb4fdb0
4473bd5
b9c1fe3
418e2db
d77a143
b2f34f1
c30c715
ddcc53a
aadc586
4212c0d
f759d35
fd7f905
6000e4b
fc7bcca
9cf3203
90948f0
4cda1ea
ba48ff7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
null
is an invalid value for theautoComplete
attribute.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.
Instead of "Investigate if this is wrong", should the comment be more about the fact that this error will only be solved once we make a decision on the
value
type?(same for the rest of the
@ts-expect-error
comments about the type of thevalue
prop)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.
Good call, I improved the TODO comments all around. 90948f0
One of the interesting causes was the
isValueEmpty()
util function. I was able to fix the typing, but it's a bit out of scope for this PR so I'll submit it separately.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.
Should this use
ensureNumber
?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.
This one can't be fixed by
ensureNumber
because the problem is thatnext
can potentially be undefined.Technically, we can remove the ts-ignore without changing effective runtime behavior by doing something like this:
But then again, I really think this one needs further investigation because it's unclear whether it's intended for
setValue()
to sometimes receive a NaN. It could actually be problematic, so I wouldn't want to imply that this behavior is legit.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.
label
variable is aReactNode
, butaria-label
only accepts strings. I went ahead and removed this redundantaria-label
, because the same value is added on line 270 vialabel
prop.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.
Noted. Basically the
input
will be labelled via an actuallabel
element (with thefor
attribute), instead of thearia-label
attribute 👌