diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/astro/package.json | 1 | ||||
-rw-r--r-- | packages/astro/types.d.ts | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/packages/astro/package.json b/packages/astro/package.json index 527a87e1a..331ef6b27 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -29,6 +29,7 @@ "default": "./astro.js" }, "./env": "./env.d.ts", + "./types": "./types.d.ts", "./client": "./client.d.ts", "./client-base": "./client-base.d.ts", "./import-meta": "./import-meta.d.ts", diff --git a/packages/astro/types.d.ts b/packages/astro/types.d.ts new file mode 100644 index 000000000..ae56cd2dc --- /dev/null +++ b/packages/astro/types.d.ts @@ -0,0 +1,11 @@ +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 */ +export type HTMLAttributes<Tag extends HTMLTag> = Omit<astroHTML.JSX.IntrinsicElements[Tag], keyof AstroBuiltinAttributes>; + +// TODO: Enable generic/polymorphic types once compiler output stabilizes in the Language Server +// 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']>}>; |