vulcan-next icon indicating copy to clipboard operation
vulcan-next copied to clipboard

Cypress command typing is inelegant

Open eric-burel opened this issue 5 years ago • 0 comments

We need to manually add command typings to cypress/support/index.d.ts, command per command. This is of course inelegant.

Ideally, Cypress commands should export their own typing, and export it in a single interface.

It could look like this:

// cypress/support/myCustomCommands.ts
// ... my commands here

export interface MyCustomCommands {
     someCommand(param: string): Chainable<Element>
}
// cypress/support/index.d.ts
import { MyCustomCommands } from "./myCustomCommands"
declare namespace Cypress {
  interface Chainable extends MyCustomCommands {
  }
}

The problem is that I've never managed to import the Chainable type in my custom command file. I am not able to extend the "Cypress" namespace directly from the interface either.

Relevant doc: https://docs.cypress.io/guides/tooling/typescript-support.html#Types-for-custom-commands

Steps to solve

  • [ ] Check example with Cypress recently merged in Next examples folder (a new example has been added in oct 2020)
  • [ ] Improve Vulcan Next accordingly

eric-burel avatar Jun 04 '20 13:06 eric-burel