add-cypress-custom-command-in-typescript icon indicating copy to clipboard operation
add-cypress-custom-command-in-typescript copied to clipboard

How can i type a command with custom Chainable class

Open kingfolk opened this issue 6 years ago • 1 comments

Desire the following to work, but seems commands.ts is not a regular ts module file.

login: (options?: Object) => Chainable<LoginContext>;

kingfolk avatar May 14 '18 03:05 kingfolk

Just add export {} at the top of the files to force it to be considered a valid module :

export {};
declare global {
  namespace Cypress {
    interface Chainable {
      login: () => void;
    }
  }
}
Cypress.Commands.add('login', () => {});

PCreations avatar May 27 '19 13:05 PCreations