Skip to content

Commit 284178b

Browse files
committed
refactor: replace String with workaround to allow intellisense
1 parent 7181579 commit 284178b

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

types/matches.d.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ import {ARIARole} from 'aria-query'
33
export type MatcherFunction = (content: string, element: HTMLElement) => boolean
44
export type Matcher = string | RegExp | MatcherFunction
55

6-
// Allow `String` to have intellisense for roles while writing ByRole queries
7-
// If `string` is used it overrules the ARIARole string union types
8-
// resulting in no intellisense
9-
// We still want to support roles not included in the union type
10-
/* tslint:disable:ban-types */
11-
export type ByRoleMatcher = ARIARole | String | RegExp | MatcherFunction
6+
// Get autocomplete for ARIARole union types, while still supporting another string
7+
// Ref: https://github.com/microsoft/TypeScript/issues/29729#issuecomment-505826972
8+
export type ByRoleMatcher = ARIARole | (string & {}) | RegExp | MatcherFunction
129

1310
export type NormalizerFn = (text: string) => string
1411

0 commit comments

Comments
 (0)