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

239
Views
¿Cómo usar correctamente objetos en lugar de múltiples parámetros?

¿Cómo usar correctamente objetos en lugar de múltiples parámetros en mi caso?

 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 answers
Answer question

0

puedes usar una interfaz

 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 Report

0

utilizar el concepto de operadores de propagación. Conoce más al respecto aquí :

crea una variable de objeto como esta:

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

y luego pasarlo como un parámetro como este

 async createUser (...result){ //get variable you wan to use const {url, name, email} = result; //your code here }
about 4 years ago · Santiago Gelvez 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!