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

136
Visualizações
How do I type-check this object in Typescript

I am in a state of confusion on how I would go about type-checking this variable, but I am not able to do it.

What I understand is that this is an object which contains fields, but these fields are written in a obscure way.

The object is called userApproval

Here is the object when I output it to console.

{
l8s.restart_trigger: true, l8s.system_scale: true, manager.cleanup: true, 
manager.extend: true
}

Now this is the type I am attempting to type to,

 export type UserApproval = {
  MANAGER_CLEANUP: boolean;
  MANAGER_EXTEND: boolean;
  L8S_SYSTEM_SCALE: boolean;
  L8S_RESTART_TRIGGER: boolean;
};

Is this correct

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I think the keys of your object are example.test so based on that try this types.

type ApprovalTypes =  {
  'l8s.restart_trigger': boolean;
  'l8s.system_scale': boolean;
  'manager.cleanup': boolean;
  'manager.extend': boolean;
}

const data:ApprovalTypes = {
  'l8s.restart_trigger': true, 
  'l8s.system_scale': true, 
  'manager.cleanup': true, 
  'manager.extend': true
  }
about 4 years ago · Juan Pablo Isaza Relatório
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