Skip to content

Commit a72a1a5

Browse files
committed
Updated typings with nextUpdate
1 parent 9fb2dbf commit a72a1a5

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

test/typescript/renderHook.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,12 @@ function checkTypesWhenHookReturnsVoid() {
6464
const _unmount: () => boolean = unmount
6565
const _rerender: () => void = rerender
6666
}
67+
68+
async function checkTypesForNextUpdate() {
69+
const { nextUpdate } = renderHook(() => {})
70+
71+
await nextUpdate()
72+
73+
// check type
74+
const _nextUpdate: () => Promise<void> = nextUpdate
75+
}

typings/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export function renderHook<P, R>(
99
readonly result: {
1010
current: R
1111
}
12+
readonly nextUpdate: () => Promise<void>
1213
readonly unmount: RenderResult['unmount']
1314
readonly rerender: (hookProps?: P) => void
1415
}

0 commit comments

Comments
 (0)