Skip to content

[Feature Request]: Export props for TypeScript components #16154

Closed

Description

The problem

In the @carbon/react project multiple components which have been converted into TypeScript in Carbon 11 are lacking either exports on their props,. Without access to the props, it is much more difficult to create wrappers for components, pass along props as part of parent components, and assigning types to objects that can help build out components neatly. This has affected my team's efforts to move over from Carbon 10 to 11.

For example, in my team's product we leverage the base component's props (aliased here as CarbonAccordionProps) to create the typings for a wrapper for the Accordion component with a simple overwrite. Without these props, we would have to redefine all of the parameters in our codebase by hand, which would open us up to issues down the road if the Carbon component's props change.

image

Included here is a list of all props that are missing exports that my team have found. Note that there may be additional components with this issue that we haven't identified yet.

Tasks

  1. component: accordion severity: 3
    riddhybansal
  2. component: overflow-menu severity: 3
    Gururajj77
  3. component: structured-list severity: 3
    riddhybansal
  4. component: button severity: 3
    riddhybansal
  5. component: button severity: 3
    riddhybansal
  6. severity: 3
    riddhybansal
  7. component: dropdown severity: 3
    riddhybansal
  8. component: form severity: 3
    riddhybansal
  9. component: grid severity: 3
    riddhybansal
  10. component: loading severity: 3
    Gururajj77
  11. component: loading severity: 3
    Gururajj77
  12. component: modal severity: 3
    Gururajj77
  13. component: number-input severity: 3
    Gururajj77
  14. component: progress-bar component: progress-indicator severity: 3
    Gururajj77
  15. area: typescript component: content-switcher severity: 3 type: bug 🐛
    Gururajj77
  16. component: tabs severity: 3
    Gururajj77
  17. component: text-input severity: 3
    Gururajj77
  18. component: text-input severity: 3
  19. component: tooltip severity: 3
    Gururajj77
  20. component: list component: tile severity: 3
    Gururajj77

We've also noticed some components are missing an index.ts or .d.ts file - this has caused a similar issue when trying to import props belonging to that component. Below is a list of the components we've found with this issue:

Tasks

  1. component: password-input severity: 3
  2. component: tile severity: 3
    Gururajj77
  3. component: overflow-menu severity: 3
    Gururajj77
  4. Gururajj77

The solution

To fix this, we need to export the props (see attached for example of an interface lacking an export).

image

There are also some instances where a prop is missing an index.ts or .d.ts file - in those cases, we should be able to fix this issue by refactoring an existing index.js to index.ts. See below for an example of a healthy index.ts file.

image

Examples

No response

Application/PAL

IBM Storage Fusion

Business priority

Medium Priority = upcoming release but is not pressing

Available extra resources

No response

Code of Conduct

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      ✅ Done
    • Status

      Completed 🚢

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions