-
Notifications
You must be signed in to change notification settings - Fork 276
Closed
Description
Describe the bug
The following code returns a typescript error
import { renderHook } from '@testing-library/react-native'
import { useMyHook } from '../hooks'
describe('useMyHook', () => {
it('should pass', () => {
const { result, rerender } = renderHook((num: number) => useMyHook(num), { initialProps: undefined })
expect(result.current).toBeUndefined()
rerender('granted') //Error here, props type is undefined
expect(result.current).toBe('granted')
})
})
For it to work fine I have to to do
const { result, rerender } = renderHook<number, number>((num: number) => useMyHook(num), { initialProps: undefined })
this doesn't happen when using
import { renderHook } from '@testing-library/react-hooks'
Expected behavior
Not having a typescript error and instead pull the prop types correctly.
Steps to Reproduce
See description.
Screenshots


Versions
npmPackages:
@testing-library/react-native: 12.1.2 => 12.1.2
react: 18.1.0 => 18.1.0
react-native: 0.70.9 => 0.70.9
react-test-renderer: 18.1.0 => 18.1.0
Metadata
Metadata
Assignees
Labels
No labels