S
SolidJS12mo ago
robert_

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 repository
27 Replies
Birk Skyum
Birk Skyum12mo ago
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='...
robert_
robert_12mo ago
Module '"solid-js"' has no exported member 'SVGElementTags'
and I can't figure out where the interface is
Birk Skyum
Birk Skyum12mo ago
There are SVGElements on solid-js/web - does that work?
robert_
robert_12mo ago
hmmm 'SVGElements' refers to a value, but is being used as a type here. Did you mean 'typeof SVGElements'?
REEEEE
REEEEE12mo ago
I think you can use JSX.UseSVGAttributes
Birk Skyum
Birk Skyum12mo ago
How about import type {SVGElements} from "solid-js/web"
robert_
robert_12mo ago
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?
REEEEE
REEEEE12mo ago
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
robert_
robert_12mo ago
ooooh, that explains it- but then is there a single type that aggregates everything for the <svg /> tag itself?
REEEEE
REEEEE12mo ago
SVGSVGElement
robert_
robert_12mo ago
oh
REEEEE
REEEEE12mo ago
or do you mean for all svg attributes for all svg elements?
robert_
robert_12mo ago
that seems to work perfectly lol
REEEEE
REEEEE12mo ago
ah I made a mistake
robert_
robert_12mo ago
hmm?
Want results from more Discord servers?
Add your server