From a93c0c4a20ed4d3a9656261ea6a449d1015b7879 Mon Sep 17 00:00:00 2001 From: Fotis Papadogeorgopoulos Date: Mon, 5 Feb 2024 14:57:23 +0200 Subject: [PATCH] fix: Remove errant export of GetByRoleMatcher, fixing type checking in some TS configurations (#575) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- types/matchers.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/matchers.d.ts b/types/matchers.d.ts index cdd66c1..dfea7f1 100755 --- a/types/matchers.d.ts +++ b/types/matchers.d.ts @@ -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 { @@ -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.