vite-svg-loader icon indicating copy to clipboard operation
vite-svg-loader copied to clipboard

`?component` param needed to get correct in-editor typing

Open beefchimi opened this issue 2 years ago • 1 comments

Without the ?component param at the end of the .svg import, VsCode reports the import as a string.

Only by appending the ?component will VsCode report it as a FunctionalComponent:

import

I tried adding defaultImport: 'component' to the svgLoader config and it made no difference.

beefchimi avatar Nov 23 '23 21:11 beefchimi

Yeah I have similar issue, I've resolved that by manually putting this to my index.d.ts:

declare module '*.svg' {
    import type { FunctionalComponent, SVGAttributes } from 'vue'
    const src: FunctionalComponent<SVGAttributes>
    export default src
  }

microHoffman avatar Nov 26 '23 20:11 microHoffman