2022-10-26 15:14:08 +00:00
|
|
|
import './astro-jsx';
|
|
|
|
import { AstroBuiltinAttributes } from './dist/@types/astro';
|
|
|
|
|
|
|
|
/** Any supported HTML or SVG element name, as defined by the HTML specification */
|
|
|
|
export type HTMLTag = keyof astroHTML.JSX.DefinedIntrinsicElements;
|
|
|
|
/** The built-in attributes for any known HTML or SVG element name */
|
2022-10-26 15:16:54 +00:00
|
|
|
export type HTMLAttributes<Tag extends HTMLTag> = Omit<
|
|
|
|
astroHTML.JSX.IntrinsicElements[Tag],
|
2022-11-03 12:05:22 +00:00
|
|
|
keyof Omit<AstroBuiltinAttributes, 'class:list'>
|
2022-10-26 15:16:54 +00:00
|
|
|
>;
|
2022-10-26 15:14:08 +00:00
|
|
|
|
2023-05-17 13:38:27 +00:00
|
|
|
type PolymorphicAttributes<P extends { as: HTMLTag }> = Omit<P & HTMLAttributes<P['as']>, 'as'> & {
|
|
|
|
as?: P['as'];
|
|
|
|
};
|
|
|
|
export type Polymorphic<P extends { as: HTMLTag }> = PolymorphicAttributes<
|
|
|
|
Omit<P, 'as'> & { as: NonNullable<P['as']> }
|
|
|
|
>;
|