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 userEvent.type not always a promise #527

Closed
frontendphil opened this issue Dec 21, 2020 · 1 comment
Closed

Return type of userEvent.type not always a promise #527

frontendphil opened this issue Dec 21, 2020 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@frontendphil
Copy link

As stated in the docs userEvent.type always returns a promise but you only need to await it if you're using the delay option. Is it sensible to still change the typescript type to always be Promise in this case? I'm asking because I'm working in a vue app and even though I don't use the delay option I actually need to await the result because vue will not have applied the changes otherwise. However, when I put await in front of userEvent.type I get a warning that await won't have an effect here (even though it does).

Is that too vue specific or something that you'd be willing to change when I submit a PR?

@nickserv
Copy link
Member

nickserv commented Dec 21, 2020

Unfortunately solving this issue for just Vue in isolation would be tricky, as there's no way to tell TypeScript/ESLint/etc that a User Event function is async when used with Vue but not otherwise.

While this is a valid issue the solution would already be covered by #504 so I'll close it as a duplicate.

@nickserv nickserv added the duplicate This issue or pull request already exists label Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants