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

167
Vistas
Best way to format upper level keys according to interface

what is the best way to achieve the following:

export interface Iabc {
   startDate: Date | string | null;
   endDate: Date | string | null;
   nestedSection: {
      a: string | null;
      b: boolean | null;
      c: boolean | null;
      d: Date | string | null;
   };
}

Currently I am converting the Dates contained in the nested sections like so

 nestedSection: Object.entries(values.nestedSection).reduce((prev, [k, v]) => {
                  if (v instanceof Date) {
                     return {
                        ...prev,
                        [k]: moment(v).format('YYYY-MM-DD'),
                     };
                  }
                  return prev;
               }, values.nestedSection),

However I need to do it for startDate and endDate a level up from the nested section. TIA

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