fix: Correct types for customInput property - #827
Open
splatonov92 wants to merge 3 commits into
Open
Conversation
s-yadav
reviewed
Feb 25, 2024
| Omit<InputAttributes, keyof BaseType> & | ||
| Omit<BaseType, keyof Props | 'ref'> & { | ||
| customInput?: React.ComponentType<BaseType>; | ||
| customInput?: React.ComponentType<React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>; |
Owner
There was a problem hiding this comment.
This will force the customInput to be type of Input element. While custom Input can be any component, and the NumberFormatProps inherits from there.
Please check on number_format.spec.tsx, it must be failing.
Author
There was a problem hiding this comment.
let me try to fix it, may be I need to rewrite a couple of types
splatonov92
commented
Aug 18, 2024
|
|
||
| export type InputAttributes = Omit< | ||
| React.InputHTMLAttributes<HTMLInputElement>, | ||
| 'defaultValue' | 'value' | 'children' |
Author
There was a problem hiding this comment.
FMI: why do you need to omit 'defaultValue' | 'value' from InputAttributes?
splatonov92
force-pushed
the
fix-customInput-type
branch
from
August 18, 2024 14:30
99d26af to
634c28c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Describe the issue/change
Any component containing
valueprops can not be passed ascustomInputproperty. Despite the fact that typing prohibits passing thecustomInputwithvalue,number_format_basepasses all props includingvaluetocustomInput.Add CodeSandbox link to illustrate the issue (If applicable)
Describe specs for failing cases if this is an issue (If applicable)
Describe the changes proposed/implemented in this PR
@ts-ignoredirectiveLink Github issue if this PR solved an existing issue
Example usage (If applicable)
Screenshot (If applicable)
Please check which browsers were used for testing