react icon indicating copy to clipboard operation
react copied to clipboard

Importing icons from `@phosphor-icons/react/dist/ssr` renders the icons, but gives issues in the editor

Open nikita-bashaiev opened this issue 1 year ago • 5 comments

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.

nikita-bashaiev avatar Nov 03 '23 11:11 nikita-bashaiev

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.

josepholiveira avatar Nov 17 '23 15:11 josepholiveira

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.

rektdeckard avatar Nov 23 '23 00:11 rektdeckard

Im getting the same warning in VSCode. Everything works fine tho.

Did you guys find a way to fix this?

atralice avatar Mar 28 '24 15:03 atralice

same problem here.

LeonardoMeireles55 avatar Mar 30 '24 12:03 LeonardoMeireles55

Can anyone please share a minimal reproduction of this in a Stickblitz or repo?

rektdeckard avatar Apr 18 '24 20:04 rektdeckard