gatsby-typescript icon indicating copy to clipboard operation
gatsby-typescript copied to clipboard

[codegen] Detach codegen from gatsby lifecycle

Open d4rekanguok opened this issue 5 years ago • 2 comments

Not sure if this should be the way to move forward. This will allow us to provide a smoother experience for 100% typescrip codebase, i.e generating typings for queries in both gatsby-node and src/**/*.ts{x}.

Current problems:

  • Gatsby don't watch gatsby-node, or files outside of src
  • Typegen doesn't happen until onPostBootstrap. If user changes their query in gatsby-node and the new type is not yet generated, error will be thrown & prevent a new build.

We don't have to go heavy on this, i.e creating a separate process. Perhaps a webpack plugin? Not sure yet ... need some more thinking...

Also, I wish we knew a bit more about Gatsby's plan on supporting TS in v3! :)

d4rekanguok avatar Mar 24 '20 09:03 d4rekanguok

Hey - is there any movement on this. I would like to generate types without running a build or dev. Is it possible?

ChrisSargent avatar Jul 19 '21 15:07 ChrisSargent

My team, too, is trying to figure out how to do this too.

DevanB avatar Dec 14 '21 19:12 DevanB