Skip to content

Instantly share code, notes, and snippets.

@stefanopascazi
Created February 10, 2022 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanopascazi/e7e37f1671034e406b197a15ce2e3c39 to your computer and use it in GitHub Desktop.
Save stefanopascazi/e7e37f1671034e406b197a15ce2e3c39 to your computer and use it in GitHub Desktop.
Declaration file for React web components created by stencil
import { JSX as LocalJSX } from "@stencil/core";
import { DetailedHTMLProps, HTMLAttributes } from 'react';
type StencilProps<T> = {
[P in keyof T]?: Omit<T[P], 'ref'>;
};
type ReactProps<T> = {
[P in keyof T]?: DetailedHTMLProps<HTMLAttributes<T[P]>, T[P]>;
};
type StencilToReact<T = LocalJSX.IntrinsicElements, U = HTMLElementTagNameMap> = StencilProps<T> &
ReactProps<U>;
declare global {
export namespace JSX {
interface IntrinsicElements extends StencilToReact {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment