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.

gatsby-types.d.ts is not generated

See original GitHub issue

Hello!

I’m trying to install and set up this plugin, but I’m unable to get the types-file generated (gatsby-types.d.ts).

This is my config for this plugin:

  {
    resolve: 'gatsby-plugin-typegen',
    options: {
      outputPath: 'src/__generated__/gatsby-types.d.ts',
      includeResolvers: false,
      emitSchema: {
        'src/__generated__/gatsby-schema.graphql': true,
        'src/__generated__/gatsby-introspection.json': true,
      },
      emitPluginDocuments: {
        'src/__generated__/gatsby-plugin-documents.graphql': true,
      },
    },
  },

After I run either gatsby develop or gatsby build, the only files that end up in the __generated__ folder is:

gatsby-introspection.json
gatsby-schema.graphql

These are some relevant plugins that I’m are using:

    "gatsby-plugin-ts": "^2.7.1",
    "gatsby-plugin-typegen": "^2.2.4",
    "gatsby": "^2.32.4",

I did some digging into your code, and it seems as QUERY_EXTRACTION_BABEL_SUCCESS is never triggered. Added a debug log where it checks for that action. These are the actions types that it was able to pick up:

CREATE_TYPES
CREATE_NODE
TOUCH_NODE
DELETE_NODE
BUILD_TYPE_METADATA
START_INCREMENTAL_INFERENCE
DISABLE_TYPE_INFERENCE
SET_SCHEMA_COMPOSER
SET_SCHEMA
CREATE_REDIRECT
CREATE_PAGE
API_FINISHED

These are the typegen logs:

[typegen] Successfully validate your configuration.
{
  "language": "typescript",
  "namespace": "GatsbyTypes",
  "outputPath": "src/__generated__/gatsby-types.d.ts",
  "includeResolvers": false,
  "autoFix": true,
  "emitSchema": {
    "src/__generated__/gatsby-schema.graphql": {
      "format": "sdl",
      "commentDescriptions": true
    },
    "src/__generated__/gatsby-introspection.json": {
      "format": "introspection",
      "commentDescriptions": true
    }
  },
  "emitPluginDocuments": {
    "src/__generated__/gatsby-plugin-documents.graphql": true
  },
  "scalars": {}
}

[typegen] Listen on query extraction
[typegen] End-up listening on query extraction.
[typegen] Watching schema/query changes and re-run workers
[typegen] Emit Gatsby schema into src/__generated__/gatsby-schema.graphql
[typegen] Emit Gatsby schema into src/__generated__/gatsby-introspection.json

Any ideas?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
cometkimcommented, Mar 14, 2022

This should be fixed in v3, and I will test it on my Gatsby Cloud today.

v3 doesn’t use QUERY_EXTRACTION_BABEL_SUCCESS action anymore.

1reaction
stefanplcommented, May 21, 2021

Facing the same issue … quite frustrating, since it cannot be reproduced reliably, and breaks CI. (parallel soucing is diabled) Looking forward to v3 😊

Read more comments on GitHub >

github_iconTop Results From Across the Web

gatsby-plugin-typegen
Features · Schema extraction · Plugin documents extraction · Generates type definitions for TypeScript & Flow, using graphql-codegen · Auto-fixing <StaticQuery> and ...
Read more >
gatsby-plugin-typegen - Bountysource
Hi, I'm trying to get types generated for my root query in gatsby-node.ts. Somehow this seems to not work. I used a query...
Read more >
TypeScript typings give me "index.d.ts is not a module"
In my case, I was getting this error message with an index.d.ts file generated by the TypeScript compiler. The problem was that I'd...
Read more >
Gatsby: .../reference/release-notes/v4.18/index.md | Fossies
By default, it's generated in the src/gatsby-types.d.ts location. ... we disabled DEV_SSR flag because getServerData was not properly handled.
Read more >
Gatsby Changelog | 5.3.0
Fix store not containing auth credentials, via PR #37006. gatsby-transformer-csv : ... By default, it's generated in the src/gatsby-types.d.ts location.
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