cypress-io / add-cypress-custom-command-in-typescript

Testing how new Cypress commands are added in TypeScript
87 stars 30 forks source link

Might have found an easier way #125

Open Vadorequest opened 3 years ago

Vadorequest commented 3 years ago

Keeping support/commands.js as a JS file.

And creating a support/commands.d.ts with:

namespace Cypress {
  interface cy extends Chainable<undefined> {
    getCustomer: () => void;
  }
}

Makes it much easier to setup. Declaration and code is separated (commands) but it's much simpler. (and not really an issue either)

Commands do not benefit from TS support though.

dannysilence commented 2 years ago

the point fir this repo was to show specifically usage of ts, e. g. if you use typescript across your test code, and not to simply demonstrate how to extend suggestions of types which is achieved by js+d.ts