diff --git a/package.json b/package.json index 279e065e..ff29c1af 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,8 @@ "license": "MIT", "dependencies": { "@babel/runtime": "^7.5.5", - "@testing-library/dom": "^6.0.0" + "@testing-library/dom": "^6.0.0", + "@types/react-dom": "*" }, "devDependencies": { "@reach/router": "^1.2.1", diff --git a/typings/index.d.ts b/typings/index.d.ts index ddc5512a..ab4528e2 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1,4 +1,5 @@ import {queries, Queries, BoundFunction} from '@testing-library/dom' +import {act as reactAct} from 'react-dom/test-utils' export * from '@testing-library/dom' @@ -43,4 +44,6 @@ export function cleanup(): void * If that's not available (older version of react) then it * simply calls the given callback immediately */ -export function act(callback: () => void): void +export const act: typeof reactAct extends undefined + ? (callback: () => void) => void + : typeof reactAct