Skip to content

[Bug]: @carbon/react/icons module does not provide IDE import auto-complete #11317

Closed

Description

Package

@carbon/react

Browser

No response

Package version

1.1.0

React version

not specific to a version of react

Description

When importing icons via the @carbon/react/icons re-export, no auto-completions are provided in VS Code:

image

versus @carbon/icons-react which looks like:

image

It doesn't look like the IDE auto-completion is smart enough to follow the combination of Object.keys and Object.defineProperty to provide the exhaustive list of icons that are available at runtime/build time.

image

Though I'm not sure exactly how to accomplish it, it seems like a more direct re-export of the icons from the required module would be what is needed to get past this.

There's also an info message that pops up in vscode for this import which is not present on the icons-react version:

image

versus icons-react which has a full-blown d.ts file to which it links that provides type info:

image

CodeSandbox example

n/a

Steps to reproduce

  1. Install @carbon/react into a React project
  2. Open a component file in an IDE like VS Code
  3. Attempt to import an icon from @carbon/react/icons
  4. Observe that the auto-complete list does not show any of the available icons

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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions