Skip to content

Commit b5584eb

Browse files
eps1lonKent C. Dodds
authored and
Kent C. Dodds
committed
fix(TS): act type (#438)
* fix(types): Use act types from react-dom * Fix unary not extending binary
1 parent f4b813e commit b5584eb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
"license": "MIT",
4545
"dependencies": {
4646
"@babel/runtime": "^7.5.5",
47-
"@testing-library/dom": "^6.0.0"
47+
"@testing-library/dom": "^6.0.0",
48+
"@types/react-dom": "*"
4849
},
4950
"devDependencies": {
5051
"@reach/router": "^1.2.1",

typings/index.d.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {queries, Queries, BoundFunction} from '@testing-library/dom'
2+
import {act as reactAct} from 'react-dom/test-utils'
23

34
export * from '@testing-library/dom'
45

@@ -43,4 +44,6 @@ export function cleanup(): void
4344
* If that's not available (older version of react) then it
4445
* simply calls the given callback immediately
4546
*/
46-
export function act(callback: () => void): void
47+
export const act: typeof reactAct extends undefined
48+
? (callback: () => void) => void
49+
: typeof reactAct

0 commit comments

Comments
 (0)