Skip to content

Cypress.Chainable incorectly wrapping any as JQuery<any> in typedef #16669

@MCFreddie777

Description

@MCFreddie777

Current behavior

When returning any from cypress chainable both following methods return types are Cypress.Chainable<JQuery<any>> which is incorrect.

 foo() {
        return cy.get('body').then((_) => {
            return {} as any;
        });
    }

 foo() {
        return cy.request('/').then(response => {
            return response.body.bar;
        });
    }

image

Desired behavior

Tested on Cypress 6.9.1, it correctly return Cypress.Chainable<any>.

image

Versions

Tested on 6.9.1 - working as expected, 7.3.0, 7.4.0 - incorrect types

Metadata

Metadata

Assignees

Labels

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