diff --git a/package.json b/package.json index 488fadf7..e86ee9af 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/types/__tests__/type-tests.ts b/types/__tests__/type-tests.ts index cb8b56e0..83b6f5f2 100644 --- a/types/__tests__/type-tests.ts +++ b/types/__tests__/type-tests.ts @@ -8,7 +8,7 @@ import { waitFor, waitForElementToBeRemoved, MatcherOptions, -} from '../index' +} from '@testing-library/dom' const { getByText, @@ -162,4 +162,7 @@ async function testWaitFors() { }) await waitForElementToBeRemoved(getByText(element, 'apple')) await waitForElementToBeRemoved(getAllByText(element, 'apple')) + + // $ExpectError + await waitFor(async () => {}) } diff --git a/types/tsconfig.json b/types/tsconfig.json index c4da27db..3f2f555c 100644 --- a/types/tsconfig.json +++ b/types/tsconfig.json @@ -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": ["."]} } } diff --git a/types/wait-for.d.ts b/types/wait-for.d.ts index 3c39073b..0fd0e56a 100644 --- a/types/wait-for.d.ts +++ b/types/wait-for.d.ts @@ -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( - callback: () => T, - options?: waitForOptions, -): Promise; + callback: () => T extends Promise ? never : T, + options?: waitForOptions, +): Promise