Skip to content

Commit

Permalink
fix: Remove errant export of GetByRoleMatcher, fixing type checking i…
Browse files Browse the repository at this point in the history
…n 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 <[email protected]>
  • Loading branch information
fpapado and gnapse authored Feb 5, 2024
1 parent c5c4e8d commit a93c0c4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions types/matchers.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {ARIARole} from 'aria-query'

// Get autocomplete for ARIARole union types, while still supporting another string
// Ref: https://github.com/microsoft/TypeScript/issues/29729#issuecomment-567871939
export type ByRoleMatcher = ARIARole | (string & {})
import {type ARIARole} from 'aria-query'

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

0 comments on commit a93c0c4

Please sign in to comment.