ts2gql icon indicating copy to clipboard operation
ts2gql copied to clipboard

Support complex values for enums

Open jmoseley opened this issue 8 years ago • 1 comments

The following code will produce invalid GQL:

interface Foo {
  export enum FooEnums {
    ONE = <any>'ONE',
    TWO = <any>'TWO',
    THREE = <any>'THREE',
  }

  export enum BarEnums {
    ONE = FooEnums.ONE,
    TWO = FooEnums.TWO,
  }
}

The GQL produced will be something like:

enum FooEnums {
  ONE
  TWO
}

enum BarEnums {
  FooEnums.ONE
  FooEnums.TWO
}

This is invalid. The code generation should produce the expected:

enum FooEnums {
  ONE
  TWO
}

enum BarEnums {
  ONE
  TWO
}

jmoseley avatar Aug 01 '17 21:08 jmoseley

Yeah, I think there's a more general problem here where we should be extracting the value for each enum entry, not the name of it

nevir avatar Aug 01 '17 21:08 nevir