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

171
Visualizações
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 à 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