@types/react as an optional peer dependency (#4892)
`lucide-react` and `lucide-react-native` both ship `.d.ts` files that import React types (`ForwardRefExoticComponent`, `SVGProps`, `RefAttributes`, `ReactNode`), but neither package declares `@types/react`. Under a hoisted `node_modules` this resolves by accident, so the gap is invisible in normal testing. It does not resolve under a strict layout — most notably pnpm's global virtual store (`enableGlobalVirtualStore`), where each package is linked from a store path outside the consuming repo. TypeScript resolves a package's imports relative to where that package physically lives and ignores `NODE_PATH`, so `react` resolves to the untyped `react/index.js`. Every icon's props silently degrade to `any`, and consumers hit implicit-any errors on their own callbacks under `noImplicitAny`. `skipLibCheck: true` hides the errors inside the `.d.ts` itself, which is why this survives most typechecks. Declaring the typings package as a peer dependency (rather than a hard dependency) lets it dedupe against whatever `@types/react` the consumer already has. `peerDependenciesMeta` marks it optional so JS-only consumers get no unmet-peer warning. Verified by packing each package and installing the tarball into a scratch consumer with `pnpm --virtual-store-dir` pointing outside the consumer, then typechecking with `skipLibCheck: false` and a `@ts-expect-error` probe on a nonexistent icon prop — a positive type assertion keeps passing when types widen to `any`, so it would not catch a regression. Before the change the probe reports `TS2578: Unused '@ts-expect-error' directive` plus `TS7016` inside the shipped `.d.ts`; after it, `tsc` is clean and `--traceResolution` shows `react` resolving to `@types/react/index.d.ts` instead of `react/index.js`. Existing peer ranges are unchanged and the lockfile is unaffected. Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
Icons · Guide · Packages · License · Showcase
Lucide
Lucide is an open-source icon library that provides 1600+ vector (svg) files for displaying icons and symbols in digital and non-digital projects. The library aims to make it easier for designers and developers to incorporate icons into their projects by providing several official packages to make it easier to use these icons in your project.
Packages
| Logo | Package | Version | Downloads | Links |
|---|---|---|---|---|
lucide |
Docs · Source | |||
lucide-react |
Docs · Source | |||
@lucide/vue |
Docs · Source | |||
@lucide/svelte |
Docs · Source | |||
lucide-solid |
Docs · Source | |||
lucide-preact |
Docs · Source | |||
lucide-react-native |
Docs · Source | |||
@lucide/angular |
Docs · Source | |||
@lucide/astro |
Docs · Source | |||
lucide-static |
Docs · Source |
Figma
The Lucide Figma plugin.
Visit Figma community page to install the plugin.
Contributing
For more info on how to contribute please see the contribution guidelines.
Caught a mistake or want to contribute to the documentation? Edit this page on Github
About brand logos
Lucide does not accept brand logos, and we do not plan to add them in the future. This is due to a combination of legal restrictions, design consistency concerns, and practical maintenance reasons.
Click here to read our official statement about brand logos in Lucide.
Community
Join the community on our Discord server!
License
Lucide is totally free for commercial use and personal use, this software is licensed under the ISC License.
Credits
Thank you to all the people who contributed to Lucide!
Sponsors
Hero backers 🦸
Awesome backers 🍺
Backers ☕
Other contributors 💸
You can find all our past and non-recurring financial contributors at our Open Collective page.
