Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

228
Vistas
How to correctly use objects instead of multiple parameters?

How to correctly use objects instead of multiple parameters in my case?

class Test{ 
async createUser(
    url: string,
    name: string,
    email: string,
    phone: string,
    street: string,
...
  ) {
    await Page.setUrl(url);
    await Page.setEmail(email);

 ...
   
  }
}
about 4 years ago · Santiago Gelvez
2 Respuestas
Responde la pregunta

0

you can use an interface


interface User {
  url: string;
  name: string;
  email: string;
  phone: string;
  street: string;
}

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

 ...
   
  }
}
about 4 years ago · Santiago Gelvez Denunciar

0

use the concept of spread operators. Know more about it here:

create an object variable like this:

result = { 
    url: string,
    name: string,
    email: string,
    phone: string,
    street: string,
}

and then pass it as a parameter like this

 async createUser (...result){
    //get variable you wan to use
    const {url, name, email} = result;
    //your code here
   }
about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda