mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-15 03:31:18 -06:00
fix(types): when user returns any type, then doesn't wrap it with JQuery. (#16756)
This commit is contained in:
8
cli/types/cypress.d.ts
vendored
8
cli/types/cypress.d.ts
vendored
@@ -1826,6 +1826,12 @@ declare namespace Cypress {
|
||||
* @see https://on.cypress.io/then
|
||||
*/
|
||||
then<S>(options: Partial<Timeoutable>, fn: (this: ObjectLike, currentSubject: Subject) => PromiseLike<S>): Chainable<S>
|
||||
/**
|
||||
* Enables you to work with the subject yielded from the previous command / promise.
|
||||
*
|
||||
* @see https://on.cypress.io/then
|
||||
*/
|
||||
then<S extends string | number | boolean>(fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<S>
|
||||
/**
|
||||
* Enables you to work with the subject yielded from the previous command / promise.
|
||||
*
|
||||
@@ -1843,7 +1849,7 @@ declare namespace Cypress {
|
||||
*
|
||||
* @see https://on.cypress.io/then
|
||||
*/
|
||||
then<S extends object | any[] | string | number | boolean>(fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<S>
|
||||
then<S extends any[] | object>(fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<S>
|
||||
/**
|
||||
* Enables you to work with the subject yielded from the previous command / promise.
|
||||
*
|
||||
|
||||
@@ -257,6 +257,15 @@ describe('then', () => {
|
||||
$p // $ExpectType JQuery<HTMLParagraphElement>
|
||||
})
|
||||
})
|
||||
|
||||
// https://github.com/cypress-io/cypress/issues/16669
|
||||
it('any as default', () => {
|
||||
cy.get('body')
|
||||
.then(() => ({} as any))
|
||||
.then(v => {
|
||||
v // $ExpectType any
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
cy.wait(['@foo', '@bar'])
|
||||
|
||||
Reference in New Issue
Block a user