Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"jest-serializer-ansi": "^1.0.3",
"jest-watch-select-projects": "^2.0.0",
"jsdom": "^16.2.2",
"kcd-scripts": "^6.0.0"
"kcd-scripts": "^6.2.0"
},
"eslintConfig": {
"extends": "./node_modules/kcd-scripts/eslint.js",
Expand Down
5 changes: 4 additions & 1 deletion types/__tests__/type-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
waitFor,
waitForElementToBeRemoved,
MatcherOptions,
} from '../index'
} from '@testing-library/dom'

const {
getByText,
Expand Down Expand Up @@ -162,4 +162,7 @@ async function testWaitFors() {
})
await waitForElementToBeRemoved(getByText(element, 'apple'))
await waitForElementToBeRemoved(getAllByText(element, 'apple'))

// $ExpectError
await waitFor(async () => {})
}
6 changes: 2 additions & 4 deletions types/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
"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": "."
"baseUrl": ".",
"paths": {"@testing-library/dom": ["."]}
}
}
14 changes: 7 additions & 7 deletions types/wait-for.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export interface waitForOptions {
container?: HTMLElement;
timeout?: number;
interval?: number;
mutationObserverOptions?: MutationObserverInit;
container?: HTMLElement
timeout?: number
interval?: number
mutationObserverOptions?: MutationObserverInit
}

export function waitFor<T>(
callback: () => T,
options?: waitForOptions,
): Promise<T>;
callback: () => T extends Promise<any> ? never : T,
options?: waitForOptions,
): Promise<T>