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

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

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