summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Admir Ĺ aheta <81534875+admirsaheta@users.noreply.github.com> 2024-03-26 10:44:17 +0100
committerGravatar GitHub <noreply@github.com> 2024-03-26 10:44:17 +0100
commit54c2f9707f5d038630143f769e3075c698474654 (patch)
tree9356c367dd12b1a960502f918e6785f9923fdd0a
parentc585528f446ccca3d4c643f4af5d550b93c18902 (diff)
downloadastro-54c2f9707f5d038630143f769e3075c698474654.tar.gz
astro-54c2f9707f5d038630143f769e3075c698474654.tar.zst
astro-54c2f9707f5d038630143f769e3075c698474654.zip
Fix: Type error on `<Image />` component when strict TypeScript rules are used with library type checking. (#10549)
* hotfix:ts-explicit-error * add:changeset * update:changeset * Update .changeset/blue-dolls-melt.md Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev> * add:types-htmlattribute-extends * Update .changeset/blue-dolls-melt.md Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev> * Update blue-dolls-melt.md * addition: allow specifying null type --------- Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
-rw-r--r--.changeset/blue-dolls-melt.md5
-rw-r--r--packages/astro/types.d.ts5
2 files changed, 9 insertions, 1 deletions
diff --git a/.changeset/blue-dolls-melt.md b/.changeset/blue-dolls-melt.md
new file mode 100644
index 000000000..a4d0c26d7
--- /dev/null
+++ b/.changeset/blue-dolls-melt.md
@@ -0,0 +1,5 @@
+---
+"astro": patch
+---
+
+Updates the `HTMLAttributes` type exported from `astro` to allow data attributes
diff --git a/packages/astro/types.d.ts b/packages/astro/types.d.ts
index 7eaa4823c..eaf3f30c6 100644
--- a/packages/astro/types.d.ts
+++ b/packages/astro/types.d.ts
@@ -4,11 +4,14 @@ import type { Simplify } from './dist/type-utils.js';
/** 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 Omit<AstroBuiltinAttributes, 'class:list'>
->;
+> & {
+ [key: string]: string | number | boolean | null | undefined;
+};
/**
* All the CSS properties available, as defined by the CSS specification