From 50a60790c074d739068d815d5f7632e6c901bb67 Mon Sep 17 00:00:00 2001 From: Raul Macarie Date: Tue, 21 Jul 2026 15:51:47 +0200 Subject: [PATCH] chore: types --- .../browser-playwright/src/commands/pointer.ts | 15 +++++++++++++-- packages/browser-playwright/src/commands/utils.ts | 1 - 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/browser-playwright/src/commands/pointer.ts b/packages/browser-playwright/src/commands/pointer.ts index 9978f654f..4eabce266 100644 --- a/packages/browser-playwright/src/commands/pointer.ts +++ b/packages/browser-playwright/src/commands/pointer.ts @@ -1,10 +1,21 @@ -import type { UserEvent } from 'vitest/browser' +import type { SerializedLocator } from '@vitest/browser' +import type { Locator, UserEventPointerOptions } from 'vitest/browser' import type { UserEventCommand } from './utils' import { parseKeyDef } from '@vitest/browser' import { click } from './click' import { hover } from './hover' -export const pointer: UserEventCommand = async ( +type PointerEvent = ( + options: readonly ElementToSerializedLocator[], +) => Promise + +type ElementToSerializedLocator = T extends Element | Locator + ? SerializedLocator + : { + [K in keyof T]: ElementToSerializedLocator + } + +export const pointer: UserEventCommand = async ( context, options, ) => { diff --git a/packages/browser-playwright/src/commands/utils.ts b/packages/browser-playwright/src/commands/utils.ts index b2408fc97..1616fb840 100644 --- a/packages/browser-playwright/src/commands/utils.ts +++ b/packages/browser-playwright/src/commands/utils.ts @@ -7,7 +7,6 @@ export type UserEventCommand any> = BrowserCommand< > type ConvertElementToLocator = T extends Element | Locator ? SerializedLocator : T -// @todo: check if this could take care of nested locators (e.g., `{ target: Locator }[]`) type ConvertUserEventParameters = { [K in keyof T]: ConvertElementToLocator; } -- 2.51.2