Graphql-code-generator: typescript-resolvers plugins + import-types preset

Created on 21 Jan 2020  路  5Comments  路  Source: dotansimha/graphql-code-generator

Can we use the import-types preset and type typescript-resolvers plugins together?
here is my config for generating types file

 ./graphql-types.ts :
    plugins:
      - typescript
      - typescript-operations

here is the config for generating resolver types

./graphql-resolvers.ts:
    preset: import-types
    presetConfig:
     typesPath: ./graphql-types
    plugins:
      - typescript-resolvers
    config:
      immutableTypes: true
      preResolveTypes: true

and
Screen Shot 2020-01-21 at 15 18 13
Screen Shot 2020-01-21 at 15 18 31

  • Current Error. Imported Types from generated files but never used.

  • Expected Results: It can use types from imported Types (example Types.Maybe ..etc)

enhancement plugins waiting-for-release

Most helpful comment

It's not supported yet. PRs are welcome :)

All 5 comments

It's not supported yet. PRs are welcome :)

I am interested in this as well. Let me know if I can help!

@charlex You can help and contribute :) PRs are welcome as @dotansimha said.

@VienNguyen113 I added support for this in: https://github.com/dotansimha/graphql-code-generator/pull/4289

It's general support for namespacedImportName configuration key in typescript-resovlers, which presets are using as well. So now if this plugin will get namespacedImportName configuration, it will use it correctly.

Fixed in v1.16.0

Was this page helpful?
0 / 5 - 0 ratings