tailwindlabs / heroicons

A set of free MIT-licensed high-quality SVG icons for UI development.
https://heroicons.com
MIT License
21.03k stars 1.27k forks source link

Typescript support seems broken after 2.0.0 release #858

Closed lucasgadams closed 1 year ago

lucasgadams commented 1 year ago

On a new project I installed heroicons/react@latest (2.0.12). Trying to import like so: import { ChevronDownIcon } from "@heroicons/react/solid"; and then yarn build I get this error:

Type error: Could not find a declaration file for module '@heroicons/react/solid'. '.../node_modules/@heroicons/react/solid/index.js' implicitly has an 'any' type.

I reverted the library to 2.0.0 and the issue was the same. I reverted further to a previous project version (1.0.6) and the issue was fixed. Did the typescript support get dropped?

adamwathan commented 1 year ago

Hey! That path you are importing from doesn’t exist in v2. Check the upgrade guide in the release notes: https://github.com/tailwindlabs/heroicons/releases/tag/v2.0.0

acomito commented 1 year ago

hmm... still not working for me in a CRA app

Cannot find module '@heroicons/react/20/solid' or its corresponding type declarations.ts(2307)
    "@heroicons/react": "^2.0.12",
lucasgadams commented 1 year ago

Ah yes, my mistake, thanks!.

Upgraded to "@heroicons/react": "^2.0.12", and now import { ChevronDownIcon } from "@heroicons/react/20/solid"; works.

lack-of-gravitas commented 1 year ago

Still borked -- doesn't work for the following icons

image

reinink commented 1 year ago

@lack-of-gravitas Hey, this doesn't look like a TypeScript issue, but rather just an icon name change from v1 to v2. The XIcon is now XMarkIcon, and MenuAlt2Icon is now Bars3BottomLeftIcon.

You can see a list of all the icon name changes in our release notes here: https://github.com/tailwindlabs/heroicons/releases/tag/v2.0.0