Current State
<button
popovertarget="mobile-menu"
popovertargetaction="hide"
>
Close
</button>
Desired State
No TS errors!
Although it feels like this should already be handed by TS, an interim solution seems to be to keep extending our custom JSX definition
// create a utility type to extract the attributes from any given element's DOM interface.
type ElementAttributes<E extends HTMLElement> = {
// Extract all properties from the element, including inherited ones.
[A in keyof E]?: E[A] extends (...args: any) => any ? any : IsCSSStyleDeclaration<E[A]>;
} & {
class?: string;
// add these
popovertarget?: string;
popovertargetaction?: 'show' | 'hide' | 'toggle';
};
Additional Context
I've been struggling to find an explanation for this, or if it's just something missing from TS, but can see the issue in action in #222 .
Here are the relevant MDN docs for reference
https://developer.mozilla.org/en-US/docs/Web/API/Popover_API
Current State
Desired State
No TS errors!
Although it feels like this should already be handed by TS, an interim solution seems to be to keep extending our custom JSX definition
Additional Context
I've been struggling to find an explanation for this, or if it's just something missing from TS, but can see the issue in action in #222 .
Here are the relevant MDN docs for reference
https://developer.mozilla.org/en-US/docs/Web/API/Popover_API