-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Conversation
🦋 Changeset detectedLatest commit: e2f956b The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a major
changeset. A reviewer will merge this at the next release if approved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @admirsaheta, thanks for the PR! We are always glad to have new contributors.
There are just some things to improve on the changeset:
- Those messages get added to the release notes and to the changelog, so we use clear descriptions of what was changed or fixed for people to understand how it might affect them.
- The changeset also indicates how the change relates to SemVer, so a "major" there would mean a breaking change that would have to wait until Astro 5 to be included. That is not the case here. Since this PR doesn't change any Astro behavior and fixes a problem it can be a patch.
<Image />
component when strict TypeScript rules are used with library type checking.
Hmm, I think there's a better fix here. |
Co-authored-by: Florian Lefebvre <[email protected]>
You could extend the interface and provide custom attributes there e.g interface AdditionalAttributes extends HTMLAttributes<HTMLImageElement> {
'data-image-component'?: string;
} Let me know which approach fits better |
We have been discussing on discord to update the astro/packages/astro/types.d.ts Line 8 in 1cd2a74
[key: `data-${string}`]: any Do you want to handle it? |
Sure thing, give me a few :) |
There's no rush don't worry! |
Should handle it correctly here now 👍 |
packages/astro/types.d.ts
Outdated
>; | ||
keyof Omit<AstroBuiltinAttributes, 'class:list'> | ||
> & { | ||
[key: string]: string | number | boolean | undefined; |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 alsonull
would be great
Done
Co-authored-by: Florian Lefebvre <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changes
Fixes the following typescript issue, with it now being explicitly defined to avoid type mismatch on the runtime interpreter
Testing
Docs