#SVG interface for typescript?
1 messages · Page 1 of 1 (latest)
There were some improvements to svg JSX types in Solid 1.8 - not sure if related, just fyi. https://github.com/solidjs/solid/issues/1905
Module '"solid-js"' has no exported member 'SVGElementTags'
and I can't figure out where the interface is
There are SVGElements on solid-js/web - does that work?
hmmm
'SVGElements' refers to a value, but is being used as a type here. Did you mean 'typeof SVGElements'?
I think you can use JSX.UseSVGAttributes
How about
import type {SVGElements} from "solid-js/web"
already tried that, and it doesn't make any difference
that's a generic type, but I still can't find the typescript interface for the tag itself, unless I'm supposed to use {} in lieu of a concrete type, or something?
for specific tags you should be able to just use html types like SVGPathElement
So you should be able to do JSX.UseSVGAttributes<SVGPathElement> to get the attributes for the path element
ooooh, that explains it- but then is there a single type that aggregates everything for the <svg /> tag itself?
SVGSVGElement
oh
or do you mean for all svg attributes for all svg elements?
that seems to work perfectly lol
ah I made a mistake
hmm?
actually you can use SvgSVGAttributes type from jsx, instead of UseSVGAttributes
it should give you the proper types for any svg element you pass it
JSX.SvgSVGAttributes<SVGSVGElement>
oooo
nope
still wrong oops
weird
Actually that is correct but I guess my lsp is just being weird
ahh
JSX.SVGElementTags['path'] this method seems more correct
Weird that I haven't run into this since I've used svg so much
oh not sure, seems to be working for me
weird
Decided to restart discord to check and it stopped working lol
yeah