Skip to content

Commit 1de09f1

Browse files
authored
Custom command recipe throws an error
See : cypress-io/cypress#18915 An error 'Argument of type '() => void' is not assignable to parameter of type '() => Chainable<any>' throws when you return directly cypress-io/cypress#18915 (comment) fixes cypress-io#763
1 parent b751316 commit 1de09f1

File tree

1 file changed

+3
-1
lines changed
  • examples/fundamentals__add-custom-command

1 file changed

+3
-1
lines changed

examples/fundamentals__add-custom-command/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ You write Cypress custom command, for example for selecting DOM elements by `dat
1111
*
1212
* @example cy.dataCy('greeting')
1313
*/
14-
Cypress.Commands.add('dataCy', (value) => cy.get(`[data-cy=${value}]`))
14+
Cypress.Commands.add('dataCy', (value) => {
15+
cy.get(`[data-cy=${value}]`)
16+
})
1517
```
1618

1719
Yet, TypeScript compiler and IntelliSense do not understand that you have added a new method to the global `cy` object.

0 commit comments

Comments
 (0)