Skip to content

Commit

Permalink
Fix typescript signature (#478)
Browse files Browse the repository at this point in the history
* chore: update to Node.js 20

* fix: fix waitUntil chained value type

BREAKING CHANGE: TypeScript tests could now throw because of operations made on the value returned
by `checkFunction` (passed to cy.waitUntil). The type was previously `undefined` while now reflecting
the type returned by `checkFunction`.

fix #477
  • Loading branch information
NoriSte committed Dec 1, 2023
1 parent 526da32 commit 8e3ff03
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- 10
- 20
addons:
apt:
packages:
Expand Down
4 changes: 4 additions & 0 deletions cypress/types/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,7 @@ 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)

cy.waitUntil(() => cy.task<number>('myTaskReturningANumber')).then((subject) => {
subject * subject
})
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ declare namespace Cypress {
subject: Subject | undefined
) => ReturnType | Chainable<ReturnType> | Promise<ReturnType>,
options?: WaitUntilOptions<Subject>
): Chainable<Subject>
): Chainable<ReturnType>
}
}
4 changes: 4 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"name": "cypress-wait-until",
"version": "2.0.1",
"engines" : {
"npm" : ">=9.6.4",
"node" : ">=20.1.0"
},
"description": "A waiting plugin for Cypress",
"main": "src/index.js",
"dependencies": {},
Expand Down

0 comments on commit 8e3ff03

Please sign in to comment.