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

TypeScript definitions missing waitFor #486

Closed
NiGhTTraX opened this issue Mar 14, 2020 · 3 comments
Closed

TypeScript definitions missing waitFor #486

NiGhTTraX opened this issue Mar 14, 2020 · 3 comments

Comments

@NiGhTTraX
Copy link

  • dom-testing-library version: 10
  • node version: 12.16.0
  • yarn version: 1.22

Relevant code or config

import { waitFor } from '@testing-library/dom';

What happened:

TS2305: Module '"../../../node_modules/@types/testing-library__dom"'
has no exported member 'waitFor'.

Problem description: saw the deprecation warnings after upgrading to latest version, tried to take the action suggested in the message, ran into this problem.

Suggested solution: add the type in testing_library__dom?

@eps1lon
Copy link
Member

eps1lon commented Mar 14, 2020

Already in the pipeline over at @types/: DefinitelyTyped/DefinitelyTyped#43102

@NiGhTTraX
Copy link
Author

Thanks!

@davidgilbertson
Copy link

While you're waiting, you can drop this into your own project to extend the existing definitions.

declare module '@testing-library/dom' {
  export function waitFor(
    callback: () => void,
    options?: {
      container?: HTMLElement;
      timeout?: number;
      interval?: number;
      mutationObserverOptions?: MutationObserverInit;
    },
  ): Promise<void>;
}

Definition copy/pasted from @abraham's PR linked above.

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

No branches or pull requests

3 participants