react
react copied to clipboard
Importing icons from `@phosphor-icons/react/dist/ssr` renders the icons, but gives issues in the editor
This is the issue description I get from typing:
import { Fish } from '@phosphor-icons/react/dist/ssr';
Could not find a declaration file for module '@phosphor-icons/react/dist/ssr'. 'C:/Work/Projekty/Dezarto/dezarto-next/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@phosphor-icons/react/dist/ssr/index.mjs' implicitly has an 'any' type. There are types at 'c:/Work/Projekty/Dezarto/dezarto-next/node_modules/@phosphor-icons/react/dist/ssr/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@phosphor-icons/react' library may need to update its package.json or typings.ts(7016)
Despite that, the icon renders correctly in dev. It does, however, disable autocomplete suggestions in the editor, which makes working with icons harder.
I noticed this happens when using "moduleResolution": "bundler"
on tsconfig, changing away from it solves the problem, but doesn't sound good to change it.
New projects with Vite or even Next now start up with that setting by default.
I have found reports that VSCode isn't 100% ready for "moduleResolution": "bundler"
. This may be the cause, as I see no fundamental issue with our typings, or with our exports
declaration in package.json. If you have any suggestions, I'm happy to hear them.
Im getting the same warning in VSCode. Everything works fine tho.
Did you guys find a way to fix this?
same problem here.
Can anyone please share a minimal reproduction of this in a Stickblitz or repo?