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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/declarations/stencil-public-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1856,7 +1856,6 @@ export namespace JSXBase {

// WAI-ARIA Attributes
[key: `aria-${string}`]: string | boolean | undefined;
[key: `aria${string}`]: string | boolean | undefined;
}
}

Expand Down
7 changes: 3 additions & 4 deletions test/type-tests/test.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import { h } from '@stencil/core';
export function TypeTestComponent() {
return (
<div>
<h1 ariaLabel="123">Hello</h1>
<h1 ariaLabel={'123'}>Hello</h1>
{/* @ts-expect-error */}
<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.

Copy link
Member

Choose a reason for hiding this comment

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

@AlirezaEbrahimkhani any feedback?

Copy link

Choose a reason for hiding this comment

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

@AlirezaEbrahimkhani any update ?

<attribute-complex
// @ts-expect-error
nu0={'123'}
Expand Down
Loading