question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

types are not imported into graphqlStores.ts

See original GitHub issue

Hello!

I just put together a graphqlrc.yaml config as per the tutorial, and when running yarn gen, the files are generated.

Having a closer look at graphqlStores.ts, I noticed that the types used in the files aren’t imported, therefore ESLint is complaining.

Is that something you came across before?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
gregoryforelcommented, Apr 6, 2022

Thank you for the lib. While you’re at it, some quick notes:

  • I originally copied/paste the code from the all in tutorial. I had an error message saying that codegen was not indented properly.
  • Once I corrected the indentation (so codegen is at the same level as documents, the config failed me with
Invalid Codegen Configuration!

        Please make sure that your codegen config file contains the "generates" field, with
 a specification for the plugins you need.

        It should looks like that:

        schema:
          - my-schema.graphql
        generates:
          my-file.ts:
            - plugin1
            - plugin2
            - plugin3

I ended up simplifying the config to:

schema:
  - ./src/lib/data-access/graphql/schema.json
documents:
  - './src/**/*.{gql,graphql}'
generates:
  ./src/lib/data-access/graphql/_kitql/graphqlTypes.ts:
    plugins:
      - typescript
      - typescript-operations
      - typed-document-node
      - typescript-document-nodes

  ./src/lib/data-access/graphql/_kitql/graphqlStores.ts:
    plugins:
      - '@kitql/graphql-codegen'
    config:
      importBaseTypesFrom: $lib/data-access/graphql/_kitql/graphqlTypes
0reactions
allcontributors[bot]commented, Apr 6, 2022

@jycouet

I’ve put up a pull request to add @gregoryforel! 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript types for code that is not imported by typescript?
The answer to my question appears to be here: @types/googlemaps/index.d.ts' is not a module That is, I can use a triple slash directive, ......
Read more >
Preset import-types not importing typescript-operations in all ...
Describe the bug I have a monorepo with a root codegen.yml including this: generates: packages/api/src/types/common.ts: plugins: ...
Read more >
Documentation - TypeScript 3.8
import type only imports declarations to be used for type annotations and declarations. It always gets fully erased, so there's no remnant of...
Read more >
type-only imports — A new TypeScript feature that benefits ...
Example 1 — Ambiguous re-export · Babel removes everything from our types module because it only contained types, which have no use in...
Read more >
Advanced type safety (Reference) - Prisma
You can import the Prisma namespace and use dot notation to access types ... is not needed as TypeScript will infer the type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found