How to declare SVG props type In Astro + Preact?

331 views Asked by At

I am trying to declare a type for the props of svg, but I get a type error doing so:

---
import type { SVGProps } from "preact/compat";

interface Props extends SVGProps<SVGElement> {
  class?: string;
}

const { class: className, ...props } = Astro.props;
---

<svg
  xmlns="http://www.w3.org/2000/svg"
  viewBox="0 0 87 97"
  class={className}
  fill="none"
  {...props}
>
Type 'string | SignalLike<string | undefined> | undefined' is not assignable to type 'string | null | undefined'.
  Type 'SignalLike<string | undefined>' is not assignable to type 'string'.ts(2322)
astro-jsx.d.ts(1318, 3): The expected type comes from property 'xmlns' which is declared here on type 'SVGAttributes'
(property) astroHTML.JSX.SVGAttributes.xmlns?: string | null | undefined
0

There are 0 answers