Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

671
Views
Custom cypress commands is not assignable to parameter of type 'keyof Chainable<any>

In a .ts file I create a test to try and access a custom created command from command.js, createInbox function is underlined with red with the following message : Property 'createInbox' does not exist on type 'cy & EventEmitter

it.only('dsdsds', () => {
    cy.createInbox().then((inbox) => { 
      console.log(inbox);
      // { id: '...', emailAddress: '...' }
    });
  })

My command.js file look like this

const { MailSlurp } = require("mailslurp-client");
const mailslurp = new MailSlurp(Cypress.env("mailSlurpApiKey"));

Cypress.Commands.add("createInbox", () => {
  return mailslurp.createInbox();
});

Cypress.Commands.add("waitForLatestEmail", (inboxId) => {
  return mailslurp.waitForLatestEmail(inboxId);
});

I understand that I have to rename command.js to ts, however when I do that all custom commands is underlined with red with the following error : Argument of type '"waitForLatestEmail"' is not assignable to parameter of type 'keyof Chainable

How could I fix this?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Solved by adding custom chainable interface to support folder

declare namespace Cypress {
  interface Chainable {
    createInbox(): Chainable<any>;
    waitForLatestEmail(inboxId: number): Chainable<any>;
  }
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!