Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress command typing is inelegant #10

Open
2 tasks
eric-burel opened this issue Jun 4, 2020 · 0 comments
Open
2 tasks

Cypress command typing is inelegant #10

eric-burel opened this issue Jun 4, 2020 · 0 comments
Labels

Comments

@eric-burel
Copy link
Collaborator

eric-burel commented Jun 4, 2020

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant