Skip to content

SVG-children don't have a correct Element type #1055

@boris-petrov

Description

@boris-petrov

This is using Glint v1.

After updating @glint/template from 1.5.2 to 1.7.4, I started getting errors on such code:

<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 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 instead of just Element.

Related to #1012.

cc @NullVoxPopuli

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions