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

gql-tag-operations adds a unknown overload that infers unknown due to whitespace in sdl breaking validation #6674

Closed
fivethreeo opened this issue Sep 14, 2021 · 1 comment

Comments

@fivethreeo
Copy link

fivethreeo commented Sep 14, 2021

Describe the bug

gql-tag-operations adds a unknown overload that infers unknown breaking validation in vscode

export function gql(source: string): unknown;
export function gql(source: string) {
  return (documents as any)[source] ?? {};
}

Changing it to

export function gql(source: string) {
  return (documents as any)[source] ?? {};
}

After generation fixes the issue

To Reproduce
Steps to reproduce the behavior:

  1. My GraphQL schema:
type User {
  id: Int!
  username: String
  email: String!
}

type AuthPayload {
  accessToken: String
  refreshToken: String
  success: Boolean!
}

type Query {
  user(id: Int!): User
  allUsers: [User!]!
  me: User
}

type Mutation {

  registerUser(
    username: String
    email: String!
    password: String!
  ): AuthPayload!

  login(email: String!, password: String!): AuthPayload

  refreshTokens (
    refreshToken: String
  ): AuthPayload!

}
  1. My GraphQL operations:
import { gql } from "@app/gql";

const Me = gql(/* GraphQL */ `
    query Me {
    me {
        id
    }
    }
`);

export default Me;
  1. My codegen.yml config file:
schema: src/**/*.graphql
documents:
  - 'src/**/*.ts'
  - '!src/gql/**/*'
generates:
  ./src/gql/:
    preset: gql-tag-operations-preset

Expected behavior

Outputs valid code

Environment:

  • OS:
  • @graphql-codegen/...:
  • NodeJS:

Additional context

@fivethreeo fivethreeo changed the title graphql-tag-operations adds a unknown override that infers unknown breaking validation gql-tag-operations adds a unknown override that infers unknown breaking validation Sep 14, 2021
@fivethreeo fivethreeo changed the title gql-tag-operations adds a unknown override that infers unknown breaking validation gql-tag-operations adds a unknown overload that infers unknown breaking validation Sep 15, 2021
@fivethreeo
Copy link
Author

Am I missing some configuration to make this work right or is this a bug?

@fivethreeo fivethreeo changed the title gql-tag-operations adds a unknown overload that infers unknown breaking validation gql-tag-operations adds a unknown overload that infers unknown due to whitespace in sdl breaking validation Sep 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant