Skip to content

[Bug]: Recent TypeScript updates in v1.22.0 cause a bunch of typescript import errors for components that haven't been converted to typescript yet #13091

Open

Description

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.
image

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

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

Metadata

Assignees

No one assigned

    Type

    Projects

    • Status

      ⏱ Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions