File tree 2 files changed +14
-7
lines changed
2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 50
50
"devDependencies" : {
51
51
"@testing-library/dom" : " ^10.0.0" ,
52
52
"@testing-library/jest-dom" : " ^5.11.6" ,
53
- "@types/react-dom " : " ^18.2.25 " ,
53
+ "@types/react" : " ^18.3.1 " ,
54
54
"chalk" : " ^4.1.2" ,
55
55
"dotenv-cli" : " ^4.0.0" ,
56
56
"jest-diff" : " ^29.7.0" ,
57
57
"kcd-scripts" : " ^13.0.0" ,
58
58
"npm-run-all" : " ^4.1.5" ,
59
- "react" : " ^18.3.0 " ,
59
+ "react" : " ^18.3.1 " ,
60
60
"react-dom" : " ^18.3.0" ,
61
61
"rimraf" : " ^3.0.2" ,
62
62
"typescript" : " ^4.1.2"
63
63
},
64
64
"peerDependencies" : {
65
65
"@testing-library/dom" : " ^10.0.0" ,
66
66
"@types/react-dom" : " ^18.0.0" ,
67
+ "@types/react" : " ^18.0.0" ,
67
68
"react" : " ^18.0.0" ,
68
69
"react-dom" : " ^18.0.0"
69
70
},
70
71
"peerDependenciesMeta" : {
72
+ "@types/react" : {
73
+ "optional" : true
74
+ },
71
75
"@types/react-dom" : {
72
76
"optional" : true
73
77
}
Original file line number Diff line number Diff line change 7
7
prettyFormat ,
8
8
Config as ConfigDTL ,
9
9
} from '@testing-library/dom'
10
- import { act as reactAct } from 'react-dom/test-utils'
10
+ import { act as reactDeprecatedAct } from 'react-dom/test-utils'
11
+ //@ts -ignore
12
+ import { act as reactAct } from 'react'
11
13
12
14
export * from '@testing-library/dom'
13
15
@@ -245,10 +247,11 @@ export function renderHook<
245
247
export function cleanup ( ) : void
246
248
247
249
/**
248
- * Simply calls ReactDOMTestUtils .act(cb)
250
+ * Simply calls React .act(cb)
249
251
* If that's not available (older version of react) then it
250
- * simply calls the given callback immediately
252
+ * simply calls the deprecated version which is ReactTestUtils.act(cb)
251
253
*/
252
- export const act : typeof reactAct extends undefined
253
- ? ( callback : ( ) => void ) => void
254
+ // IfAny<typeof reactAct, reactDeprecatedAct, reactAct> from https://stackoverflow.com/a/61626123/3406963
255
+ export const act : 0 extends 1 & typeof reactAct
256
+ ? typeof reactDeprecatedAct
254
257
: typeof reactAct
You can’t perform that action at this time.
0 commit comments