Dom-testing-library: TypeScript definitions missing waitFor

Created on 14 Mar 2020  路  3Comments  路  Source: testing-library/dom-testing-library

  • 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?

Most helpful comment

Already in the pipeline over at @types/: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/43102

All 3 comments

Already in the pipeline over at @types/: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/43102

Thanks!

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dlbnco picture dlbnco  路  3Comments

ruscal picture ruscal  路  3Comments

nicolasschabram picture nicolasschabram  路  3Comments

szabototo89 picture szabototo89  路  4Comments

PaulInglis picture PaulInglis  路  3Comments