rapini
rapini copied to clipboard
Export union types as objects
When generating enums, it would be good to centralise the options for use in select menus etc
When enums are produced at the moment it creates:
export type Payment = 'Debit' | 'Credit';
Preferentially it could be
export enum Payment {
Debit = 'Debit',
Credit = 'Credit'
}
Now you can access array of options:
Object.values(Payment)
Alternatively define the array of enumerated values and then define the type from that, then it will avoid the typescript enum issues