Skip to content

Conversation

mdjastrzebski
Copy link
Member

Resubmitting #1034 as almost done but have to write access to forked PR-repo and OP @evanwalsh is not responsive.

Original description below:

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.

@mdjastrzebski mdjastrzebski force-pushed the feature/export-render-types branch from 223746e to 3c652c7 Compare September 2, 2022 11:14
@mdjastrzebski mdjastrzebski merged commit 2c096ff into main Sep 6, 2022
@mdjastrzebski mdjastrzebski deleted the feature/export-render-types branch September 6, 2022 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants