2

Whenever I import enums from graphql-codegen generated types and use their values, the app fails to start.

import { MyEnum } from 'graphql-types.ts';

let x: MyEnum; // This works
x = MyEnum.MY_ENUM_VALUE; // Whenever I use this code, it fails

TypeScript does not show any errors in the code, but the app fails to run showing the error message below.

Android Bundling failed

SyntaxError: graphql.types.ts: Identifier 'Document' has already been declared.

export const Document = gql`
...
Z0q
  • 1,689
  • 3
  • 28
  • 57

1 Answers1

2

Use

export const name = gql`
    query name {

instead of:

export const name = gql`
    query {

Your identifier name is likely clashing with an ambient type definition.

Z0q
  • 1,689
  • 3
  • 28
  • 57
Damian Green
  • 6,895
  • 2
  • 31
  • 43