-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cypress.Chainable incorectly wrapping any as JQuery<any> in typedef #16669
Comments
Sorry for the late reply. I checked the code and found out the it failed because the type of With it solved and you can write code like below: interface ResBody {
x: number
y: string
}
cy.request<ResBody>({
url: 'http://goooooogle.com',
body: {}
}).then((resp) => {
return resp.body.y
}).then(a => {
a // => string
}) Meanwhile, you can manually cast the type like below: cy.request({
url: 'http://goooooogle.com',
body: {}
}).then((resp) => {
return resp.body.y as string
}).then(a => {
a // => string
}) I thought about ways to revert the behavior, but it seems that it's impossible because |
@sainthkh It's totally okay. Yes I know If you look at the first example, it does not relate to the If you explicitly specify return type of fn, it works okay. But, with other types - it does not. |
At first, I thought it was impossible because it's how |
The code for this is done in cypress-io/cypress#16756, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior
When returning
any
from cypress chainable both following methods return types areCypress.Chainable<JQuery<any>>
which is incorrect.Desired behavior
Tested on Cypress 6.9.1, it correctly return
Cypress.Chainable<any>
.Versions
Tested on 6.9.1 - working as expected, 7.3.0, 7.4.0 - incorrect types
The text was updated successfully, but these errors were encountered: