import { CONTROL_FLOW_TAG, ELEMENT_TYPE } from '../constants'; export interface ComponentFunction { (props?: T): Renderable; (props: T, children: VirtualElement[]): Renderable; } export interface AsyncComponentFunction { (props?: T): Promise; } export interface ComponentFunctionWithMeta extends ComponentFunction { __template_id: string; __name: string; } export type RenderablePrimitive = string | number | boolean | null | undefined; export type Renderable = JSX.IntrinsicElements | VirtualElement | VirtualElement[] | RenderablePrimitive | Element | Text; export interface VirtualElement { type: string; props: { [key: string]: unknown; children: Renderable[]; }; meta?: { [key: string]: unknown; }; } export interface ElementRef { current?: T; } export type ElementType = typeof ELEMENT_TYPE[keyof typeof ELEMENT_TYPE]; export type CommonProps = { className?: string; ref?: ElementRef; }; export type PropsWithChildren> = T & { children?: Renderable[]; }; export type Props> = T & CommonProps; export type ControlFlowTag = typeof CONTROL_FLOW_TAG[keyof typeof CONTROL_FLOW_TAG];