Add cypress commands from raw typescript functions.
This allows smaller definition footprints while keeping documentation
and go to definition IDE utils.
// original Cypress.Commands.add('clickLink', (label) => { cy.get('a').contains(label).click() }); // with addCommands exportconstclickLink = (label: string) => cy.get('a').contains(label).click(); // likely create object with `import * as commands from ...` constcommands = { clickLink }; addCommands(commands); // type def typeCommands = typeofcommands; declareglobal { namespaceCypress { interfaceChainableextendsCommands { // can still put types here defined in the old Cypress.Commands.add way getInDocument(selector: string): Chainable; // overwrite default type, should really accept string | number type(text: string | number, options?: Partial<TypeOptions>): Chainable; } } }
Add cypress commands from raw typescript functions. This allows smaller definition footprints while keeping documentation and go to definition IDE utils.