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

315
Views
TypeScript: no se puede acceder a un objeto por clave variable

Aquí mi código se ve así:

 export const EMOJI_NAME_KEY = "n"; export const EMOJI_UNICODE_KEY = "u"; export interface Emoji { [EMOJI_NAME_KEY]: string[]; [EMOJI_UNICODE_KEY]: string; } const emoji: Emoji = { [EMOJI_NAME_KEY]: 'thumb', [EMOJI_UNICODE_KEY]: 'some_unicode_key' }

Ahora, cada vez que intento acceder a un valor del tipo Emoji, aparece un error. Por ejemplo:

 console.log(emoji[EMOJI_NAME_KEY]) // returns error in the terminal like below

El elemento tiene implícitamente un tipo 'cualquiera' porque la expresión de tipo 'cadena' no se puede usar para indexar el tipo 'Emoji'. No se encontró ninguna firma de índice con un parámetro de tipo 'cadena' en el tipo 'Emoji'

about 4 years ago · Juan Pablo Isaza
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!