mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-01 04:20:23 -05:00
fix: cy.then shows wrong type when collection of HTMLElement's is provided (#15869)
This commit is contained in:
Vendored
+12
@@ -1826,6 +1826,12 @@ declare namespace Cypress {
|
||||
* @see https://on.cypress.io/then
|
||||
*/
|
||||
then<S extends HTMLElement>(fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<JQuery<S>>
|
||||
/**
|
||||
* Enables you to work with the subject yielded from the previous command / promise.
|
||||
*
|
||||
* @see https://on.cypress.io/then
|
||||
*/
|
||||
then<S extends ArrayLike<HTMLElement>>(fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<JQuery<S extends ArrayLike<infer T> ? T : never>>
|
||||
/**
|
||||
* Enables you to work with the subject yielded from the previous command / promise.
|
||||
*
|
||||
@@ -1844,6 +1850,12 @@ declare namespace Cypress {
|
||||
* @see https://on.cypress.io/then
|
||||
*/
|
||||
then<S extends HTMLElement>(options: Partial<Timeoutable>, fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<JQuery<S>>
|
||||
/**
|
||||
* Enables you to work with the subject yielded from the previous command / promise.
|
||||
*
|
||||
* @see https://on.cypress.io/then
|
||||
*/
|
||||
then<S extends ArrayLike<HTMLElement>>(options: Partial<Timeoutable>, fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<JQuery<S extends ArrayLike<infer T> ? T : never>>
|
||||
/**
|
||||
* Enables you to work with the subject yielded from the previous command / promise.
|
||||
*
|
||||
|
||||
@@ -239,6 +239,15 @@ describe('then', () => {
|
||||
$div // $ExpectType JQuery<HTMLDivElement>
|
||||
})
|
||||
|
||||
cy.get('div')
|
||||
.then(($div) => {
|
||||
$div // $ExpectType JQuery<HTMLDivElement>
|
||||
return [$div[0]]
|
||||
})
|
||||
.then(($div) => {
|
||||
$div // $ExpectType JQuery<HTMLDivElement>
|
||||
})
|
||||
|
||||
cy.get('p')
|
||||
.then(($p) => {
|
||||
$p // $ExpectType JQuery<HTMLParagraphElement>
|
||||
|
||||
Reference in New Issue
Block a user