I have set up the following example repo following the example code from the documentation of Cypress both for setting up the project and adding typescript to it to the letter: https://github.com/jacobdo2/cypress-ts-starter
I add the example command in commands.ts:
Cypress.Commands.add("dataCy", (id: string) => cy.get(`[data-cy="${id}"]`));
and the declaration in index.ts:
/// <reference types="cypress" />
declare namespace Cypress {
interface Chainable {
/**
* Custom command to select DOM element by data-cy attribute.
* @example cy.dataCy('greeting')
*/
dataCy(value: string): Chainable<Element>;
}
}
and I get the following error in index.ts:

and in commands.ts:
