tsx-dom
Version:
A simple way to use tsx syntax to create native dom elements using document.createElement.
24 lines (23 loc) • 926 B
TypeScript
import { CustomElementsHTML, IntrinsicElementsHTML, IntrinsicElementsSVG } from "./types";
export * from "./createElement";
export * from "./defineCustomElement";
export * from "./jsx-runtime";
export * from "./types";
export interface TsxConfig {
[s: string]: boolean;
}
type IfTsxConfig<T extends string, TIF, TELSE> = TsxConfig[T] extends false ? TELSE : TIF;
type IntrinsicElementsCombined = IfTsxConfig<"html", IntrinsicElementsHTML, unknown> & IfTsxConfig<"svg", IntrinsicElementsSVG, unknown>;
declare global {
namespace JSX {
type Element = IfTsxConfig<"html", HTMLElement, never> | IfTsxConfig<"svg", SVGElement, never>;
interface ElementAttributesProperty {
props: unknown;
}
interface ElementChildrenAttribute {
children: unknown;
}
interface IntrinsicElements extends IntrinsicElementsCombined, CustomElementsHTML {
}
}
}