add-cypress-custom-command-in-typescript
add-cypress-custom-command-in-typescript copied to clipboard
Might have found an easier way
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.
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