From 54c2f9707f5d038630143f769e3075c698474654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Admir=20=C5=A0aheta?= <81534875+admirsaheta@users.noreply.github.com> Date: Tue, 26 Mar 2024 10:44:17 +0100 Subject: [PATCH] Fix: Type error on `` 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 * add:types-htmlattribute-extends * Update .changeset/blue-dolls-melt.md Co-authored-by: Florian Lefebvre * Update blue-dolls-melt.md * addition: allow specifying null type --------- Co-authored-by: Florian Lefebvre --- .changeset/blue-dolls-melt.md | 5 +++++ packages/astro/types.d.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/blue-dolls-melt.md diff --git a/.changeset/blue-dolls-melt.md b/.changeset/blue-dolls-melt.md new file mode 100644 index 000000000000..a4d0c26d7961 --- /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 7eaa4823c636..eaf3f30c6baf 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 = Omit< astroHTML.JSX.IntrinsicElements[Tag], keyof Omit ->; +> & { + [key: string]: string | number | boolean | null | undefined; +}; /** * All the CSS properties available, as defined by the CSS specification