Skip to content

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

Open
@true2fik

Description

@true2fik

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    prevent-stalemark an issue so it is ignored by stale[bot]type: typingsIssue related to Cypress types (for TypeScript)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions