0

Not sure if this is a bug in JDL, or if I'm just not understanding it, but if I create an enum in Jhipster JDL like this

enum PricingModel {
    AVAILABILITY,   
    DEADLINES,     
    PAYMENTS        
}

Then it will generate this typescript for my angular code.

export const enum PricingModel {
    'AVAILABILITY',
    'DEADLINES',
    'PAYMENTS'
}

Unless I am doing the switch statement wrong... this switch statement will not work:

To fix it I propose that the generated code from JhipsterJDL be changed to generate something like this ad defined in Typescript 2.4 :

export const enum PricingModel {
    AVAILABILITY = 'AVAILABILITY',
    DEADLINES = 'DEADLINES',
    PAYMENTS ='PAYMENTS',
}
Mohsen
  • 4,536
  • 2
  • 27
  • 49
Lance
  • 113
  • 7
  • the swtich statement that does not work with JDL generated code: switch (offering.pricingModel) { case PricingModel.DEADLINES: *wont' get here case default: * only this happens } – Lance May 12 '18 at 22:57
  • 1
    This was fixed in https://github.com/jhipster/generator-jhipster/pull/7557 – Jon Ruddell May 13 '18 at 16:43
  • Thanks Jon. I'm glad to I'm catching on to the great work you do! I'll be helping out one day... still got some learning to do – Lance May 14 '18 at 08:09

0 Answers0