cypress-io / add-cypress-custom-command-in-typescript

Testing how new Cypress commands are added in TypeScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can i type a command with custom Chainable class

kingfolk opened this issue · comments

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

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

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', () => {});