From ed897cc7d44a878423ff69da14be73eb3fdbf77c Mon Sep 17 00:00:00 2001 From: Priyansh Garg Date: Tue, 26 Nov 2024 00:28:50 +0530 Subject: [PATCH] Add `CustomCommandInstance` interface. --- types/custom-command.d.ts | 4 ++++ types/index.d.ts | 2 +- types/tests/customCommands.test-d.ts | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/types/custom-command.d.ts b/types/custom-command.d.ts index 4a03b4905..b36e14f60 100644 --- a/types/custom-command.d.ts +++ b/types/custom-command.d.ts @@ -1,3 +1,7 @@ +import {CommandInstance} from './index'; + +export interface CustomCommandInstance extends CommandInstance {} + export interface NightwatchCustomCommandsModel { /** * Define a custom command diff --git a/types/index.d.ts b/types/index.d.ts index b5addc082..ae6509297 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1221,7 +1221,7 @@ export interface CommandInstance { httpRequest(options: HttpRequestOptions): Promise; toString(): string; - complete(...args: unknown[]): void; // test the args are working fine. + complete(...args: unknown[]): void; } export interface CreateClientParams { diff --git a/types/tests/customCommands.test-d.ts b/types/tests/customCommands.test-d.ts index efc2bec5a..670938479 100644 --- a/types/tests/customCommands.test-d.ts +++ b/types/tests/customCommands.test-d.ts @@ -1,8 +1,8 @@ import {expectType} from 'tsd'; -import {CommandInstance, NightwatchCallbackResult, NightwatchCustomCommandsModel} from '..'; +import {CustomCommandInstance, NightwatchCallbackResult, NightwatchCustomCommandsModel} from '..'; export class AngularCommand implements NightwatchCustomCommandsModel { - async command(this: CommandInstance, listName: string, cb = function(r: T) {return r}) { + async command(this: CustomCommandInstance, listName: string, cb = function(r: T) {return r}) { // Script to be executed in the browser const script = function(listName: string) { // executed in the browser context