Skip to content

Commit b2478e8

Browse files
committed
Add test case for the case hook returns void
1 parent 2bdb78a commit b2478e8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Diff for: test/typescript/renderHook.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useState, useCallback } from 'react'
1+
import { useState, useCallback, useEffect } from 'react'
22
import { renderHook } from 'react-hooks-testing-library'
33

44
const useCounter = (initialCount: number = 0) => {
@@ -53,3 +53,14 @@ function checkTypesWithInitialProps() {
5353
const _unmount: () => boolean = unmount
5454
const _rerender: (_?: { count: number }) => void = rerender
5555
}
56+
57+
function checkTypesWhenHookReturnsVoid() {
58+
const { result, unmount, rerender } = renderHook(() => useEffect(() => {}))
59+
60+
// check types
61+
const _result: {
62+
current: void
63+
} = result
64+
const _unmount: () => boolean = unmount
65+
const _rerender: () => void = rerender
66+
}

0 commit comments

Comments
 (0)