Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

552
Visualizações
TypeScript Expected 1 arguments, but got 2

What's wrong with my function createUser()? Why I can't put params in Smoke.ts ?

Login.ts :

interface User {
  url: string,
  email: string,
}

class Test{ 
async createUser(user: User) {
    await Page.setUrl(user.url);
    await Page.setEmail(user.email);


   
  }
}

Smoke.ts

test("Smoke Test", async (t) => {
  console.log("Starting test");  
  await Login.createUser(
  "google.com","joe"
  );

An error appear : Expected 1 arguments, but got 2.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

The method createUser is expecting an object with the following shape: { url: string, email: string, }

And you are passing a string as first parameter and another string as the second parameter.

you should be passing an object like this:

createUser({ 
   url: 'google.com', 
   email: 'joe' 
})

BTW why are you using "interface" and not "type" here? type is more common for defining object shapes and interface is often used to describe behaviours

about 4 years ago · Juan Pablo Isaza Relatório

0

your createUser function was declared with only one parameter but when you call this method you passed two-parameter. to fix this you need to pass user object

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda