Description
openedon Apr 9, 2024
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.
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.
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:
The solution
To fix this, we need to export the props (see attached for example of an interface lacking an export).
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.
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
- I agree to follow this project's Code of Conduct