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

138
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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