github / relative-time-element

Web component extensions to the standard <time> element.

Home Page:https://github.github.io/relative-time-element/examples/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add better jsx support

Quazie opened this issue · comments

Properly add the various elements to the JSX intrinsic space similar to:


declare global {
  namespace JSX {
    interface IntrinsicElements {
      ["time-ago"]: CustomElement<TimeAgoElement>;
    }
  }
}```

@Quazie we looked into this but ultimately I don't think there is a tenable solution:

Experimenting with this a bit, this is untenable. React requires a type that includes references to the React library itself, which we're not prepared to bring into this custom element.

declare global {
  namespace JSX {
    interface IntrinsicElements {
      'relative-time': React.DetailedHTMLProps<React.HTMLAttributes<RelativeTimeElement>, RelativeTimeElement>
    }
  }
}

This should be defined in consuming libraries if they want to use this in React.

I'll close this out as I don't think we can reasonably support this.