28 lines
646 B
TypeScript
28 lines
646 B
TypeScript
|
import { jsx, Fragment } from './jsx.ts';
|
||
|
import type {
|
||
|
ComponentFunctionType,
|
||
|
NodePropsType,
|
||
|
NullableChildType,
|
||
|
} from './types.ts';
|
||
|
|
||
|
export { ElementNode } from './node/ElementNode.ts';
|
||
|
export { ComponentNode } from './node/ComponentNode.ts';
|
||
|
export type {
|
||
|
jsx,
|
||
|
Fragment,
|
||
|
ComponentFunctionType,
|
||
|
NullableChildType,
|
||
|
NodePropsType,
|
||
|
};
|
||
|
|
||
|
export const React = {
|
||
|
Fragment,
|
||
|
createElement<P extends NodePropsType = NodePropsType>(
|
||
|
element: string | ComponentFunctionType,
|
||
|
props: P | null,
|
||
|
...children: NullableChildType[]
|
||
|
) {
|
||
|
return jsx(element, props, ...children);
|
||
|
},
|
||
|
};
|