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

preresolve types resolves string array incorrectly #2211

Closed
mlabrum opened this issue Jul 22, 2019 · 2 comments
Closed

preresolve types resolves string array incorrectly #2211

mlabrum opened this issue Jul 22, 2019 · 2 comments
Labels
plugins waiting-for-release Fixed/resolved, and waiting for the next stable release

Comments

@mlabrum
Copy link
Contributor

mlabrum commented Jul 22, 2019

Describe the bug
preresolve types resolves string array incorrectly as string rather than string[]

To Reproduce
Steps to reproduce the behavior:

https://codesandbox.io/s/graphql-codegen-issue-template-wbzsk?fontsize=14

  1. My GraphQL schema:
schema {
  query: Query
}

type Query {
  test: [String!]!
}
  1. My GraphQL operations:
query test{
 	test 
}
  1. My codegen.yml config file:
schema: myschema.graphql
documents: mydocument.graphql
generates:
  types.ts:
    plugins:
      - typescript
      - typescript-operations
    config:
      preResolveTypes: true

Current behavior

export type Maybe<T> = T | null;
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
  ID: string;
  String: string;
  Boolean: boolean;
  Int: number;
  Float: number;
};

export type Query = {
  __typename?: "Query";
  test: Array<Scalars["String"]>;
};
export type TestQueryVariables = {};

export type TestQuery = { __typename?: "Query"; test: string };

Expected behavior

export type Maybe<T> = T | null;
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
  ID: string;
  String: string;
  Boolean: boolean;
  Int: number;
  Float: number;
};

export type Query = {
  __typename?: "Query";
  test: Array<Scalars["String"]>;
};
export type TestQueryVariables = {};

export type TestQuery = { __typename?: "Query"; test: Array<string> };

Environment:
( See the code sandbox )

@dotansimha
Copy link
Owner

Fixed in #2270

@dotansimha dotansimha added the waiting-for-release Fixed/resolved, and waiting for the next stable release label Aug 1, 2019
@dotansimha
Copy link
Owner

Fixed in 1.5.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugins waiting-for-release Fixed/resolved, and waiting for the next stable release
Projects
None yet
Development

No branches or pull requests

2 participants