snabbdom-jsx-lite
Version:
Write snabbdom templates in .jsx or .tsx (JSX for TypeScript)
19 lines (18 loc) • 974 B
TypeScript
import { VNode, VNodeData } from 'snabbdom';
export declare type JsxVNode = VNode;
export declare type JsxVNodeChild = VNode | string | number | boolean | undefined | null;
export declare type JsxVNodeChildren = JsxVNodeChild | JsxVNodeChild[];
export interface JsxVNodeProps extends VNodeData {
/** css selector shorthand e.g <div sel="#id.class1.class1" /> */
sel?: string;
}
export declare type FunctionComponent = (props: {
[prop: string]: any;
} | null, children?: VNode[]) => VNode;
/** Equivalent of <> (React.Fragment) that that wraps children without a containing dom element */
export declare function Fragment(_props: {}, children?: Array<string | VNode>): VNode;
/**
* jsx/tsx + hyperscript compatible vnode factory function
* see: https://www.typescriptlang.org/docs/handbook/jsx.html#factory-functions
*/
export declare function jsx(tag: string | FunctionComponent | null, data: JsxVNodeProps | null, ...children: JsxVNodeChildren[]): JsxVNode;