Skip to content

Commit a93c0c4

Browse files
fpapadognapse
andauthoredFeb 5, 2024
fix: Remove errant export of GetByRoleMatcher, fixing type checking in some TS configurations (#575)
* Remove errant export of GetByRoleMatcher Mixing export type with export = matchers can throw off TypeScript in some configurations. We do not need to export the matcher as a separate type, since the argument types are available in the matcher already. * import type for ARIARole --------- Co-authored-by: Ernesto García <ernesto@ernesto.dev>
1 parent c5c4e8d commit a93c0c4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

‎types/matchers.d.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {ARIARole} from 'aria-query'
2-
3-
// Get autocomplete for ARIARole union types, while still supporting another string
4-
// Ref: https://github.com/microsoft/TypeScript/issues/29729#issuecomment-567871939
5-
export type ByRoleMatcher = ARIARole | (string & {})
1+
import {type ARIARole} from 'aria-query'
62

73
declare namespace matchers {
84
interface TestingLibraryMatchers<E, R> {
@@ -621,7 +617,11 @@ declare namespace matchers {
621617
* @see
622618
* [testing-library/jest-dom#tohaverole](https://github.com/testing-library/jest-dom#tohaverole)
623619
*/
624-
toHaveRole(role: ByRoleMatcher): R
620+
toHaveRole(
621+
// Get autocomplete for ARIARole union types, while still supporting another string
622+
// Ref: https://github.com/microsoft/TypeScript/issues/29729#issuecomment-567871939
623+
role: ARIARole | (string & {}),
624+
): R
625625
/**
626626
* @description
627627
* This allows you to check whether the given element is partially checked.

0 commit comments

Comments
 (0)
Please sign in to comment.