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

274
Views
validar cualquier objeto con Yup

Estoy tratando de validar un objeto, que es un tipo de unión de dos objetos. Son como dos subformularios diferentes donde puede llenar cualquiera de ellos o ambos, pero no debe estar vacío

aquí hay un ejemplo simplificado:

 // it's valid if it has all of the fields of the first sub-form const valid1 = { a: "a", b: "b", c: "c" }; // it's valid if it has all of the fields of the second sub-form const valid2 = { d: "a", e: "b", f: "c" }; // it's valid if it has all of the fields of both sub-forms const valid3 = { ...valid1, ...valid2 }; // it's invalid if it's empty or has only one sub-form field const invalid1 = { ...valid1, e: "b" }; const invalid2 = { ...valid2, a: "a" }; const invalid3 = {};

aquí hay una configuración de sandbox con todos mis intentos hasta ahora

about 4 years ago · Juan Pablo Isaza
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!