Type 'Promise<any>' is not assignable to type 'CanReturnChainable' in Cypress
See original GitHub issueCurrent behavior:
Having updated from Cypress 4.8, TypeScript will now not compile my support code. #435 was not insightful.
Desired behavior:
Compile my TypeScript. Either I’m doing something wrong or there is a bug.
Test code to reproduce
Cypress.Commands.overwrite(command, (originalFn, ...args) => {
const origVal = originalFn(...args);
return new Promise(resolve => {
setTimeout(() => resolve(origVal), 1000);
});
});
It fails similarly with Cypress.Promise
as well. I’d like to avoid cy.wrap()
unless necessary.
Versions
Cypress 4.9.0 macOS 10.15.5 Chrome 83
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Type 'Promise<any>' is not assignable to type ... - Stack Overflow
I have just upgraded Cypress version to 4.9.0 from 4.8.0 and got: enter image description here. Example of test:
Read more >Cypress.Promise
Cypress is promise aware so if you return a promise from inside of commands like .then() , Cypress will not continue until those...
Read more >Type 'Promise<number | null>' is not assignable to ... - ADocLib
Cypress: Type 'Promise<any>' is not assignable to type 'CanReturnChainable' in Cypress Current behavior: Desired behavior: Test code to.
Read more >Microsoft/TypeScript - Gitter
Type 'Promise<any>' is not assignable to type 'Promise<any>'. Property 'catch' is missing in type 'Promise<any>'.
Read more >cli/types/cypress.d.ts - Fossies
1 /* eslint-disable @typescript-eslint/no-unused-vars */ 2 /// <reference path="./cypress-npm-api.d.ts" /> 3 /// <reference path=".
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jennifer-shehane I’m seeing similar behavior.
Error:
For me this issue also started when upgrading from 4.8 to 4.9
The code for this is done in cypress-io/cypress#8501, but has yet to be released. We’ll update this issue and reference the changelog when it’s released.