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

Array conversion from GQL to TS don't retain their type properly #7

Closed
MrSunshyne opened this issue Nov 14, 2024 · 0 comments
Closed

Comments

@MrSunshyne
Copy link
Contributor

I noticed an issue when moquerie generates TS types from gql Schemas. e.g here:
Arrays types are not handled properly.

Input

// fieldMappings.ts
extend type Query {
  myMappings(id: ID!): [MyMapping]
}

Current Ouput

// .moquerie/types/resources.ts
export interface Query {
  myMappings: MyMapping
}

Expected Output

// .moquerie/types/resources.ts
export interface Query {
 myMappings: MyMapping[]
}

Additional info

I was able to narrow down the logic to this file packages/core/src/tsCodegen/genInterface.ts, but not sure how to make it return the extra square bracket.

field.array = true retains the information that this is an array but it's not used when generating the resource type.

@Akryum Akryum closed this as completed in ae6606a Dec 9, 2024
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