Reference

idlip/jsx-runtime

idlip/jsx-runtime holds the JSX types for "jsxImportSource": "idlip". It has no runtime code: the compiler replaces every view, so a component body never runs as JSX. See Editor setup for the tsconfig.json settings.

tsx
import type { JSX } from 'idlip/jsx-runtime';

export default function Hello(props: { name: string }): JSX.Element {
  return <p>Hello {props.name}</p>;
}

#Types

#JSX

ts
namespace JSX {
  type Element;
  interface ElementChildrenAttribute {
    children: unknown;
  }
  interface IntrinsicAttributes {
    key?: string | number | ((item: never) => string | number);
  }
  interface IntrinsicElements {
    /* HTML, SVG and MathML elements, <window> and <document> */
  }
}

The namespace TypeScript reads for JSX. JSX.Element is what a component returns. It exists only as a type.

key also accepts a callback, which only <For> takes as its key (its own type gives the item).

IntrinsicElements types every element:

latest:* takes the same functions as on:* and opts into latest-wins delivery: while a message is in flight, a newer event of the same kind replaces the queued one.

#ClassValue

ts
type ClassValue = string | Record<string, boolean | null | undefined>;

The type of class. A record adds each key whose value is true: class={{ done: t.done }}.

#EventFor

ts
type EventFor<El extends Element, E extends Event> = E & { readonly currentTarget: El };

An event with currentTarget typed as the element the listener is on.

#EventProp

ts
type EventProp<El extends Element, E extends Event> = (event: EventFor<El, E>) => unknown;

The type of an on:* or latest:* prop. The compiler restricts the value to a handler, or a synchronous arrow function whose statements are handler calls, if, else and const.