I am implementing a custom Cypress command in TypeScript:
// support/commands.ts
const login = () => {
    console.log('Logging in...');
};
Cypress.Commands.add('login', login);
declare namespace Cypress {
    interface Chainable {
        login: typeof login;
    }
}
I try to call it using:
describe('Login Scenario', () => {
    it('should allow a user to login', () => {
        cy.visit('/');
        cy.login();
    });
});
Yet, it seems the command is not set up:
TypeError: cy.login is not a function
If I write the command in pure JavaScript (removing the namespace declaration and updating the call to (cy as any).login();, it works.
What am I missing?