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

1.5K
Visualizações
Why computed values are not permitted in an enum?

I am trying the keep route url's in an enum like below.

export enum RouteUrls {
HOME = '/home',
DASHBOARD = `${HOME}/dashboard` // error here 
}

In the above line I am getting error as "Computed values are not permitted in an enum with string valued members.", is there any other way to achieve the same using Enum in TypeScript.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

For now only numeric enums can have computed members. What you are trying to do is to have string enum with computed members, which is not permitted in TypeScript. I found that there is an open issue about this topic in official Microsoft TypeScript git repository. Maybe this feature will be implemented in the future versions.
URL to issue on git: https://github.com/microsoft/TypeScript/issues/40793

over 4 years ago · Santiago Trujillo 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