S
SolidJS15mo 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 Skyum15mo 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_OP15mo ago
Module '"solid-js"' has no exported member 'SVGElementTags'
and I can't figure out where the interface is
Birk Skyum
Birk Skyum15mo ago
There are SVGElements on solid-js/web - does that work?
robert_
robert_OP15mo ago
hmmm 'SVGElements' refers to a value, but is being used as a type here. Did you mean 'typeof SVGElements'?
REEEEE
REEEEE15mo ago
I think you can use JSX.UseSVGAttributes
Birk Skyum
Birk Skyum15mo ago
How about import type {SVGElements} from "solid-js/web"
robert_
robert_OP15mo 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
REEEEE15mo 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_OP15mo ago
ooooh, that explains it- but then is there a single type that aggregates everything for the <svg /> tag itself?
REEEEE
REEEEE15mo ago
SVGSVGElement
robert_
robert_OP15mo ago
oh
REEEEE
REEEEE15mo ago
or do you mean for all svg attributes for all svg elements?
robert_
robert_OP15mo ago
that seems to work perfectly lol
REEEEE
REEEEE15mo ago
ah I made a mistake
robert_
robert_OP15mo ago
hmm?
REEEEE
REEEEE15mo ago
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>
robert_
robert_OP15mo ago
oooo
REEEEE
REEEEE15mo ago
nope still wrong oops weird Actually that is correct but I guess my lsp is just being weird
robert_
robert_OP15mo ago
ahh
REEEEE
REEEEE15mo ago
JSX.SVGElementTags['path'] this method seems more correct Weird that I haven't run into this since I've used svg so much
robert_
robert_OP15mo ago
ahh also, is it just me or is the server having issues? lol
REEEEE
REEEEE15mo ago
what type of issues? Could be discord
robert_
robert_OP15mo ago
like #general won't load at all nor will the main UI for #support
REEEEE
REEEEE15mo ago
oh not sure, seems to be working for me
robert_
robert_OP15mo ago
weird
REEEEE
REEEEE15mo ago
Decided to restart discord to check and it stopped working lol
No description
robert_
robert_OP15mo ago
yeah
> curl https://discord.com/api/modules/stable/versions.json
{"message": "internal network error", "code": 40333}
> curl https://discord.com/api/modules/stable/versions.json
{"message": "internal network error", "code": 40333}
lol
Want results from more Discord servers?
Add your server