diff --git a/packages/dom-expressions/src/jsx.d.ts b/packages/dom-expressions/src/jsx.d.ts index d723c4d6..c742e9ee 100644 --- a/packages/dom-expressions/src/jsx.d.ts +++ b/packages/dom-expressions/src/jsx.d.ts @@ -30,30 +30,29 @@ export namespace JSX { } interface BoundEventHandler< - T, - E extends Event, - EHandler extends EventHandler = EventHandler, + T, + E extends Event, + EHandler extends EventHandler = EventHandler > { - 0: ( - data: any, - ...e: Parameters, - ) => void; + 0: (data: any, ...e: Parameters) => void; 1: any; } type EventHandlerUnion< T, E extends Event, - EHandler extends EventHandler = EventHandler, + EHandler extends EventHandler = EventHandler > = EHandler | BoundEventHandler; interface EventHandlerWithOptions> - extends AddEventListenerOptions { + extends AddEventListenerOptions { handleEvent: EHandler; } - type EventHandlerWithOptionsUnion = EventHandler> = - | EHandler - | EventHandlerWithOptions; + type EventHandlerWithOptionsUnion< + T, + E extends Event, + EHandler extends EventHandler = EventHandler + > = EHandler | EventHandlerWithOptions; interface InputEventHandler { ( @@ -65,7 +64,11 @@ export namespace JSX { } ): void; } - type InputEventHandlerUnion = EventHandlerUnion>; + type InputEventHandlerUnion = EventHandlerUnion< + T, + E, + InputEventHandler + >; interface ChangeEventHandler { ( @@ -77,7 +80,11 @@ export namespace JSX { } ): void; } - type ChangeEventHandlerUnion = EventHandlerUnion>; + type ChangeEventHandlerUnion = EventHandlerUnion< + T, + E, + ChangeEventHandler + >; interface FocusEventHandler { ( @@ -89,7 +96,11 @@ export namespace JSX { } ): void; } - type FocusEventHandlerUnion = EventHandlerUnion>; + type FocusEventHandlerUnion = EventHandlerUnion< + T, + E, + FocusEventHandler + >; const SERIALIZABLE: unique symbol; interface SerializableAttributeValue { @@ -102,9 +113,11 @@ export namespace JSX { } interface CustomAttributes { ref?: T | ((el: T) => void) | undefined; - classList?: { - [k: string]: boolean | undefined; - } | undefined; + classList?: + | { + [k: string]: boolean | undefined; + } + | undefined; $ServerOnly?: boolean | undefined; } type Accessor = () => T; @@ -201,9 +214,11 @@ export namespace JSX { "on:compositionstart"?: EventHandlerWithOptionsUnion | undefined; "on:compositionupdate"?: EventHandlerWithOptionsUnion | undefined; "on:focusout"?: - EventHandlerWithOptionsUnion> | undefined; + | EventHandlerWithOptionsUnion> + | undefined; "on:focusin"?: - EventHandlerWithOptionsUnion> | undefined; + | EventHandlerWithOptionsUnion> + | undefined; "on:encrypted"?: EventHandlerWithOptionsUnion | undefined; "on:dragexit"?: EventHandlerWithOptionsUnion | undefined; } @@ -377,10 +392,12 @@ export namespace JSX { "on:animationstart"?: EventHandlerWithOptionsUnion | undefined; "on:auxclick"?: EventHandlerWithOptionsUnion | undefined; "on:beforeinput"?: - EventHandlerWithOptionsUnion> | undefined; + | EventHandlerWithOptionsUnion> + | undefined; "on:beforetoggle"?: EventHandlerWithOptionsUnion | undefined; "on:blur"?: - EventHandlerWithOptionsUnion> | undefined; + | EventHandlerWithOptionsUnion> + | undefined; "on:canplay"?: EventHandlerWithOptionsUnion | undefined; "on:canplaythrough"?: EventHandlerWithOptionsUnion | undefined; "on:change"?: EventHandlerWithOptionsUnion> | undefined; @@ -399,10 +416,12 @@ export namespace JSX { "on:ended"?: EventHandlerWithOptionsUnion | undefined; "on:error"?: EventHandlerWithOptionsUnion | undefined; "on:focus"?: - EventHandlerWithOptionsUnion> | undefined; + | EventHandlerWithOptionsUnion> + | undefined; "on:gotpointercapture"?: EventHandlerWithOptionsUnion | undefined; "on:input"?: - EventHandlerWithOptionsUnion> | undefined; + | EventHandlerWithOptionsUnion> + | undefined; "on:invalid"?: EventHandlerWithOptionsUnion | undefined; "on:keydown"?: EventHandlerWithOptionsUnion | undefined; "on:keypress"?: EventHandlerWithOptionsUnion | undefined; @@ -944,7 +963,7 @@ export namespace JSX { ping?: string | undefined; referrerpolicy?: HTMLReferrerPolicy | undefined; rel?: string | undefined; - target?: string | undefined; + target?: "_self" | "_blank" | "_parent" | "_top" | (string & {}) | undefined; type?: string | undefined; referrerPolicy?: HTMLReferrerPolicy | undefined; } @@ -1106,7 +1125,31 @@ export namespace JSX { size?: number | string | undefined; src?: string | undefined; step?: number | string | undefined; - type?: string | undefined; + type?: + | "button" + | "checkbox" + | "color" + | "date" + | "datetime-local" + | "email" + | "file" + | "hidden" + | "image" + | "month" + | "number" + | "password" + | "radio" + | "range" + | "reset" + | "search" + | "submit" + | "tel" + | "text" + | "time" + | "url" + | "week" + | (string & {}) + | undefined; value?: string | string[] | number | undefined; width?: number | string | undefined; crossOrigin?: HTMLCrossorigin | undefined; @@ -1163,7 +1206,13 @@ export namespace JSX { interface MediaHTMLAttributes extends HTMLAttributes { autoplay?: boolean | undefined; controls?: boolean | undefined; - controlslist?: string | undefined; + controlslist?: + | "nodownload" + | "nofullscreen" + | "noplaybackrate" + | "noremoteplayback" + | (string & {}) + | undefined; crossorigin?: HTMLCrossorigin | undefined; loop?: boolean | undefined; mediagroup?: string | undefined;