Skip to content

Commit f588b71

Browse files
authored
fix: Add "this" type to relevant signatures (#96)
1 parent 63696d5 commit f588b71

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/index.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ declare namespace Cypress {
2121
* cy.get('#close').if('visible').click()
2222
* cy.wrap(1).if('equal', 1).should('equal', 1)
2323
*/
24-
if(assertion?: string, value?: any): Chainable<Subject>
24+
if(this: Chainable<Subject>, assertion?: string, value?: any): Chainable<Subject>
2525

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

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

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

6363
/**
6464
* Finishes if/else commands and continues
@@ -70,7 +70,7 @@ declare namespace Cypress {
7070
* .else().log('already checked')
7171
* .finally().should('be.checked')
7272
*/
73-
finally(): Chainable<Subject>
73+
finally(this: Chainable<Subject>): Chainable<Subject>
7474

7575
/**
7676
* A simple way to throw an error

0 commit comments

Comments
 (0)