export type Key = string | number;
export interface Ref<T> { current: T | null; }
export type ComponentChild = VNode | string | number | bigint | boolean | null | undefined;
export type ComponentChildren = ComponentChild | ComponentChild[];
export interface Attributes { key?: Key; ref?: Ref<any>; children?: ComponentChildren; }
export type VNode<P = {}> = { type: any; props: P & { children?: ComponentChildren }; key: Key | null; };
export type ComponentType<P = {}> = (props: P & Attributes) => VNode | null;
export type Context<T> = { Provider: ComponentType<{ value: T; children?: ComponentChildren }>; Consumer: ComponentType<{ children: (value: T) => ComponentChild }> };

export function h(type: any, props: any, ...children: any[]): VNode;
export const Fragment: unique symbol;
export function render(vnode: ComponentChild, parent: Element | ShadowRoot): void;
export function cloneElement(vnode: VNode, props?: any, ...children: any[]): VNode;
export function createContext<T>(defaultValue: T): Context<T>;

export namespace JSX {
  type Element = VNode;
  interface ElementClass { render(): ComponentChild; }
  interface ElementAttributesProperty { props: {}; }
  interface ElementChildrenAttribute { children: {}; }
  type IntrinsicElements = { [K in keyof HTMLElementTagNameMap]: any } & { [K in keyof SVGElementTagNameMap]: any } & { [key: string]: any };
}
