Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/jsx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ type IntrinsicElementsFromSVG = {
[E in keyof SVGElementTagNameMap]: SVGElementAttributes<SVGElementTagNameMap[E]>;
};

type IntrinsicElementAttributes<E extends string> = (E extends keyof HTMLElementTagNameMap
? ElementAttributes<HTMLElementTagNameMap[E]> &
(E extends 'button' | 'input' ? PopoverAttributes : {}) &
(E extends 'button' ? { tabindex?: number | string } : {})
: {}) &
(E extends keyof SVGElementTagNameMap ? SVGElementAttributes<SVGElementTagNameMap[E]> : {});

type IntrinsicElementsMap = {
[E in keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap]: IntrinsicElementAttributes<E>;
};

declare namespace JSX {
interface IntrinsicElements extends IntrinsicElementsFromDom, IntrinsicElementsFromSVG {}
interface IntrinsicElements extends IntrinsicElementsMap {}
}