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

123
Vistas
Build a dynamic interface for Object in angular

I have an JSON Object received from an api call and the Object will have multiple values but all of type string. How to I write an Interface for such an Object in the shortest way. I mean I can write and Interface with 100 keys whose type is string. But is there a more efficient way of doing this?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

you can use Record(a utility type in typescript):

const info: Record<string, string> = {
  name: "Bruce Wayne",
  address: "Bat Cave"
};

you can use it in your service like this:

class MyService {
  constructor(private readonly http: HttpClient) {}

  callApi() {
    return this.http.get<Record<string, string>>(url);
  }
}
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