Skip to content

Trying to set the timeout for a custom query results in a typescript error #30198

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

Open
true2fik opened this issue Sep 6, 2024 · 4 comments · May be fixed by #31636
Open

Trying to set the timeout for a custom query results in a typescript error #30198

true2fik opened this issue Sep 6, 2024 · 4 comments · May be fixed by #31636
Labels
prevent-stale mark an issue so it is ignored by stale[bot] type: typings Issue related to Cypress types (for TypeScript)

Comments

@true2fik
Copy link

true2fik commented Sep 6, 2024

Current behavior

Calling this.set('timeout', options?.timeout) results in the following error: Argument of type '"timeout"' is not assignable to parameter of type 'keyof EnqueuedCommandAttributes'. [2345]

Desired behavior

Typescript type definition should be updated to add a "timeout" attribute to the EnqueuedCommandAttributes interface

Test code to reproduce

Cypress.Commands.addQuery('getFoo', function getFoo(selector, options) {
  let log: Cypress.Log | undefined;
  if (options?.log !== false) {
    log = Cypress.log({ timeout: options?.timeout });
  }

  this.set('timeout', options?.timeout); // This line

  return (): JQuery => {
    // TODO: inner function
  };
});

Cypress Version

13.13.3

Node version

v20.17.0

Operating System

Ubuntu 22.04

Debug Logs

No response

Other

No response

@jennifer-shehane jennifer-shehane added the type: typings Issue related to Cypress types (for TypeScript) label Sep 6, 2024
@TobiasHH
Copy link

TobiasHH commented Oct 22, 2024

I wanted to use the Cypress.Commands.addQuery in the cypress-mailpit plugin from https://github.com/pushpak1300/cypress-mailpit which is written in TypeScript resulting in the error described above. The project is written in Typescript.

@cypress-app-bot
Copy link
Collaborator

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.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Apr 21, 2025
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale May 5, 2025
@true2fik true2fik linked a pull request May 5, 2025 that will close this issue
3 tasks
@true2fik
Copy link
Author

true2fik commented May 5, 2025

As of 14.3.2, this still persists. I created a PR for it.

@cypress-app-bot cypress-app-bot removed the stale no activity on this issue for a long period label May 6, 2025
@jennifer-shehane jennifer-shehane added the prevent-stale mark an issue so it is ignored by stale[bot] label May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prevent-stale mark an issue so it is ignored by stale[bot] type: typings Issue related to Cypress types (for TypeScript)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants