Skip to content

Commit

Permalink
refactor: Backport ToggleEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Dec 19, 2024
1 parent 98308a1 commit 12d075c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/jsx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,28 @@ type Defaultize<Props, Defaults> =

type Booleanish = boolean | 'true' | 'false';

// Remove when bumping TS minimum to >5.2

/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ToggleEvent) */
interface ToggleEvent extends Event {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ToggleEvent/newState) */
readonly newState: string;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ToggleEvent/oldState) */
readonly oldState: string;
}

declare var ToggleEvent: {
prototype: ToggleEvent;
//new(type: string, eventInitDict?: ToggleEventInit): ToggleEvent;
};

interface ToggleEventInit extends EventInit {
newState?: string;
oldState?: string;
}

// End TS >5.2

export namespace JSXInternal {
export type LibraryManagedAttributes<Component, Props> = Component extends {
defaultProps: infer Defaults;
Expand Down

0 comments on commit 12d075c

Please sign in to comment.