From d262e059d3499fa26ead5d6dff0c2519d573e809 Mon Sep 17 00:00:00 2001 From: Tony Spataro Date: Sun, 5 Jan 2025 12:22:32 -0800 Subject: [PATCH] fix: Add Locator typings for nth, first and last. (#7176) --- packages/browser/context.d.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/browser/context.d.ts b/packages/browser/context.d.ts index caf80089a7ba..64cd0b4afc0d 100644 --- a/packages/browser/context.d.ts +++ b/packages/browser/context.d.ts @@ -435,6 +435,21 @@ export interface Locator extends LocatorSelectors { * @see {@link https://vitest.dev/guide/browser/locators#all} */ all(): Locator[] + /** + * Returns a locator for the nth element matching the selector. + * @see {@link https://vitest.dev/guide/browser/locators#nth} + */ + nth(index: number): Locator + /** + * Returns a locator for the first element matching the selector. + * @see {@link https://vitest.dev/guide/browser/locators#first} + */ + first(): Locator + /** + * Returns a locator for the last element matching the selector. + * @see {@link https://vitest.dev/guide/browser/locators#last} + */ + last(): Locator } export interface UserEventTabOptions {