File tree 3 files changed +2
-6
lines changed 3 files changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -241,7 +241,7 @@ function makeRoleSelector(
241
241
const explicitRoleSelector =
242
242
exact && ! customNormalizer ? `*[role~="${ role } "]` : '*[role]'
243
243
244
- const roleRelations = roleElements . get ( role ) ?? new Set ( )
244
+ const roleRelations = roleElements . get ( role as ARIARoleDefinitionKey ) ?? new Set ( )
245
245
const implicitRoleSelectors = new Set (
246
246
Array . from ( roleRelations ) . map ( ( { name} ) => name ) ,
247
247
)
Original file line number Diff line number Diff line change @@ -182,13 +182,9 @@ export async function testByRole() {
182
182
} ) === null ,
183
183
)
184
184
185
- // @ts -expect-error: allow to query for a role that isn't included in the types
186
185
console . assert ( queryByRole ( element , 'foo' ) === null )
187
- // @ts -expect-error: allow to query for a role that isn't included in the types
188
186
console . assert ( queryByRole ( element , / f o o / ) === null )
189
- // @ts -expect-error: allow to query for a role that isn't included in the types
190
187
console . assert ( screen . queryByRole ( 'foo' ) === null )
191
- // @ts -expect-error: allow to query for a role that isn't included in the types
192
188
console . assert ( screen . queryByRole ( / f o o / ) === null )
193
189
}
194
190
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export type Matcher = MatcherFunction | RegExp | number | string
8
8
9
9
// Get autocomplete for ARIARole union types, while still supporting another string
10
10
// Ref: https://github.com/microsoft/TypeScript/issues/29729#issuecomment-505826972
11
- export type ByRoleMatcher = ARIARole | MatcherFunction
11
+ export type ByRoleMatcher = ARIARole | MatcherFunction | { }
12
12
13
13
export type NormalizerFn = ( text : string ) => string
14
14
You can’t perform that action at this time.
0 commit comments