ITADN

SVG-children don't have a correct `Element` type

#1055Openboris-petrov 创建于 2026-02-09
B
boris-petrovcommented
This is using Glint v1. After updating `@glint/template` from 1.5.2 to 1.7.4, I started getting errors on such code: ```hbs <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200.00 10"> <text text-anchor="middle" x="100" y="8" {{style font-size="8px"}}> asd </text> </svg> ``` The error being on the `style` modifier: ``` Argument of type '[Element, { [NamedArgs]: true; "font-size": "8px"; }]' is not assignable to parameter of type '[element: Element & ElementCSSInlineStyle, ...args: (CSSStyles | (Partial<Properties<0 | (string & {}), string & {}>> & NamedArgsMarker) | undefined)[]] | [element: ...] | [element: ...]'. Type '[Element, { [NamedArgs]: true; "font-size": "8px"; }]' is not assignable to type '[element: Element & ElementCSSInlineStyle, ...args: (CSSStyles | ({ readonly [key: `--${string}`]: string; } & NamedArgsMarker) | undefined)[]]'. Type at position 0 in source is not compatible with type at position 0 in target. Type 'Element' is not assignable to type 'Element & ElementCSSInlineStyle'. Type 'Element' is missing the following properties from type 'ElementCSSInlineStyle': attributeStyleMap, styleglint(2345) ``` I opened an [issue](https://github.com/jelhan/ember-style-modifier/issues/345) in `ember-style-modifier` but @jelhan correctly pointed out that this is an upstream bug (in Glint) - the SVG `text` element should be typed as [SVGTextElement](https://developer.mozilla.org/en-US/docs/Web/API/SVGTextElement) instead of just `Element`. Related to #1012. cc @NullVoxPopuli
2 条评论