Skip to content

Commit 115de75

Browse files
dobogobenmonro
authored andcommitted
feat: Add TypeScript definition (#22)
1 parent 7f7799a commit 115de75

File tree

3 files changed

+68
-4
lines changed

3 files changed

+68
-4
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ build/Release
4040
node_modules/
4141
jspm_packages/
4242

43-
# TypeScript v1 declaration files
44-
typings/
45-
4643
# Optional npm cache directory
4744
.npm
4845

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.0.1-semantically-released",
44
"description": "",
55
"main": "dist/index.js",
6+
"typings": "typings",
67
"scripts": {
78
"add-contributor": "kcd-scripts contributors add",
89
"build": "kcd-scripts build",
@@ -16,7 +17,8 @@
1617
"semantic-release": "semantic-release"
1718
},
1819
"files": [
19-
"dist"
20+
"dist",
21+
"typings"
2022
],
2123
"keywords": [],
2224
"author": "",

typings/index.d.ts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import {BoundFunction, IConfig, queries} from '@testing-library/dom';
2+
import {Selector, t} from 'testcafe';
3+
4+
export function addTestcafeTestingLibrary(
5+
testController: typeof t
6+
): Promise<void>;
7+
8+
export function configure(
9+
options: Pick<IConfig, 'testIdAttribute'>,
10+
testController: typeof t
11+
): Promise<void>;
12+
13+
export type TestcafeBoundFunction<T> = (...params: Parameters<BoundFunction<T>>) => Selector;
14+
export type TestcafeBoundFunctions<T> = {[P in keyof T]: TestcafeBoundFunction<T[P]>};
15+
16+
export function within(selector: string): Promise<TestcafeBoundFunctions<typeof queries>>;
17+
18+
export const getByLabelText: TestcafeBoundFunction<typeof queries.getByLabelText>;
19+
export const getAllByLabelText: TestcafeBoundFunction<typeof queries.getAllByLabelText>;
20+
export const queryByLabelText: TestcafeBoundFunction<typeof queries.queryByLabelText>;
21+
export const queryAllByLabelText: TestcafeBoundFunction<typeof queries.queryAllByLabelText>;
22+
export const findByLabelText: TestcafeBoundFunction<typeof queries.findByLabelText>;
23+
export const findAllByLabelText: TestcafeBoundFunction<typeof queries.findAllByLabelText>;
24+
export const getByPlaceholderText: TestcafeBoundFunction<typeof queries.getByPlaceholderText>;
25+
export const getAllByPlaceholderText: TestcafeBoundFunction<typeof queries.getAllByPlaceholderText>;
26+
export const queryByPlaceholderText: TestcafeBoundFunction<typeof queries.queryByPlaceholderText>;
27+
export const queryAllByPlaceholderText: TestcafeBoundFunction<typeof queries.queryAllByPlaceholderText>;
28+
export const findByPlaceholderText: TestcafeBoundFunction<typeof queries.findByPlaceholderText>;
29+
export const findAllByPlaceholderText: TestcafeBoundFunction<typeof queries.findAllByPlaceholderText>;
30+
export const getByText: TestcafeBoundFunction<typeof queries.getByText>;
31+
export const getAllByText: TestcafeBoundFunction<typeof queries.getAllByText>;
32+
export const queryByText: TestcafeBoundFunction<typeof queries.queryByText>;
33+
export const queryAllByText: TestcafeBoundFunction<typeof queries.queryAllByText>;
34+
export const findByText: TestcafeBoundFunction<typeof queries.findByText>;
35+
export const findAllByText: TestcafeBoundFunction<typeof queries.findAllByText>;
36+
export const getByAltText: TestcafeBoundFunction<typeof queries.getByAltText>;
37+
export const getAllByAltText: TestcafeBoundFunction<typeof queries.getAllByAltText>;
38+
export const queryByAltText: TestcafeBoundFunction<typeof queries.queryByAltText>;
39+
export const queryAllByAltText: TestcafeBoundFunction<typeof queries.queryAllByAltText>;
40+
export const findByAltText: TestcafeBoundFunction<typeof queries.findByAltText>;
41+
export const findAllByAltText: TestcafeBoundFunction<typeof queries.findAllByAltText>;
42+
export const getByTitle: TestcafeBoundFunction<typeof queries.getByTitle>;
43+
export const getAllByTitle: TestcafeBoundFunction<typeof queries.getAllByTitle>;
44+
export const queryByTitle: TestcafeBoundFunction<typeof queries.queryByTitle>;
45+
export const queryAllByTitle: TestcafeBoundFunction<typeof queries.queryAllByTitle>;
46+
export const findByTitle: TestcafeBoundFunction<typeof queries.findByTitle>;
47+
export const findAllByTitle: TestcafeBoundFunction<typeof queries.findAllByTitle>;
48+
export const getByDisplayValue: TestcafeBoundFunction<typeof queries.getByDisplayValue>;
49+
export const getAllByDisplayValue: TestcafeBoundFunction<typeof queries.getAllByDisplayValue>;
50+
export const queryByDisplayValue: TestcafeBoundFunction<typeof queries.queryByDisplayValue>;
51+
export const queryAllByDisplayValue: TestcafeBoundFunction<typeof queries.queryAllByDisplayValue>;
52+
export const findByDisplayValue: TestcafeBoundFunction<typeof queries.findByDisplayValue>;
53+
export const findAllByDisplayValue: TestcafeBoundFunction<typeof queries.findAllByDisplayValue>;
54+
export const getByRole: TestcafeBoundFunction<typeof queries.getByRole>;
55+
export const getAllByRole: TestcafeBoundFunction<typeof queries.getAllByRole>;
56+
export const queryByRole: TestcafeBoundFunction<typeof queries.queryByRole>;
57+
export const queryAllByRole: TestcafeBoundFunction<typeof queries.queryAllByRole>;
58+
export const findByRole: TestcafeBoundFunction<typeof queries.findByRole>;
59+
export const findAllByRole: TestcafeBoundFunction<typeof queries.findAllByRole>;
60+
export const getByTestId: TestcafeBoundFunction<typeof queries.getByTestId>;
61+
export const getAllByTestId: TestcafeBoundFunction<typeof queries.getAllByTestId>;
62+
export const queryByTestId: TestcafeBoundFunction<typeof queries.queryByTestId>;
63+
export const queryAllByTestId: TestcafeBoundFunction<typeof queries.queryAllByTestId>;
64+
export const findByTestId: TestcafeBoundFunction<typeof queries.findByTestId>;
65+
export const findAllByTestId: TestcafeBoundFunction<typeof queries.findAllByTestId>;

0 commit comments

Comments
 (0)