Cypress doesn't see custom cy. commands

Since your sepc is a typescript file, did you add a new types definition for the support/index.js?

Their documentation seems to outline it pretty well here. Only thing that is different with their example though is that you're not returning anything from generateToken so I don't think you can place it into the global Chainable interface.

You could try adding this in a support/index.d.ts file and see if it yells at you

declare namespace Cypress {
  interface Chainable {
    generateToken({secret}: {secret: string}): void
  }
}

Here is how I get TypeScript to see my custom commands:

commands.ts

declare namespace Cypress {
  interface Chainable<Subject> {
    generateToken(secret: any): Cypres.Chainable<void>;
  }
}

function generateToken(secret: any): void {
  // Generate token
}

Cypress.Commands.add('generateToken', generateToken);

test.spec.ts

cy.generateToken(secret);