~evanj/wigly

ref: bd128329c973eb88b3a66f8102879504b8dad16a wigly/index.d.ts -rw-r--r-- 835 bytes
bd128329 — Evan Jones thenable components, fix for promise polyfilling 1 year, 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
export as namespace wigly;

export interface VNode<Props = {}> {
  name: string;
  props: Props;
  children: Array<VNode>;
  element: Element | null;
  key: string | null;
  type: number;
}

export type Children = VNode | string | number | null;

export function h<Props>(
  name: string,
  props?: Props | null,
  ...children: Array<Children | Children[]>
): VNode<Props>;

export function render(
  rootComponent: VNode,
  container: Element
): Promise<Element>;

export function state<StateValue>(
  initialValue: StateValue | (() => StateValue)
): [StateValue, (nextValue: StateValue) => void];

export function effect(effectHandle: (el: Element) => Function | void): void;

declare global {
  namespace JSX {
    interface Element extends VNode<any> {}
    interface IntrinsicElements {
      [elemName: string]: any;
    }
  }
}