cypress-io / cypress-documentation

Cypress Documentation for the Cypress App, API, Cypress Cloud, UI Coverage and Cypress Accessibility.
https://docs.cypress.io
MIT License
949 stars 1.05k forks source link

Example `dataCy` TypeScript declaration not in sync with `get` type #3027

Closed IlCallo closed 6 months ago

IlCallo commented 4 years ago

Current behavior:

Into TypeScript declaration docs: https://docs.cypress.io/guides/tooling/typescript-support.html#Types-for-custom-commands

The signature should match the one from get, so it should be

declare namespace Cypress {
  interface Chainable {
    /**
     * Custom command to select DOM element by data-cy attribute.
     * @example cy.dataCy('greeting')
     */
    dataCy<E extends Node = HTMLElement>(value: string): Chainable<JQuery<E>>;
  }
}

instead of

declare namespace Cypress {
  interface Chainable {
    /**
     * Custom command to select DOM element by data-cy attribute.
     * @example cy.dataCy('greeting')
    */
    dataCy(value: string): Chainable<Element>
  }
}
jennifer-shehane commented 4 years ago

Yeah, we probably updated this type since that doc was made. I'm going to move this issue to our docs, since this repo is used exclusively for features/bugs in the Cypress product itself.

IlCallo commented 4 years ago

Oh, sorry, didn't noticed the docs had a different repo