Argument of type '() => void' is not assignable to parameter of type '() => Chainable<any>'.
See original GitHub issueCurrent behavior
With the upgrade to v9, Cypress is reporting the following error when adding a custom method:
Argument of type '() => void' is not assignable to parameter of type '() => Chainable<any>'.
Desired behavior
According to the documentation, no other code should be needed to make this work.
Thus I believe that void should be a valid type to be supported.
Test code to reproduce
Cypress.Commands.add('login', () => {
// do something
})
Cypress Version
9.0.0
Other
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:19 (3 by maintainers)
Top Results From Across the Web
Argument type 'void' is not assignable to parameter of type
The error "Argument of type 'void' is not assignable to parameter of type" occurs when we forget to return from a function and...
Read more >TypeScript error: Type 'void' is not assignable to ...
It means that the callback function you passed to this.dataStore.data.find should return a boolean and have 3 parameters, two of which can ...
Read more >Incorrect "Type void is not assignable to ...
If I add a parameter to the function (like so: e => scriptEvent(); ), and do e. , WebStorm suggests function functions &...
Read more >How to fix error TS2345: Argument of type 'void' is not ...
This was the error I was getting: error TS2345: Argument of type 'void' is not assignable to parameter of type 'TimerHandler'.
Read more >type 'void' is not assignable to type 'reactelement<any, any>
In your definition private _noop: () => {}; _noop is typed as a function returning an object. When you assign it as this._noop...
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
Same thing here…
If anybody else falls here to find out how to get rid of typescript error in declaring commands, you have to wrap your
declare namespace Cypress
bloc in adeclare global { ... }
block like so: