Skip to content

chore: apply namespace pattern for component props (part 2)#767

Merged
kurtdoherty merged 1 commit intomainfrom
chore-apply-namespace-pattern-for-component-props-part-2
Sep 11, 2025
Merged

chore: apply namespace pattern for component props (part 2)#767
kurtdoherty merged 1 commit intomainfrom
chore-apply-namespace-pattern-for-component-props-part-2

Conversation

@kurtdoherty
Copy link
Contributor

@kurtdoherty kurtdoherty commented Sep 11, 2025

Context

  • Some components currently export their prop interfaces, while others do not. This leads to an inconsistent experience for consumers.
  • Further, when exporting component props via a separate export to the component itself, this forces consumers to have two separate imports, one for the component and another for the component's props. This does provide any improvement over the use of React's ComponentProps.
  • To provide a consistent approach, and to help consumers avoid needing to separately import component props, the following pattern will be applied to all core components:
export namespace MyComponent {
  export Props extends ... {
    ...
  }
}

export function MyComponent(props: MyComponent.Props) {
  ...
}

This way, when consumers import MyComponent, they will automatically have access to its prop interface via MyComponent.Props.

Past PRs include:

This PR

Applies this namespace pattern for component props to another group of components:

  • AppSwitcher
  • BottomBar
  • Breadcrumbs
  • ChipSelect

@rpt-uk-github
Copy link

rpt-uk-github commented Sep 11, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

code/snyk check is complete. No issues have been found. (View Details)

@kurtdoherty kurtdoherty marked this pull request as ready for review September 11, 2025 01:58
@codacy-production
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 245d7b51 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (245d7b5) Report Missing Report Missing Report Missing
Head commit (59d1ff7) 9233 8543 92.53%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#767) 20 20 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants