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

135
Views
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 answers
Answer question

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 Report
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!