add-cypress-custom-command-in-typescript icon indicating copy to clipboard operation
add-cypress-custom-command-in-typescript copied to clipboard

Might have found an easier way

Open Vadorequest opened this issue 4 years ago • 1 comments

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.

Vadorequest avatar Dec 03 '20 23:12 Vadorequest

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

dannysilence avatar Jun 15 '22 09:06 dannysilence