Skip to content

fix(types): correct key name interpolation for ARIA attributes in DOM typings #6244

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AlirezaEbrahimkhani
Copy link
Contributor

@AlirezaEbrahimkhani AlirezaEbrahimkhani commented Apr 19, 2025

This issue was raised by @duhem-s in a comment on my previous PR (#6221), and I'm addressing it in this one.

What is the current behavior?

GitHub Issue Number: N/A

What is the new behavior?

Documentation

Does this introduce a breaking change?

  • Yes
  • No

Testing

Other information

@AlirezaEbrahimkhani AlirezaEbrahimkhani requested a review from a team as a code owner April 19, 2025 21:38
Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@christian-bromann
Copy link
Member

@AlirezaEbrahimkhani it seems like there are 2 tests failing:

Error: test/type-tests/test.spec.tsx(8,11): error TS2322: Type '{ ariaLabel: string; }' is not assignable to type 'HTMLAttributes<HTMLHeadingElement>'.
  Property 'ariaLabel' does not exist on type 'HTMLAttributes<HTMLHeadingElement>'.
Error: test/type-tests/test.spec.tsx(9,11): error TS2322: Type '{ ariaLabel: string; }' is not assignable to type 'HTMLAttributes<HTMLHeadingElement>'.
  Property 'ariaLabel' does not exist on type 'HTMLAttributes<HTMLHeadingElement>'.
Error: Process completed with exit code 2.

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

Mind adjusting the tests?

@AlirezaEbrahimkhani
Copy link
Contributor Author

Mind adjusting the tests?

Thanks for your review. I have fixed it.

<h1 ariaLabel={123}>Hello</h1>
<h1 aria-label="123">Hello</h1>
<h1 aria-label={'123'}>Hello</h1>
<h1 aria-label={123}>Hello</h1>
Copy link
Member

Choose a reason for hiding this comment

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

This should fail as aria-label does not expect a number, however the test seem to pass. The point of the test here is to verify that the compiler here actually points out the type error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants