-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
good first issueGood for newcomersGood for newcomerstype: typingsIssue related to Cypress types (for TypeScript)Issue related to Cypress types (for TypeScript)
Description
Current behavior
The cy.document function has the wrong typings for typescript.
In the docs it specifies timeout as a valid property, however it only has the log option specified.
https://docs.cypress.io/api/commands/document#Usage
Desired behavior
The type file should specify it to be timeoutable:
/**
* Get the window.document of the page that is currently active.
*
* @see https://on.cypress.io/document
* @example
* cy.document()
* .its('contentType')
* .should('eq', 'text/html')
*/
document(options?: Partial<Loggable & Timeoutable): Chainable<Document>
Test code to reproduce
describe('a test', () => {
it('should have the right typing', () => {
// The below should not throw a type error
cy.document({ timeout: 5000 }).should('exist');
});
});
Cypress Version
8.0.0
Other
Temporary workaround:
Create the following file: ./src/@types/cypress.d.ts
With the content:
declare namespace Cypress {
interface Chainable {
document(options?: Partial<Loggable & Timeoutable>): Chainable<Document>
}
}
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomerstype: typingsIssue related to Cypress types (for TypeScript)Issue related to Cypress types (for TypeScript)
