-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues importing icons via Visual Studio Code #82
Comments
The component name is The problem is that VSCode can't discover the component paths if they haven't at least one import. Why not import all icon components (+2000) in a single file? See this comment #70 (comment).
This performance issue was reported to TypeScript team (microsoft/TypeScript#47137), but the issue keeps open. Solutions? Create a single file with all module declarations: declare module "@suid/icons-material/Close" {
export = ...
}
... This declaration file could be loaded from "compilerOptions": {
"typeRoots": ["@suid/icons-material/types"]
} And this would help to VSCode to discover all icon components without scanning the entire icon folder. I will investigate this solution and other possible solutions. |
Thanks for your reply. Coincidentally, I was looking into this yesterday, and I noticed that suid icons doesn't include the index.d.ts and index.js that @mui provided that exports all of the icons individually. I can understand that is a lot of work, so in the meantime, it is easier for devs to create a separate file to import and export their own icons. e.g.
|
Actually, since this is a port of mui, the index.d.ts file for @uid/icons-material is almost identical to @mui version, (apart from the main import declaration). I think just by providing a similar index file export would be sufficient to get code editors to locate the icons. i.e. index.d.ts file:
|
Closed via a0fa4dd. Example: https://stackblitz.com/edit/angular-htvruk?file=src%2FApp.tsx Remember use the // vite.config.ts
import { defineConfig } from 'vite';
import solidPlugin from 'vite-plugin-solid';
import suidPlugin from '@suid/vite-plugin';
export default defineConfig({
plugins: [suidPlugin(), solidPlugin()],
build: {
target: 'esnext',
},
}); |
Say I have an icon I create via:
<CloseIcon onClick={() => setClosed(true)} />
VS code is not able to suggest an import. I have to manually type it in:
import CloseIcon from '@suid/icons-material/Close';
Am I missing a dependency?
The text was updated successfully, but these errors were encountered: