Update: https://github.com/cypress-io/cypress/issues/1065#issuecomment-351769720 Removing an import from my commands.ts fixed it. Thanks
In the process of transitioning my cypress project to use TypeScript, I am following the guidelines provided at https://docs.cypress.io/guides/tooling/typescript-support#Types-for-custom-commands
All other compilation errors have been resolved except for the issue with custom commands not functioning as expected. For instance:
commands.ts:
declare namespace Cypress {
interface Chainable {
clickByLinkText(link: string): Chainable<Element>;
}
}
// Finds and clicks a given link by it's link text
Cypress.Commands.add("clickByLinkText", (link: string) => {
cy.get("a").contains(link).click();
});
Despite implementing the function in my test, I encounter the error message:
TS2339: Property 'clickByLinkText' does not exist on type 'cy & EventEmitter'.
The line import "./commands"; is included in my support/index.ts