Closed joergplewe closed 4 years ago
I could solve the issue by npm install @types/react-dom
and renaming all class
attributes to className
.
By that, I could also comment then line
// "./node_modules/babel-plugin-jsx-dom-expressions",
in tsconfig.json
.
Yeah that's a strange omission. The JSX types have been a real collaborative effort and that somehow seems to be missed since we split out SVG types. I will look at getting this fixed up.
In general you probably don't want to be using the React JSX types as you will likely hit more issues especially around the definition of JSX Elements, refs etc...
Fixed in v0.16.2. If you find anything else unusual like that feel free to open another issue. Admittedly I don't use TypeScript or SVG very much so there is probably still more potential for other similar omissions.
what about href
as used in <use href="#airplane" />
?
Yeah looking this was a casualty of https://github.com/ryansolid/babel-plugin-jsx-dom-expressions/pull/26
Inheriting from HTMLAttribute used to bring more attributes along. I'm going to diff the old list against MDN SVGAttribute and add the missing ones back.
I've added back those removed unintentionally by that pr in v0.16.3 (including href).
Hi!
I'm trying to use Solid.js to create an SVG application. Works fine, but VSCode and
tsc
complain about things like:Type '{ width: string; height: string; x: string; fill: string; }' is not assignable to type 'SVGAttributes<SVGRectElement>'. Property 'width' does not exist on type 'SVGAttributes<SVGRectElement>'.
SVGAttributes
in fact lackswidth
andheight
, so....