Description
openedon Feb 3, 2023
Package
@carbon/react
Browser
Chrome, Edge
Package version
@carbon/react: "1.22.0"
React version
react: "16.14.0"
Description
Just upgraded to @carbon/react: "1.22.0"
which introduced some typescript
updates and now all the carbon components that do not have .ts
files in their component directories (e.g. a majority of them) fail to load from @carbon/react
. In the below screenshot you'll see that both FormContext
& FluidForm
components import OK as they have .ts
files in their directory but the other components that do not all error out.
This was discussed in more detail in https://ibm-industrysolutions.slack.com/archives/C03C8VASVED/p1675447829358449.
A temporary workaround is to update your d.ts
file to include declare module "@carbon/react"
(see 1 from screenshot below). However, anything that uses React.forwardRef
, React.createRef
or React.RefObject
that references a Carbon component will still have issues (see 2 from screenshot below). The workaround for this is to add a @ts-ignore
tag above the line in question.
The downsides of having to do the above workarounds is that components will neither autocomplete
nor autoimport
which is a big pain and all components that are imported by @carbon/react
are treated as type any
.
A suggested fix in the slack thread was to provide a index.d.ts
that has unconverted components typed as any
so that people can still import them even though they are not converted yet.
Suggested Severity
Severity 1 = Must be fixed ASAP. The response must be swift. Someone from the team must drop all current work and be immediately reassigned to address the issue.
Reproduction/example
See slack thread discussed in more detail in https://ibm-industrysolutions.slack.com/archives/C03C8VASVED/p1675447829358449
Steps to reproduce
See slack thread discussed in https://ibm-industrysolutions.slack.com/archives/C03C8VASVED/p1675447829358449
Code of Conduct
- I agree to follow this project's Code of Conduct
- I checked the current issues for duplicate problems
Metadata
Assignees
Labels
Type
Projects
Status
⏱ Backlog