greact/lib/jsx/render.ts
Benjamin Palko 176b094b54 setup
2025-04-11 17:33:19 -04:00

16 lines
448 B
TypeScript

import type { JSX } from "./jsx-runtime";
import type { FunctionComponent } from "./types";
export function renderJSX<T extends keyof JSX.IntrinsicElements>(
tag: string | FunctionComponent | undefined,
props: JSX.IntrinsicElements[T],
) {
if (typeof tag === "function") {
const result = tag(props);
} else if (typeof tag === "undefined") {
return {};
} else {
const { children, ...rest } = props;
return { [tag]: { ...rest } };
}
}