Skip to content

Commit

Permalink
fix: πŸ› Fix the TypeScript signature
Browse files Browse the repository at this point in the history
βœ… Closes: #134
  • Loading branch information
NoriSte committed May 13, 2020
1 parent ce796ce commit 126fea6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions cypress/types/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,8 @@ cy.waitUntil<boolean>(() => true, {
})
cy.waitUntil<boolean>(() => true, { log: false })
cy.waitUntil<boolean>(() => true, { customMessage: 'custom message' })

cy.wrap('').waitUntil((subject) => subject.length)
cy.wrap('').waitUntil<boolean>((subject) => !!subject.length)
cy.wrap<string>('').waitUntil<boolean>((subject) => !!subject.length)
cy.wrap<string>('').waitUntil((subject) => subject.length)
6 changes: 4 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ interface WaitUntilOptions<Subject = any> {

declare namespace Cypress {
interface Chainable<Subject = any> {
waitUntil<Subject>(
checkFunction: () => Subject | Chainable<Subject> | Promise<Subject>,
waitUntil<ReturnType = any>(
checkFunction: (
subject: Subject | undefined
) => ReturnType | Chainable<ReturnType> | Promise<ReturnType>,
options?: WaitUntilOptions<Subject>
): Chainable<Subject>
}
Expand Down

0 comments on commit 126fea6

Please sign in to comment.