Graphql-code-generator: Typescript generation fails with [object Object] instead of field name in Pick

Created on 18 Nov 2020  ยท  4Comments  ยท  Source: dotansimha/graphql-code-generator

Describe the bug

Generation of typescript objects fails since the last update of [email protected].

To Reproduce
Steps to reproduce the behavior:

https://codesandbox.io/s/inspiring-pasteur-onywi

Expected behavior

In the codesandbox types.ts files at the line 36, we should have:

& Pick<User, '[object Object]' | '[object Object]' | '[object Object]'>

instead of:

& Pick<User, 'id' | 'user' | 'email'>

Environment:

  • OS: macOS (local) and codesandbox
  • @graphql-codegen/cli: 1.19.1
  • @graphql-codegen/typescript: 1.17.11
  • @graphql-codegen/typescript-operations: 1.17.9
  • @graphql-codegen/typescript-resolvers: 1.17.11
  • graphql: 14.7.0
  • NodeJS: node --version in codesandbox => v10.21.0

Additional context

Most helpful comment

Ah ok I understand. Indeed, publishing everything, everytime is also not a good thing.

Maybe peerDependencies can help in this kind of situation. This way it would probably show warnings when executing yarn install.

And btw, you're doing a very good job with this tool!

All 4 comments

Hi, @c100k , please update typescript-operations as well. It should be: 1.17.10.

Hi @dotansimha, thanks for the feedback. Tested on the codesandbox and indeed it fixed it.

Generally speaking, having two dependencies with two different version number makes the whole thing harder to follow.

  • @graphql-codegen/typescript-resolvers (1.17.10) + @graphql-codegen/typescript-operations (1.17.9) โœ…
  • @graphql-codegen/typescript-resolvers (1.17.11) + @graphql-codegen/typescript-operations (1.17.9) โŒ
  • @graphql-codegen/typescript-resolvers (1.17.11) + @graphql-codegen/typescript-operations (1.17.10) โœ…

That does not follow exactly semantic versioning.

I totally agree with you, but unfortunately, semantic versioning doesn't refer to siblings / optional deps.

The thing here is that typescript-operations and typescript works together, but it can also be standalone. And both shares a common package. Fixing something in the common package will require you to update both to latest (like in this case). We are trying to avoid these changes as much as possible.

We don't want to publish the entire monorepo on each change... we used to do it in the past but it was causing an overhead and published packages for no reason.

I will update the release notes, hope that helps.

Ah ok I understand. Indeed, publishing everything, everytime is also not a good thing.

Maybe peerDependencies can help in this kind of situation. This way it would probably show warnings when executing yarn install.

And btw, you're doing a very good job with this tool!

Was this page helpful?
0 / 5 - 0 ratings