react-native-testing-library icon indicating copy to clipboard operation
react-native-testing-library copied to clipboard

Export options types and `renderHook` result type

Open evanwalsh opened this issue 3 years ago • 0 comments

Summary

While writing helpers around the render and renderHook functions, I found myself wanting/needing the types for the options and the returns. This explicitly exports those types that weren't already exposed to avoid having to do something like the following:

type RenderOptions = Parameters<typeof render>[1]
type RenderHookOptions = Parameters<typeof renderHook>[1]

// Copied/pasted from @testing-library/react-native
interface RenderHookResult<Result, Props> {
  result: {current: Result}
  rerender: (props: Props) => void
  unmount: () => void
}

These types are already documented, so this just fully exposes types that are already meant for users.

Test plan

I'm not sure what additional tests would be needed for this. As long as type checking succeeds, these changes should be good.

evanwalsh avatar Aug 03 '22 15:08 evanwalsh