Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return type of unmount function #856

Closed
sanchit121 opened this issue Jan 7, 2021 · 2 comments · Fixed by #857
Closed

Return type of unmount function #856

sanchit121 opened this issue Jan 7, 2021 · 2 comments · Fixed by #857

Comments

@sanchit121
Copy link
Contributor

  • @testing-library/react version: 11.2.2
  • Testing Framework and version: Jest 26.6.3
  • DOM Environment: jsdom

Relevant code or config:

export type RenderResult<Q extends Queries = typeof queries> = {
  container: Element
  baseElement: Element
  debug: (
    baseElement?:
      | Element
      | DocumentFragment
      | Array<Element | DocumentFragment>,
    maxLength?: number,
    options?: prettyFormat.OptionsReceived,
  ) => void
  rerender: (ui: React.ReactElement) => void
  unmount: () => boolean
  asFragment: () => DocumentFragment
} & {[P in keyof Q]: BoundFunction<Q[P]>}

What you did:

Trying to use unmount()

Problem description:

wrapper.unmount() returns undefined, whereas the type shows it returns boolean
...\node_modules@testing-library\react\types\index.d.ts

Suggested solution:

We can update the type definition file.

@sanchit121
Copy link
Contributor Author

Here is pull request #857

@eps1lon eps1lon linked a pull request Jan 7, 2021 that will close this issue
4 tasks
@eps1lon
Copy link
Member

eps1lon commented Jan 7, 2021

Closed in #857

@eps1lon eps1lon closed this as completed Jan 7, 2021
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 a pull request may close this issue.

2 participants