vite-plugin-solid-svg icon indicating copy to clipboard operation
vite-plugin-solid-svg copied to clipboard

type inference in import.meta.glob

Open jfgodoy opened this issue 3 years ago • 3 comments

image

jfgodoy avatar Nov 05 '22 02:11 jfgodoy

asked in vite discord

MrFoxPro avatar Nov 09 '22 08:11 MrFoxPro

https://github.com/vitejs/vite/discussions/10856

MrFoxPro avatar Nov 09 '22 18:11 MrFoxPro

we can pass the type to the glob function with this:

import type { Component, JSX } from 'solid-js'
type IconModule = {default: Component<JSX.SvgSVGAttributes<SVGSVGElement>>}
const modules = import.meta.glob<IconModule>('@/svgs/*.svg', { as: 'component-solid' })

jfgodoy avatar Mar 01 '23 04:03 jfgodoy