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

109
Views
Usar parte del tipo para crear otro

Así que tengo este tipo llamado TranslationsData :

 [key: string]: { translation: { state: AnotherType } };

Quiero usar esta parte:

 [key: string]: { translation: { state:

en otro tipo, por lo que el único tipo que cambia es la parte AnotherType .

¿Hay una manera de hacerlo? Clase de tipo de orden superior.

Sé que hay algo como este Tipo, pero no tengo ni idea de cómo se llama.

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

0

La opción más limpia en este caso sería hacer que el tipo inicial sea genérico, algo como lo siguiente.

 type Foo<T> = { [key: string]: { translation: { state: T } } } type TranslationsData = Foo<AnotherType> type SomethingElse = Foo<Bar>
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!