Skip to content

Cypress command typing is inelegant #10

Open
@eric-burel

Description

@eric-burel

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions