Make transform of Enums to types or to native enums configurable on class level (using an attribute)
Closed this issue · 1 comments
jdwit commented
In most cases transforming PHP backed enums to type is preferable. However in some cases we need it as a Typescript Enum
, for instance when we need to iterate it in order to generate a list of options. Currently it is either types or Enums, configurable using the TypeScriptTransformerConfig
.
It would be very useful if the Enum and the Type transforming can be split in 2 Transformer classes, e.g. TypeEnumTransformer
and NativeEnumTransformer
. The EnumTransformer
uses these and additionally you can use the Attribute #[TypeScriptTransformer(NativeEnumTransformer::class)]
when you need a Typescript native enum.
Does the above make sense and are you interested in a PR?
rubenvanassche commented
I would certainly accept such a PR!