From 4698615506fef2c984aa994a1b21a761fe7b6cfe Mon Sep 17 00:00:00 2001 From: Fotis Papadogeorgopoulos Date: Tue, 30 Jan 2024 21:08:37 +0200 Subject: [PATCH 1/2] 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. --- types/matchers.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/matchers.d.ts b/types/matchers.d.ts index cdd66c1..400d82a 100755 --- a/types/matchers.d.ts +++ b/types/matchers.d.ts @@ -1,9 +1,5 @@ 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 & {}) - 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. From d9daafdcf3c6d9ce1e33767899bb34dc4589354b Mon Sep 17 00:00:00 2001 From: Fotis Papadogeorgopoulos Date: Thu, 1 Feb 2024 09:03:25 +0200 Subject: [PATCH 2/2] import type for ARIARole --- types/matchers.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/matchers.d.ts b/types/matchers.d.ts index 400d82a..dfea7f1 100755 --- a/types/matchers.d.ts +++ b/types/matchers.d.ts @@ -1,4 +1,4 @@ -import {ARIARole} from 'aria-query' +import {type ARIARole} from 'aria-query' declare namespace matchers { interface TestingLibraryMatchers {