`.
+ */
+ queryFallbacks?: boolean;
+ /**
+ * Only considers elements with the specified accessible name.
+ */
+ name?: string | RegExp | ((accessibleName: string, element: Element) => boolean);
+}
+
+export type AllByRole = (container: HTMLElement, role: Matcher, options?: ByRoleOptions) => HTMLElement[];
+
+export type GetByRole = (container: HTMLElement, role: Matcher, options?: ByRoleOptions) => HTMLElement;
+
+export type QueryByRole = (container: HTMLElement, role: Matcher, options?: ByRoleOptions) => HTMLElement | null;
+
+export type FindByRole = (
+ container: HTMLElement,
+ role: Matcher,
+ options?: ByRoleOptions,
+ waitForElementOptions?: waitForOptions,
+) => Promise
;
+
+export type FindAllByRole = (
+ container: HTMLElement,
+ role: Matcher,
+ options?: ByRoleOptions,
+ waitForElementOptions?: waitForOptions,
+) => Promise;
+
+export const getByLabelText: GetByText;
+export const getAllByLabelText: AllByText;
+export const queryByLabelText: QueryByText;
+export const queryAllByLabelText: AllByText;
+export const findByLabelText: FindByText;
+export const findAllByLabelText: FindAllByText;
+export const getByPlaceholderText: GetByBoundAttribute;
+export const getAllByPlaceholderText: AllByBoundAttribute;
+export const queryByPlaceholderText: QueryByBoundAttribute;
+export const queryAllByPlaceholderText: AllByBoundAttribute;
+export const findByPlaceholderText: FindByBoundAttribute;
+export const findAllByPlaceholderText: FindAllByBoundAttribute;
+export const getByText: GetByText;
+export const getAllByText: AllByText;
+export const queryByText: QueryByText;
+export const queryAllByText: AllByText;
+export const findByText: FindByText;
+export const findAllByText: FindAllByText;
+export const getByAltText: GetByBoundAttribute;
+export const getAllByAltText: AllByBoundAttribute;
+export const queryByAltText: QueryByBoundAttribute;
+export const queryAllByAltText: AllByBoundAttribute;
+export const findByAltText: FindByBoundAttribute;
+export const findAllByAltText: FindAllByBoundAttribute;
+export const getByTitle: GetByBoundAttribute;
+export const getAllByTitle: AllByBoundAttribute;
+export const queryByTitle: QueryByBoundAttribute;
+export const queryAllByTitle: AllByBoundAttribute;
+export const findByTitle: FindByBoundAttribute;
+export const findAllByTitle: FindAllByBoundAttribute;
+export const getByDisplayValue: GetByBoundAttribute;
+export const getAllByDisplayValue: AllByBoundAttribute;
+export const queryByDisplayValue: QueryByBoundAttribute;
+export const queryAllByDisplayValue: AllByBoundAttribute;
+export const findByDisplayValue: FindByBoundAttribute;
+export const findAllByDisplayValue: FindAllByBoundAttribute;
+export const getByRole: GetByRole;
+export const getAllByRole: AllByRole;
+export const queryByRole: QueryByRole;
+export const queryAllByRole: AllByRole;
+export const findByRole: FindByRole;
+export const findAllByRole: FindAllByRole;
+export const getByTestId: GetByBoundAttribute;
+export const getAllByTestId: AllByBoundAttribute;
+export const queryByTestId: QueryByBoundAttribute;
+export const queryAllByTestId: AllByBoundAttribute;
+export const findByTestId: FindByBoundAttribute;
+export const findAllByTestId: FindAllByBoundAttribute;
diff --git a/types/query-helpers.d.ts b/types/query-helpers.d.ts
new file mode 100644
index 00000000..63a1f69b
--- /dev/null
+++ b/types/query-helpers.d.ts
@@ -0,0 +1,46 @@
+import { Matcher, MatcherOptions } from './matches';
+
+export interface SelectorMatcherOptions extends MatcherOptions {
+ selector?: string;
+}
+
+export type QueryByAttribute = (
+ attribute: string,
+ container: HTMLElement,
+ id: Matcher,
+ options?: MatcherOptions,
+) => HTMLElement | null;
+
+export type AllByAttribute = (
+ attribute: string,
+ container: HTMLElement,
+ id: Matcher,
+ options?: MatcherOptions,
+) => HTMLElement[];
+
+export const queryByAttribute: QueryByAttribute;
+export const queryAllByAttribute: AllByAttribute;
+export function getElementError(message: string, container: HTMLElement): Error;
+
+/**
+ * query methods have a common call signature. Only the return type differs.
+ */
+export type QueryMethod = (container: HTMLElement, ...args: Arguments) => Return;
+export type QueryBy = QueryMethod;
+export type GetAllBy = QueryMethod;
+export type FindAllBy = QueryMethod>;
+export type GetBy = QueryMethod;
+export type FindBy = QueryMethod>;
+
+export type BuiltQueryMethods = [
+ QueryBy,
+ GetAllBy,
+ GetBy,
+ FindAllBy,
+ FindBy
+];
+export function buildQueries(
+ queryByAll: GetAllBy,
+ getMultipleError: (container: HTMLElement, ...args: Arguments) => string,
+ getMissingError: (container: HTMLElement, ...args: Arguments) => string,
+): BuiltQueryMethods;
diff --git a/types/role-helpers.d.ts b/types/role-helpers.d.ts
new file mode 100644
index 00000000..3dd35b78
--- /dev/null
+++ b/types/role-helpers.d.ts
@@ -0,0 +1,6 @@
+export function logRoles(container: HTMLElement): string;
+export function getRoles(container: HTMLElement): { [index: string]: HTMLElement[] };
+/**
+ * https://testing-library.com/docs/dom-testing-library/api-helpers#isinaccessible
+ */
+export function isInaccessible(element: Element): boolean;
diff --git a/types/screen.d.ts b/types/screen.d.ts
new file mode 100644
index 00000000..906b59ef
--- /dev/null
+++ b/types/screen.d.ts
@@ -0,0 +1,17 @@
+import { BoundFunctions, Queries } from './get-queries-for-element';
+import * as queries from './queries';
+import { OptionsReceived } from 'pretty-format';
+
+export type Screen = BoundFunctions & {
+ /**
+ * Convenience function for `pretty-dom` which also allows an array
+ * of elements
+ */
+ debug: (
+ element: Element | HTMLDocument | Array,
+ maxLength?: number,
+ options?: OptionsReceived,
+ ) => void;
+};
+
+export const screen: Screen;
diff --git a/types/tsconfig.json b/types/tsconfig.json
new file mode 100644
index 00000000..c4da27db
--- /dev/null
+++ b/types/tsconfig.json
@@ -0,0 +1,17 @@
+// this additional tsconfig is required by dtslint
+// see: https://github.com/Microsoft/dtslint#typestsconfigjson
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": ["es6", "dom"],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "noEmit": true,
+
+ // If the library is an external module (uses `export`), this allows your test file to import "mylib" instead of "./index".
+ // If the library is global (cannot be imported via `import` or `require`), leave this out.
+ "baseUrl": "."
+ }
+}
diff --git a/types/tslint.json b/types/tslint.json
new file mode 100644
index 00000000..5d45232f
--- /dev/null
+++ b/types/tslint.json
@@ -0,0 +1,8 @@
+{
+ "extends": ["dtslint/dtslint.json"],
+ "rules": {
+ "no-useless-files": false,
+ "no-relative-import-in-test": false,
+ "semicolon": false
+ }
+}
diff --git a/types/wait-for-dom-change.d.ts b/types/wait-for-dom-change.d.ts
new file mode 100644
index 00000000..2fe72c10
--- /dev/null
+++ b/types/wait-for-dom-change.d.ts
@@ -0,0 +1,3 @@
+import { waitForOptions } from "index";
+
+export function waitForDomChange(options?: waitForOptions): Promise;
diff --git a/types/wait-for-element-to-be-removed.d.ts b/types/wait-for-element-to-be-removed.d.ts
new file mode 100644
index 00000000..42a891ac
--- /dev/null
+++ b/types/wait-for-element-to-be-removed.d.ts
@@ -0,0 +1,6 @@
+import { waitForOptions } from "wait-for";
+
+export function waitForElementToBeRemoved(
+ callback: (() => T) | T,
+ options?: waitForOptions,
+): Promise;
diff --git a/types/wait-for-element.d.ts b/types/wait-for-element.d.ts
new file mode 100644
index 00000000..f21fb112
--- /dev/null
+++ b/types/wait-for-element.d.ts
@@ -0,0 +1,3 @@
+import { waitForOptions } from "wait-for";
+
+export function waitForElement(callback: () => T, options?: waitForOptions): Promise;
diff --git a/types/wait-for.d.ts b/types/wait-for.d.ts
new file mode 100644
index 00000000..3c39073b
--- /dev/null
+++ b/types/wait-for.d.ts
@@ -0,0 +1,11 @@
+export interface waitForOptions {
+ container?: HTMLElement;
+ timeout?: number;
+ interval?: number;
+ mutationObserverOptions?: MutationObserverInit;
+}
+
+export function waitFor(
+ callback: () => T,
+ options?: waitForOptions,
+): Promise;
diff --git a/types/wait.d.ts b/types/wait.d.ts
new file mode 100644
index 00000000..3763e7bd
--- /dev/null
+++ b/types/wait.d.ts
@@ -0,0 +1,7 @@
+export function wait(
+ callback?: () => void,
+ options?: {
+ timeout?: number;
+ interval?: number;
+ },
+): Promise;