diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index d6cf3b2a7f21..c1b4919901ab 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -13,6 +13,7 @@ on: - "scripts/smoke/check.js" - "packages/astro/src/@types/astro.ts" - "pnpm-lock.yaml" + - "packages/astro/types.d.ts" env: ASTRO_TELEMETRY_DISABLED: true diff --git a/packages/astro/astro-jsx.d.ts b/packages/astro/astro-jsx.d.ts index 5a5ee14db68a..869e64d5c919 100644 --- a/packages/astro/astro-jsx.d.ts +++ b/packages/astro/astro-jsx.d.ts @@ -526,7 +526,7 @@ declare namespace astroHTML.JSX { | 'search' | 'send' | undefined - | null; + | null; exportparts?: string | undefined | null; hidden?: boolean | string | undefined | null; id?: string | undefined | null; @@ -584,6 +584,9 @@ declare namespace astroHTML.JSX { results?: number | string | undefined | null; security?: string | undefined | null; unselectable?: 'on' | 'off' | undefined | null; // Internet Explorer + + // Allow data- attribute + [key: `data-${string}`]: any; } type HTMLAttributeReferrerPolicy = @@ -1344,6 +1347,9 @@ declare namespace astroHTML.JSX { yChannelSelector?: string | undefined | null; z?: number | string | undefined | null; zoomAndPan?: string | undefined | null; + + // Allow data- attribute + [key: `data-${string}`]: any; } interface DefinedIntrinsicElements { diff --git a/packages/astro/types.d.ts b/packages/astro/types.d.ts index eaf3f30c6baf..3069f502b916 100644 --- a/packages/astro/types.d.ts +++ b/packages/astro/types.d.ts @@ -9,18 +9,17 @@ export type HTMLTag = keyof astroHTML.JSX.DefinedIntrinsicElements; 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 */ export type CSSProperty = keyof astroHTML.JSX.KebabCSSDOMProperties; -type PolymorphicAttributes

= Omit

, 'as'> & { +type PolymorphicAttributes

= Omit & { as?: P['as']; -}; +} & HTMLAttributes; + export type Polymorphic

= PolymorphicAttributes< Omit & { as: NonNullable } >;