DenReg/jsx-html/types.ts

24 lines
790 B
TypeScript

import type { ElementNode } from './node/ElementNode.ts';
import type { TextNode } from './node/TextNode.ts';
import type { ComponentNode } from './node/ComponentNode.ts';
import type { FragmentNode } from './node/FragmentNode.ts';
export type NodePropsType = {
[key: string]: any;
};
type Primitive = string | boolean | number;
type NullablePrimitive = Primitive | null | void;
export type ChildNodeType = ElementNode | TextNode | ComponentNode;
export type NodeType = ChildNodeType | FragmentNode;
export type ChildType = ChildNodeType | Primitive;
export type NullableChildType = ChildType | ChildNodeType | NullablePrimitive;
export type ComponentFunctionType = (
props: NodePropsType,
child?: NullableChildType[],
) => NullableChildType | Promise<NullableChildType>;