-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Unable to overwrite command with TS overloads #19564
Comments
I just ran into this today as well, had to simply
|
@jaroslav-kubicek, thanks for logging the issue and providing the reproducible example. Based on your provided code i was able to reproduce this issue locally. |
Same in my case, but for adding a custom (dual) command with multiple definitions, not for overwriting an existing one - error and details copied below. I also added a Great features added in version(s) 9.x, but too many issues and breaking changes that were not considered or not documented; looking forward for a reliable release 🙂
|
Do we have any updates on this? I am using the version |
One workaround for this that we used until the Cypress devs release a fix was simply swapping the
It's janky, but at least we still get type assertions. Does anyone know what the canonical way to resolve something like this in Typescript? It seems like it's probably not solvable using the string literal generic mechanism for Edit: Looks like it goes back to this question: microsoft/TypeScript#47540 |
This one helped me to fix TS2554: Expected 1 arguments, but got 2. |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
This issue has been closed due to inactivity. |
…and yet, the issue persists and is still present in Cypress 13.7.3. The auto-generated support/commands.ts has this example // -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... }) but if I add this to the file: Cypress.Commands.add('login', (email, password) => { return true }) I get
Surely if Cypress is auto-generating a .ts file, the examples it gives should have valid types? |
Still a problem in 13.10.0: It's a cleaned up copy/paste from the Cypress documentation: https://docs.cypress.io/api/cypress-api/custom-commands#Overwrite-visit-command |
Some e2e Cypress tests were failing due to the Vercel live feedback toolbar covering interactive elements, preventing test actions from completing: https://github.com/Unleash/unleash/actions/runs/11048512034/job/30692949711#step:4:136 This PR addresses the issue by disabling the Vercel toolbar specifically during Cypress tests. This is done by setting the `x-vercel-skip-toolbar` header, which Vercel provides to prevent the toolbar from interfering with automated tests. You can find more information about this feature in the Vercel documentation: [Disable Toolbar for Automation](https://vercel.com/docs/workflow-collaboration/vercel-toolbar/managing-toolbar#disable-toolbar-for-automation). Specific type declarations were needed due to cypress-io/cypress#19564
Just a little "push" from my side: still a problem in version |
Current behavior
Given I override
visit
command as below:I'm unable to type this:
... as
cy.visit
is defined with two type overloads, but only the latter one is taken into account:Desired behavior
I'm able to override
visit
command and usevisit(url: string, options?: Partial<VisitOptions>): Chainable<AUTWindow>
variant.Test code to reproduce
Cypress Version
9.2.0
Other
No response
The text was updated successfully, but these errors were encountered: