Skip to content

Commit

Permalink
fix: Add "this" type to relevant signatures (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
steinybot authored Jun 26, 2024
1 parent 63696d5 commit f588b71
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ declare namespace Cypress {
* cy.get('#close').if('visible').click()
* cy.wrap(1).if('equal', 1).should('equal', 1)
*/
if(assertion?: string, value?: any): Chainable<Subject>
if(this: Chainable<Subject>, assertion?: string, value?: any): Chainable<Subject>

/**
* Child `.if()` command to start an optional chain
Expand All @@ -30,7 +30,7 @@ declare namespace Cypress {
* @example
* cy.wrap(1).if(n => n % 2 === 0)...
*/
if(callback: PredicateFn): Chainable<Subject>
if(this: Chainable<Subject>, callback: PredicateFn): Chainable<Subject>

/**
* Child `.if()` command to start an optional chain
Expand All @@ -39,7 +39,7 @@ declare namespace Cypress {
* @example
* cy.wrap(1).if(n => expect(n).to.equal(1))...
*/
if(callback: AssertionFn): Chainable<Subject>
if(this: Chainable<Subject>, callback: AssertionFn): Chainable<Subject>

/**
* Creates new chain of commands that only
Expand All @@ -58,7 +58,7 @@ declare namespace Cypress {
* .if('not.visible').log('Not visible')
* .else('visible')
*/
else(message?: any): Chainable<Subject>
else(this: Chainable<Subject>, message?: any): Chainable<Subject>

/**
* Finishes if/else commands and continues
Expand All @@ -70,7 +70,7 @@ declare namespace Cypress {
* .else().log('already checked')
* .finally().should('be.checked')
*/
finally(): Chainable<Subject>
finally(this: Chainable<Subject>): Chainable<Subject>

/**
* A simple way to throw an error
Expand Down

0 comments on commit f588b71

Please sign in to comment.