Skip to content

Commit

Permalink
Add CustomCommandInstance interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
garg3133 committed Nov 25, 2024
1 parent 11a058e commit ed897cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions types/custom-command.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import {CommandInstance} from './index';

export interface CustomCommandInstance extends CommandInstance {}

export interface NightwatchCustomCommandsModel {
/**
* Define a custom command
Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ export interface CommandInstance {
httpRequest(options: HttpRequestOptions): Promise<unknown>;

toString(): string;
complete(...args: unknown[]): void; // test the args are working fine.
complete(...args: unknown[]): void;
}

export interface CreateClientParams {
Expand Down
4 changes: 2 additions & 2 deletions types/tests/customCommands.test-d.ts
Original file line number Diff line number Diff line change
@@ -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<T>(r: T) {return r}) {
async command(this: CustomCommandInstance, listName: string, cb = function<T>(r: T) {return r}) {
// Script to be executed in the browser
const script = function(listName: string) {
// executed in the browser context
Expand Down

0 comments on commit ed897cc

Please sign in to comment.