-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
feat: make SVG type override work #12043
Conversation
I feel like this should be supported in TypeScript instead. Otherwise this introduces a new API and only works with default exports of |
It would be ideal if TypeScript supports this. But it's a difficult one and I guess it will take a while. As |
Thanks for the reactivity on this! IMHO I think we're trying to solve a problem that doesn't depend on Vite directly. It's the And indeed, @sapphi-red , I think that your suggestion to use precise syntax when using Plugins like vite-plugin-svgr should update the types exposed to handle component Note: the vite-svg-loader plugin already does this! So maybe we should only add as a "tip" the suggestion to add a specific type if the plugin doesn't already handle that in its declare module '*.svg?component' {
....
} |
Something I like about encouraging the use of |
I personally think this is something that should be added by the plugin. This is what I do for my SVG plugin: https://github.com/ArnaudBarre/vite-plugin-fast-react-svg (I've never been a fan of this weird reference thing in dts files) @patak-dev I understand the idea behind |
Good point, probably for React projects it is more common to be aligned to react-land more than to vite-land regarding the treatment of |
Ah, so type referencing before I'll update the document to suggest this way. |
Description
As reported at #9455 (comment), #9488 wasn't working.
This PR implements in a different way from #9488.
You can try this out at https://stackblitz.com/edit/vitejs-vite-kgv2he?file=src%2Fvite-env.d.ts&terminal=dev
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).