Cypress: Cypress.dom.isDetached missing from Typescript types

Created on 7 Jun 2019  路  5Comments  路  Source: cypress-io/cypress

Current behavior:

The method Cypress.dom.isDetached() type errors in Typescript projects.

Desired behavior:

The method Cypress.dom.isDetached() does not type error in Typescript projects.

Steps to reproduce: (app code and test code)

  1. Set up a Typescript Cypress project as described in https://docs.cypress.io/guides/tooling/typescript-support.html
  2. Write the following test:
describe('Demonstrates bug', function() {
  beforeEach(() => {
    cy.setup();
  });

  it('demonstrates Typescript error'), function() {
    cy.get('button').then(($el) => {
      Cypress.dom.isDetached($el)
    });
  });
});
  1. Get the following error:
Property 'isDetached' does not exist on type '{ isHidden(element: HTMLElement | JQuery<HTMLElement>): boolean; }'

Versions

Cypress 3.2.0
Typescript 3.4.5
Chrome 74.0.3729.169
macOS 10.14.5

1锔忊儯 first-timers-only typescript

Most helpful comment

@jennifer-shehane Do you mind if I pick this up? Also should we add all of the dom functions to the declaration file? It looks like there are a good deal more in dom/index.js that could be added.

All 5 comments

@jennifer-shehane Do you mind if I pick this up? Also should we add all of the dom functions to the declaration file? It looks like there are a good deal more in dom/index.js that could be added.

@kylerob Go for it.

@jennifer-shehane or @kylerob any progress on this? I have

"cypress": "^4.0.2",
"@types/node": "^10.12.18",
"typescript": "~3.7.2",
node -v 12.16.1

and I am still seeing this issue

The code for this is done in cypress-io/cypress#5298, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

Released in 4.2.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v4.2.0, please open a new issue.

Was this page helpful?
0 / 5 - 0 ratings