-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix(types): make parameters non-nullable for Playwright options #6989
fix(types): make parameters non-nullable for Playwright options #6989
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -16,7 +16,7 @@ export const hover: UserEventCommand<UserEvent['hover']> = async ( | |||
} | |||
else if (context.provider instanceof WebdriverBrowserProvider) { | |||
const browser = context.browser | |||
await browser.$(selector).moveTo(options) | |||
await browser.$(selector).moveTo(options as any) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ref:
await browser.$(selector).click(options as any) |
Thanks for the PR 👋 The fix seems right but can you provide a reproduction to better understand the issue? For me locally, I get an error like this in this reproduction https://github.com/hi-ogawa/reproductions/tree/main/vitest-browser-playwright-types, but the error somehow went away and I get a correct completion once I added a proper |
@hi-ogawa Thank you for your reply! I have a question: what are the settings of the tsconfig.json you added? I suspect that the noUncheckedIndexedAccess option might be the cause. |
Oh, that's a good point. I didn't even have I'm adding dts test in #6995 with |
Description
Currently, when selecting Playwright as the provider, type completion for the options parameter of the click method from @vitest/browser/context's userEvent is not working. This is because when fetching the types for Playwright's options, the possibility of undefined is not eliminated, resulting in a missing interface type. Therefore, I have wrapped it with NonNullable to remove the potential for undefined, which fixes the issue so that type completion now works.
before
after
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.