Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Type error on <Image /> component when strict TypeScript rules are used with library type checking. #10549

Merged
merged 10 commits into from
Mar 26, 2024
5 changes: 5 additions & 0 deletions .changeset/blue-dolls-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Updated the `HTMLAttributes` type exported from `astro` to allow data attributes
7 changes: 5 additions & 2 deletions packages/astro/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'>
>;
keyof Omit<AstroBuiltinAttributes, 'class:list'>
> & {
[key: string]: string | number | boolean | undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Princesseuh Do you prefer any?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without necessarily using any, allowing also null would be great

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without necessarily using any, allowing also null would be great

Done

};

/**
* All the CSS properties available, as defined by the CSS specification
Expand Down