tsx-dom
Version:
A simple way to use tsx syntax to create native dom elements using document.createElement.
10 lines (9 loc) • 795 B
TypeScript
import { ElementAttributes, HTMLAttributes, HTMLElementAttributes } from "tsx-dom-types";
import { FC, HTMLComponentProps } from "./types";
export type CustomElementConstructor<T extends HTMLElement> = {
new (...params: any[]): T;
};
export declare function defineCustomElement<T extends Record<string, any>>(name: string, constructor: CustomElementConstructor<HTMLElement>): FC<T & HTMLComponentProps<HTMLElement> & ElementAttributes<HTMLElement, HTMLAttributes>>;
export declare function defineCustomElement<T extends Record<string, any>, TName extends keyof HTMLElementTagNameMap>(name: string, constructor: CustomElementConstructor<HTMLElementTagNameMap[TName]>, options: {
extends: TName;
}): FC<T & HTMLComponentProps<HTMLElementTagNameMap[TName]> & HTMLElementAttributes<TName>>;