Skip to content

Commit

Permalink
fix(types): make parameters non-nullable for Playwright options (#6989)
Browse files Browse the repository at this point in the history
  • Loading branch information
apple-yagi authored Dec 1, 2024
1 parent 721a5b8 commit fe2a187
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions packages/browser/providers/playwright.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ declare module 'vitest/node' {
}
}

type PWHoverOptions = Parameters<Page['hover']>[1]
type PWClickOptions = Parameters<Page['click']>[1]
type PWDoubleClickOptions = Parameters<Page['dblclick']>[1]
type PWFillOptions = Parameters<Page['fill']>[2]
type PWScreenshotOptions = Parameters<Page['screenshot']>[0]
type PWSelectOptions = Parameters<Page['selectOption']>[2]
type PWDragAndDropOptions = Parameters<Page['dragAndDrop']>[2]
type PWHoverOptions = NonNullable<Parameters<Page['hover']>[1]>
type PWClickOptions = NonNullable<Parameters<Page['click']>[1]>
type PWDoubleClickOptions = NonNullable<Parameters<Page['dblclick']>[1]>
type PWFillOptions = NonNullable<Parameters<Page['fill']>[2]>
type PWScreenshotOptions = NonNullable<Parameters<Page['screenshot']>[0]>
type PWSelectOptions = NonNullable<Parameters<Page['selectOption']>[2]>
type PWDragAndDropOptions = NonNullable<Parameters<Page['dragAndDrop']>[2]>

declare module '@vitest/browser/context' {
export interface UserEventHoverOptions extends PWHoverOptions {}
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/node/commands/hover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
else {
throw new TypeError(`Provider "${context.provider.name}" does not support hover`)
Expand Down

0 comments on commit fe2a187

Please sign in to comment.