Skip to content

Commit ecdb70b

Browse files
authored
fix(types): fix types for bound attribute queries
fixes #142
1 parent 6821dc5 commit ecdb70b

File tree

1 file changed

+41
-31
lines changed

1 file changed

+41
-31
lines changed

typings/queries.d.ts

+41-31
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
import {Matcher, MatcherOptions} from './matches'
22
import {
3-
QueryByAttribute,
4-
AllByAttribute,
53
SelectorMatcherOptions,
64
} from './query-helpers'
75

8-
export type GetByAttribute = (
6+
export type QueryByBoundAttribute = (
7+
container: HTMLElement,
8+
id: Matcher,
9+
options?: MatcherOptions,
10+
) => HTMLElement | null
11+
12+
export type AllByBoundAttribute = (
13+
container: HTMLElement,
14+
id: Matcher,
15+
options?: MatcherOptions,
16+
) => HTMLElement[]
17+
18+
export type GetByBoundAttribute = (
919
container: HTMLElement,
1020
id: Matcher,
1121
options?: MatcherOptions,
@@ -29,14 +39,14 @@ export type GetByText = (
2939
options?: SelectorMatcherOptions,
3040
) => HTMLElement
3141

32-
export const queryByPlaceholderText: QueryByAttribute
33-
export const queryAllByPlaceholderText: AllByAttribute
34-
export const getByPlaceholderText: GetByAttribute
35-
export const getAllByPlaceholderText: AllByAttribute
36-
export const queryBySelectText: QueryByAttribute
37-
export const queryAllBySelectText: AllByAttribute
38-
export const getBySelectText: GetByAttribute
39-
export const getAllBySelectText: AllByAttribute
42+
export const queryByPlaceholderText: QueryByBoundAttribute
43+
export const queryAllByPlaceholderText: AllByBoundAttribute
44+
export const getByPlaceholderText: GetByBoundAttribute
45+
export const getAllByPlaceholderText: AllByBoundAttribute
46+
export const queryBySelectText: QueryByBoundAttribute
47+
export const queryAllBySelectText: AllByBoundAttribute
48+
export const getBySelectText: GetByBoundAttribute
49+
export const getAllBySelectText: AllByBoundAttribute
4050
export const queryByText: QueryByText
4151
export const queryAllByText: AllByText
4252
export const getByText: GetByText
@@ -45,23 +55,23 @@ export const queryByLabelText: QueryByText
4555
export const queryAllByLabelText: AllByText
4656
export const getByLabelText: GetByText
4757
export const getAllByLabelText: AllByText
48-
export const queryByAltText: QueryByAttribute
49-
export const queryAllByAltText: AllByAttribute
50-
export const getByAltText: GetByAttribute
51-
export const getAllByAltText: AllByAttribute
52-
export const queryByTestId: QueryByAttribute
53-
export const queryAllByTestId: AllByAttribute
54-
export const getByTestId: GetByAttribute
55-
export const getAllByTestId: AllByAttribute
56-
export const queryByTitle: QueryByAttribute
57-
export const queryAllByTitle: AllByAttribute
58-
export const getByTitle: GetByAttribute
59-
export const getAllByTitle: AllByAttribute
60-
export const queryByValue: QueryByAttribute
61-
export const queryAllByValue: AllByAttribute
62-
export const getByValue: GetByAttribute
63-
export const getAllByValue: AllByAttribute
64-
export const queryByRole: QueryByAttribute
65-
export const queryAllByRole: AllByAttribute
66-
export const getByRole: GetByAttribute
67-
export const getAllByRole: AllByAttribute
58+
export const queryByAltText: QueryByBoundAttribute
59+
export const queryAllByAltText: AllByBoundAttribute
60+
export const getByAltText: GetByBoundAttribute
61+
export const getAllByAltText: AllByBoundAttribute
62+
export const queryByTestId: QueryByBoundAttribute
63+
export const queryAllByTestId: AllByBoundAttribute
64+
export const getByTestId: GetByBoundAttribute
65+
export const getAllByTestId: AllByBoundAttribute
66+
export const queryByTitle: QueryByBoundAttribute
67+
export const queryAllByTitle: AllByBoundAttribute
68+
export const getByTitle: GetByBoundAttribute
69+
export const getAllByTitle: AllByBoundAttribute
70+
export const queryByValue: QueryByBoundAttribute
71+
export const queryAllByValue: AllByBoundAttribute
72+
export const getByValue: GetByBoundAttribute
73+
export const getAllByValue: AllByBoundAttribute
74+
export const queryByRole: QueryByBoundAttribute
75+
export const queryAllByRole: AllByBoundAttribute
76+
export const getByRole: GetByBoundAttribute
77+
export const getAllByRole: AllByBoundAttribute

0 commit comments

Comments
 (0)