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

123
Views
How do I create a new object with key as one object's value and the object as the value?

My question is somewhat similar to this

I have a map with the key as objectType1 and value as objectType1 | null.

type objectType1 = { key:string , value:string }
const newMap = new Map<objectType1, Array<objectType1 | null>([
   [{key:'key1', value:'value1'},null],
]);

what I want to do here is that I want a new object which looks something like:

const newObject = {
   key1 : {key: 'key1', value:'value1'}
 }

So basically the new object should be able to reference to the object. If i do newObject.key1, i should be able to get the object {key: 'key1', value:'value1'}

How do I go about this?

about 4 years ago · Santiago Trujillo
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!