Cypress · Middle · Question 19 of 77
How do you add TypeScript types for a custom command cy.login?
- 1Declare it in the
Cypress.Chainableinterface - 2Add it to
tsconfig.jsonundercommands - 3Types for custom commands are generated automatically
Show the answer
Correct answer: Declare it in the Cypress.Chainable interface
Explanation
Extending namespace Cypress { interface Chainable { login(...): Chainable<void> } } gives autocompletion and type checks.