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

126
Vistas
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
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