Skip to content

waitForElementToBeRemoved is not expecting params on TS #490

Closed
@MuraraAllan

Description

@MuraraAllan
  • DOM Testing Library version:
  • node version:
  • npm (or yarn) version:

Relevant code or config:

  queryByPlaceholderText,
  getAllByPlaceholderText,
  getByPlaceholderText,
  findAllByPlaceholderText,
  findByPlaceholderText,
] = buildQueries(queryAllByPlaceholderText, getMultipleError, getMissingError)
looks like this abstraction is confusing TS, not sure although
await waitForElementToBeRemoved(getByPlaceholderText(t('auth.signin.fields.email.placeholder')) as any)

What you did:

I'm using typescript and testing-library, when trying to wait for an HTML Element to be removed, I need to pass hard-coded ```any`` type to the element, otherwise Typescript is gonna validate an invalid argument for the function.

What happened:

Argument of type 'HTMLElement' is not assignable to parameter of type '() => unknown'.
Type 'HTMLElement' provides no match for the signature '(): unknown'.ts(2345)

Reproduction:

Problem description:

Suggested solution:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions