~evanj/wigly

af7b79a195b13151f8460a0d21b035aaf05fd5a6 — Evan M Jones 1 year, 7 months ago 28e10bd
adding d.ts file
2 files changed, 40 insertions(+), 1 deletions(-)

M package.json
A wigly.d.ts
M package.json => package.json +2 -1
@@ 1,7 1,8 @@
{
  "name": "wigly",
  "version": "0.5.10",
  "version": "0.5.11",
  "main": "dist/wigly.es5.js",
  "types": "wigly.d.ts",
  "scripts": {
    "start": "npm run start:clean && npm run start:gcc && npm run start:gzip",
    "start:clean": "rm -rf dist && mkdir -p dist",

A wigly.d.ts => wigly.d.ts +38 -0
@@ 0,0 1,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;
    }
  }
}