SVG interface for typescript?
Hi,
Does Solid have an
SVGAttributes
(or similar) interface for use with typescript SVG components? I can't seem to find any in the github repository27 Replies
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
GitHub
JSX types for SVG elements (
SVGElementTags
) wrongly use runtime D...Describe the bug As part of an SVG element I was building with solid, I wanted to use an <feDropShadow> element like this: <feDropShadow in='SourceGraphic' dx='0.2' dy='...
Module '"solid-js"' has no exported member 'SVGElementTags'
and I can't figure out where the interface isThere 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 elementooooh, 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?