mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-13 13:48:26 +00:00
`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>
99 lines
3.2 KiB
JSON
99 lines
3.2 KiB
JSON
{
|
|
"name": "lucide-react-native",
|
|
"description": "A Lucide icon library package for React Native applications.",
|
|
"version": "0.0.1",
|
|
"license": "ISC",
|
|
"homepage": "https://lucide.dev",
|
|
"bugs": "https://github.com/lucide-icons/lucide/issues",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://github.com/lucide-icons/lucide.git",
|
|
"directory": "packages/lucide-react-native"
|
|
},
|
|
"keywords": [
|
|
"Lucide",
|
|
"React Native",
|
|
"Feather",
|
|
"Icons",
|
|
"Icon",
|
|
"SVG",
|
|
"Feather Icons",
|
|
"Fontawesome",
|
|
"Font Awesome"
|
|
],
|
|
"author": "Eric Fennis",
|
|
"amdName": "lucide-react-native",
|
|
"main": "dist/cjs/lucide-react-native.js",
|
|
"module": "dist/esm/lucide-react-native.mjs",
|
|
"typings": "dist/types/lucide-react-native.d.ts",
|
|
"react-native": "dist/esm/lucide-react-native.mjs",
|
|
"exports": {
|
|
".": {
|
|
"types": "./dist/types/lucide-react-native.d.ts",
|
|
"react-native": "./dist/esm/lucide-react-native.mjs",
|
|
"import": "./dist/esm/lucide-react-native.mjs",
|
|
"browser": "./dist/esm/lucide-react-native.mjs",
|
|
"require": "./dist/cjs/lucide-react-native.js"
|
|
},
|
|
"./icons": {
|
|
"types": "./dist/types/icons.d.ts",
|
|
"react-native": "./dist/esm/icons/index.mjs",
|
|
"import": "./dist/esm/icons/index.mjs",
|
|
"browser": "./dist/esm/icons/index.mjs",
|
|
"require": "./dist/cjs/icons/index.js"
|
|
},
|
|
"./icons/*": {
|
|
"types": "./dist/types/icons/*.d.ts",
|
|
"react-native": "./dist/esm/icons/*.mjs",
|
|
"import": "./dist/esm/icons/*.mjs",
|
|
"browser": "./dist/esm/icons/*.mjs",
|
|
"require": "./dist/cjs/icons/*.js"
|
|
}
|
|
},
|
|
"sideEffects": false,
|
|
"files": [
|
|
"dist"
|
|
],
|
|
"scripts": {
|
|
"build": "pnpm clean && pnpm copy:license && pnpm build:icons && pnpm build:bundles",
|
|
"copy:license": "cp ../../LICENSE ./LICENSE",
|
|
"clean": "rm -rf dist && rm -rf stats && rm -rf ./src/icons/*.ts",
|
|
"build:icons": "build-icons --output=./src --templateSrc=./scripts/exportTemplate.mts --renderUniqueKey --iconFileExtension=.ts --exportFileName=index.ts --withAliases --separateAliasesFile --separateAliasesFileIgnore=fingerprint --aliasesFileExtension=.ts",
|
|
"build:bundles": "rollup -c ./rollup.config.mjs",
|
|
"test": "pnpm build:icons && vitest run",
|
|
"test:watch": "vitest watch",
|
|
"typecheck": "pnpm build:icons && tsc"
|
|
},
|
|
"devDependencies": {
|
|
"@lucide/build-icons": "workspace:*",
|
|
"@lucide/helpers": "workspace:*",
|
|
"@lucide/rollup-plugins": "workspace:*",
|
|
"@lucide/shared": "workspace:*",
|
|
"@testing-library/jest-dom": "^7.0.1",
|
|
"@testing-library/react": "^16.3.3",
|
|
"@types/prop-types": "^15.7.15",
|
|
"@types/react": "^18.3.31",
|
|
"@vitejs/plugin-react": "^5.2.0",
|
|
"jest-serializer-html": "^7.1.0",
|
|
"react": "18.3.1",
|
|
"react-dom": "18.3.1",
|
|
"react-native": "^0.87.1",
|
|
"react-native-svg": "^15.15.5",
|
|
"rollup": "^4.63.1",
|
|
"rollup-plugin-dts": "^6.5.1",
|
|
"typescript": "^6.0.3",
|
|
"vite": "^7.3.6"
|
|
},
|
|
"peerDependencies": {
|
|
"@types/react": "*",
|
|
"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
"react-native": "*",
|
|
"react-native-svg": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0"
|
|
},
|
|
"peerDependenciesMeta": {
|
|
"@types/react": {
|
|
"optional": true
|
|
}
|
|
}
|
|
}
|