@maskedeng-tom/ssrsx
Version:
server side renderer with tsx
28 lines (27 loc) • 1.15 kB
TypeScript
interface VirtualElementCore {
tag?: string;
f?: FunctionComponent;
fragment?: boolean;
props?: Props;
attributes?: {
[key: string]: unknown;
};
key?: string | number;
children?: VirtualChildren;
fcId?: string;
}
type VirtualElement = VirtualElementCore | Promise<VirtualElementCore>;
type VirtualTextNode = string | number | boolean | Date | object;
type VirtualChildNode = VirtualElement | VirtualTextNode | null | undefined;
type VirtualChildNodes = VirtualChildNode[];
type VirtualChildren = VirtualChildNodes | VirtualChildNode;
type Props = {
children?: VirtualChildren;
[key: string]: unknown;
};
type FunctionComponent<T = Props | null | undefined> = (props: T) => VirtualElement;
declare const jsx: (tag: string | FunctionComponent, props: Props | undefined, _key?: string | number) => VirtualElement;
declare const jsxs: (tag: string | FunctionComponent, props: Props | undefined, key?: string | number) => VirtualElement;
declare const Fragment: (props: Props | undefined) => VirtualElement;
export { jsx, jsxs, Fragment };
export { VirtualElementCore, VirtualElement, VirtualChildren };