question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cypress.dom.isDetached missing from Typescript types

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
kylerobcommented, Oct 3, 2019

@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.

1reaction
rovshenncommented, Feb 28, 2020

@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

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript - Cypress Documentation
Cypress ships with official type declarations for TypeScript. This allows you to write your tests in TypeScript. Install TypeScript To use TypeScript.
Read more >
Solving The Element Is Detached From DOM Error In Cypress
A video of a page refreshing and breaking a Cypress test and several possible solutions. Many people complain about the dreaded "Element is...
Read more >
Why is Cypress saying my element is detached after just ...
The previous command that ran was: > cy.eq() This DOM element likely became detached somewhere between the previous and current command.
Read more >
cy.type() failed because this element is detached from the dom - You ...
I am new to Cypress and as far as I understand, I need to use cy.wrap() in this situation, in order to be...
Read more >
cypress-io/cypress - Gitter
@jradom check for the slow loading elements to be visible? jradom ... cypress/plugins/index.js , but either the file is missing, it contains a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found