Skip to content
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

[feat] Export component props #2587

Open
brandonlenz opened this issue Sep 14, 2023 · 1 comment
Open

[feat] Export component props #2587

brandonlenz opened this issue Sep 14, 2023 · 1 comment
Labels
good first issue Good for newcomers Hacktoberfest type: feature New feature or request

Comments

@brandonlenz
Copy link
Contributor

brandonlenz commented Sep 14, 2023

Does your feature request relate to a specific USWDS component?

All components, we should make it a convention going forward to export their props

Is your feature request related to a problem? Please describe.

Sometimes consumers want to get TS access to the props our components accept. It's not always easy/intuitive to do so.

Describe the solution you'd like

export all our component prop type definitions, similar to https://github.com/react-bootstrap/react-bootstrap/blob/master/src/index.tsx.

Note: We union our props with IntrinsicElements[THE_ROOT_ELEMENT] pretty often, inline in the component args. We would want those exported with the type, so it might require small refactors to perform the union when declaring the type instead.

Describe alternatives you've considered

The workaround today is for consumers to use ComponentProps, e.g.

type TheProps = ComponentProps<typeof TheReactUswdsComponent>
@werdnanoslen
Copy link
Contributor

werdnanoslen commented Feb 23, 2024

Would #2728 and #2666 together resolve this issue fully?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers Hacktoberfest type: feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants