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

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

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