@dependable/tsx
Version:
Construct @dependable/view vdom using TypeScript TSX
55 lines (54 loc) • 1.87 kB
TypeScript
type JSXProps = {
children?: JSX.Node;
[keyName: string]: any;
};
export declare const jsx: (type: string | JSX.ElementClass, props: JSXProps) => JSX.Nodes;
export declare const jsxDEV: (type: string | JSX.ElementClass, props: JSXProps) => JSX.Nodes;
type JSXSProps = {
children: JSX.Node[];
[keyName: string]: any;
};
export declare const jsxs: (type: string | JSX.ElementClass, props: JSXSProps) => JSX.Nodes;
export declare const jsxsDEV: (type: string | JSX.ElementClass, props: JSXSProps) => JSX.Nodes;
type FragmentProps = {
children: JSX.Nodes;
};
export declare class Fragment {
render(props: FragmentProps): JSX.Node | JSX.Node[];
}
export type RefCallback<T extends HTMLElement> = (element: T) => void;
declare global {
namespace JSX {
interface Stringable {
toString(): string;
}
type IntrinsicElements = {
[elemName: string]: any;
} & {
[K in keyof HTMLElementTagNameMap]: {
children?: any;
className?: string | Stringable;
class?: string | Stringable;
style?: string | Partial<CSSStyleDeclaration>;
ref?: RefCallback<HTMLElementTagNameMap[K]>;
} & Omit<Omit<Omit<Omit<Partial<HTMLElementTagNameMap[K]>, "children">, "className">, "class">, "style">;
};
interface ElementClass {
render(props?: any): Nodes;
}
type VElement = {
type: ElementClass | string;
props: Record<string, any>;
children: Nodes;
};
type Node = string | null | undefined | VElement;
type Nodes = Node | Node[];
interface ElementAttributesProperty {
props: any;
}
interface ElementChildrenAttribute {
children: any;
}
}
}
export {};