blob: 9571e87d6476a47fc66f68ac89a38f49599cb8fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import type { Node } from "../dom.ts";
export type JSXElement = {
tag: string | FunctionComponent;
props: Props;
};
export type JSXNullNode = false | null | undefined;
export type JSXSimpleNode = JSXElement | Node | string;
export type JSXNullableSimpleNode = JSXSimpleNode | JSXNullNode;
export type JSXNode = JSXNullableSimpleNode | JSXNode[];
export type RenderableJSXNode = JSXElement;
type Props = { children?: JSXNode } & Record<string, unknown>;
export type FunctionComponentResult = JSXElement | Promise<JSXElement>;
type FunctionComponent = (props: Props) => FunctionComponentResult;
export function jsx(
tag: string | FunctionComponent,
props: Props,
): JSXElement {
return { tag, props };
}
export { jsx as jsxs };
// TODO: support Fragment
|