consider adding to typescript codegen config option enumSuffix
in my company we like to suffix graphql types with QLType so for example User schema type would become UserQLType.
typescript type, however, the codegen also suffixes enum values which causes typescript errors.
expectations :
enum Rule {
admin
user
}
=>
export enum RuleQLType {
Admin = 'admin',
User = 'user'
}
Reality:
enum Rule {
admin
user
}
=>
export enum RuleQLType {
AdminQLType = 'admin',
UserQLType = 'user'
}
=> typescript error:
Types of property 'rule' are incompatible.
Type 'rule' is not assignable to type 'RuleQLType'.
enumPrefix exists, but not enumSuffix...
thanks
I also have the problem with suffixes added to enum, not only enum values but also enums in itself. Would be nice to opt out of it completely.
It should work in the same way as the enumPrefix option. It only makes sense!
Please consider adding this option. Thank you
Hi we have exactly the same issue where enum properties also receive the suffix when we only want to suffix the enum name:
dream:
enum FruitEnum {
Apple = 'APPLE'
}
reality:
enum FruitEnum {
AppleEnum = 'APPLE'
}
Is there a workaround / way to address this?
thanks @esfomeado! @dotansimha does this PR look good to merge?
It seems that the above PR didn't actually achieve the requested effect, it suffixes the values but then doesn't suffix the enum itself. People here want to suffix the enum but not the values. Any possible workaround?