Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

122
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda