-
Notifications
You must be signed in to change notification settings - Fork 621
fix: made textInput extra props optional #6341
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
fix: made textInput extra props optional #6341
Conversation
🦋 Changeset detectedLatest commit: 4f5f14b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Pull Request Overview
This PR fixes TypeScript type definitions for the TextInput component by making styling and layout props optional. The change addresses issue #6187 where props like block
, contrast
, disabled
, monospace
, sx
, width
, maxWidth
, minWidth
, variant
, size
, and validationStatus
were incorrectly treated as required, causing TypeScript compilation errors when using TextInput with minimal props.
Key changes:
- Wrapped the
Pick<StyledWrapperProps, ...>
type withPartial<>
to make all styling props optional - Maintains backward compatibility while fixing TypeScript errors for minimal usage patterns
Updated TypeScript types for TextInput component.
@joshblack is this ready to merge? |
Hey @ompharate! I believe so, will get it merged in today 🥳 Thanks again for taking the time to contribute! |
Closes #6187
Fixed TypeScript type definitions for TextInput component to make all styling and layout props optional as documented in the official Primer documentation. Previously, props like
block
,contrast
,disabled
,monospace
,sx
,width
,maxWidth
,minWidth
,variant
,size
, andvalidationStatus
were incorrectly treated as required, causing TypeScript errors when using TextInput with minimal props.Before
❌ Error: missing required props
After
✅ All styling props are optional
✅ Optional props work when provided
Changelog
TextInput: Fixed TypeScript type definitions to make all styling and layout props optional as documented in the official Primer documentation
Rationale: This is a patch release as it fixes incorrect TypeScript definitions without changing any runtime behavior or introducing breaking changes. The change makes the component easier to use by aligning TypeScript types with the documented API, but doesn't affect existing functionality.
Testing & Reviewing
To test this change:
TypeScript Compilation:
<TextInput />
with no props compiles without TypeScript errors<TextInput block contrast size="large" />
still work correctlyRuntime Behavior:
Storybook Testing:
Type Safety:
Partial<Pick<StyledWrapperProps, ...>>
pattern works correctlyKey areas to review:
TextInputNonPassthroughProps
interfaceMerge checklist
Note: Tests, documentation, and Storybook previews are not required for this change as it only fixes TypeScript type definitions without affecting runtime behavior. The existing tests and documentation remain valid. SSR compatibility is confirmed as this change only affects TypeScript types, not component rendering logic.