Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Urql codegen with 'typescript-operations' and no variables broken with v3 #2622

Closed
onionhammer opened this issue Aug 19, 2022 · 0 comments · Fixed by #2623
Closed

Urql codegen with 'typescript-operations' and no variables broken with v3 #2622

onionhammer opened this issue Aug 19, 2022 · 0 comments · Fixed by #2623
Labels
future 🔮 An enhancement or feature proposal that will be addressed after the next release

Comments

@onionhammer
Copy link

To reproduce:

Package.json

    "@graphql-codegen/cli": "^2.11.6",
    "@graphql-codegen/typescript": "^2.7.3",
    "@graphql-codegen/typescript-operations": "^2.5.3",
    "@graphql-codegen/typescript-urql": "^3.6.4",

GraphQL codegen:

schema: schema.graphql
documents: "./src/test.graphql"
generates:
  ./src/queries.ts:
    plugins:
      - typescript
      - typescript-operations
      - typescript-urql
    config:
      withHooks: true
      exportFragmentSpreadSubTypes: true
      mergeFragmentTypes: true
      scalars:
        Decimal: number
        DateTime: string
        UUID: string

schema.graphql

type Environment {
  "Retrieve application version"
  version: String
}

type Query {
  "Gets current system environment"
  environment: Environment!
}

test.graphql

query env {
  environment {
    version
  }
}

This generates typescript with the following error:

image

const EnvDocument: DocumentNode
Argument of type '{ requestPolicy?: Urql.RequestPolicy | undefined; context?: Partial<Urql.OperationContext> | undefined; pause?: boolean | undefined; variables?: Exact<{ [key: string]: never; }> | undefined; query: DocumentNode; }' is not assignable to parameter of type 'UseQueryArgs<Exact<{ [key: string]: never; }>, EnvQuery>'.
Type '{ requestPolicy?: Urql.RequestPolicy | undefined; context?: Partial<Urql.OperationContext> | undefined; pause?: boolean | undefined; variables?: Exact<{ [key: string]: never; }> | undefined; query: DocumentNode; }' is not assignable to type '{ variables: Exact<{ [key: string]: never; }>; }'.
Types of property 'variables' are incompatible.
Type 'Exact<{ [key: string]: never; }> | undefined' is not assignable to type 'Exact<{ [key: string]: never; }>'.
Type 'undefined' is not assignable to type 'Exact<{ [key: string]: never; }>'.ts(2345)

@onionhammer onionhammer added the future 🔮 An enhancement or feature proposal that will be addressed after the next release label Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
future 🔮 An enhancement or feature proposal that will be addressed after the next release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant