import "@testing-library/cypress/add-commands" ; declare global { namespace Cypress { interface Greeting { greeting : string ; name : string ; } interface Chainable { returns { typeof foo } memberof example foo : typeof foo ; foo2 : typeof foo2 ; memberof example sum : ( a : number , b : number ) => Chainable < number > ; memberof example greeting : ( options ? : Greeting ) => void ; } } } returns { string } example export function foo ( ) { return "foo" ; } returns { string } example export function foo2 ( ) { return cy . foo ( ) ; } example export function sum ( a , b ) { return a + b ; } const defaultGreeting = { greeting : "hi" , name : "there" } ; example export const printToConsole = ( options = defaultGreeting ) => { const { greeting , name } = options ; console . log ( `${ greeting }, ${ name }` ) ; } ; Cypress . Commands . add ( "foo" , foo ) ; Cypress . Commands . add ( "foo2" , foo2 ) ; Cypress . Commands . add ( "sum" , sum ) ; Cypress . Commands . add ( "greeting" , printToConsole ) ;