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

183
Views
TypeScript Enum cannot be assigned to type Enum.Value

I have this Enum:

export enum EntityTypes {
  VALUE = 'value',
  OTHER = 'other',
}

and this type:

export type ValueEntity = {
  entityType: EntityTypes.VALUE
}

and this func:

const myFunc = (entity: ValueEntity) => {}

If I do:

myFunc({ entityType: EntityTypes.VALUE })

I get the error: Type 'EntityTypes' is not assignable to type 'EntityTypes.VALUE'.

If I do

myFunc({ entityType: EntityTypes.VALUE as EntityTypes.VALUE })

it works but that's an ugly workaround...

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!