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

473
Views
Typescript: How to remove key from index signature?

In my Angular based web application, we at some point needed a type to hold translations of various strings in different languages. A colleague then implemented this type for that purpose:

export class TranslatedString {
  [language: string]: string;
}

Apparently, this is called an Index Signature, but I never really used it myself so I don't exactly understand how it works. When I inspect an instance of this at runtime, it looks like this:

{de: "TestDE", en: "TestEN", fr: "TestFR"}
de:"TestDE"
en:"TestEN"
fr:"TestFR"
__proto__:{}

I am now in a situation where I need to delete a translation from this type, but I cannot figure out a way to do it. There does not seem to be a remove or delete function which I can call to remove an element via its key. Is there really no way to do this, or how can I remove a translation from an instance of TranslatedString?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

At runtime the object you are getting is a normal JavaScript object

translations = {de: "TestDE", en: "TestEN", fr: "TestFR"}

so a delete should do it:

delete translations['de']

 // or 

delete translations.de
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!