Files
uopi/web/vendor/preact.d.ts
T
Martino Ferrari 986f6cd6d8 Phase 6
2026-04-25 22:56:09 +02:00

23 lines
1.3 KiB
TypeScript

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 };
}