add-cypress-custom-command-in-typescript
add-cypress-custom-command-in-typescript copied to clipboard
How can i type a command with custom Chainable class
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', () => {});