fix: Exclude placeholder prop from Modal props #2727
Closed
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.
Summary
The types generated for Modal props indicate that
placeholder
is available because@types/react
prior to v18.2.43 hasplaceholder
as an attribute inHTMLAttributes
. Beginning with@types/react
v18.2.43, theplaceholder
attribute has been removed fromHTMLAttributes
. As a result, projects that consume this package but are themselves on@types/react
v18.2.43 or newer no longer recognizeplaceholder
as an optional property; they see it as stemming from these Modal props rather thanJSX.IntrinsicElements['div']
, and that it is required, not optional.Patch Modal to manually omit placeholder from available properties without updating packages, which would require a more significant lift.
Ref: DefinitelyTyped/DefinitelyTyped#67170
How To Test
@types/react
v18.2.48.<Modal>
component without defining theplaceholder
attribute.placeholder
is required but not defined:Additional Notes
@types/react
to v18.2.48. That PR requires a major version update though, whereas this fix is safe to apply as a patch update.lib/components
for string"placeholder"
. The only other component where theplaceholder
attribute appears explicitly isFileInput
and there it is supported (HTMLInputElement
instead ofHTMLDivElement
).