Skip to content

Commit 2a1f1e6

Browse files
authored
fix: proper typedefs for role queries (#62)
1 parent d88d5dd commit 2a1f1e6

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

lib/typedefs.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
ByRoleOptions as ByRoleOptions_,
23
Matcher,
34
MatcherOptions as MatcherOptions_,
45
SelectorMatcherOptions as SelectorMatcherOptions_,
@@ -10,16 +11,7 @@ type Element = ElementHandle
1011

1112
type MatcherOptions = Omit<MatcherOptions_, 'normalizer'>
1213
type SelectorMatcherOptions = Omit<SelectorMatcherOptions_, 'normalizer'>
13-
14-
// tslint:disable-next-line
15-
interface RoleMatcherOptions extends MatcherOptions {
16-
name?: string | RegExp
17-
}
18-
19-
// tslint:disable-next-line
20-
interface SelectorRoleMatcherOptions extends SelectorMatcherOptions {
21-
name?: string | RegExp
22-
}
14+
type ByRoleOptions = Omit<ByRoleOptions_, 'normalizer'>
2315

2416
interface IQueryMethods {
2517
queryByPlaceholderText(el: Element, m: Matcher, opts?: MatcherOptions): Promise<Element | null>
@@ -124,20 +116,20 @@ interface IQueryMethods {
124116
waitForOpts?: waitForOptions,
125117
): Promise<Element[]>
126118

127-
queryByRole(el: Element, m: Matcher, opts?: RoleMatcherOptions): Promise<Element | null>
128-
queryAllByRole(el: Element, m: Matcher, opts?: RoleMatcherOptions): Promise<Element[]>
129-
getByRole(el: Element, m: Matcher, opts?: RoleMatcherOptions): Promise<Element>
130-
getAllByRole(el: Element, m: Matcher, opts?: RoleMatcherOptions): Promise<Element[]>
119+
queryByRole(el: Element, m: Matcher, opts?: ByRoleOptions): Promise<Element | null>
120+
queryAllByRole(el: Element, m: Matcher, opts?: ByRoleOptions): Promise<Element[]>
121+
getByRole(el: Element, m: Matcher, opts?: ByRoleOptions): Promise<Element>
122+
getAllByRole(el: Element, m: Matcher, opts?: ByRoleOptions): Promise<Element[]>
131123
findByRole(
132124
el: Element,
133125
m: Matcher,
134-
opts?: SelectorRoleMatcherOptions,
126+
opts?: ByRoleOptions,
135127
waitForOpts?: waitForOptions,
136128
): Promise<Element>
137129
findAllByRole(
138130
el: Element,
139131
m: Matcher,
140-
opts?: SelectorRoleMatcherOptions,
132+
opts?: ByRoleOptions,
141133
waitForOpts?: waitForOptions,
142134
): Promise<Element[]>
143135

0 commit comments

Comments
 (0)