If you build apps using Gatsby, you can use its built-in feature called GraphQL Typegen. Under the hood it uses the GraphQL Code Generator to generate TypeScript types, but you don't need to set anything up other than enabling an option.
It also sets up everything needed for GraphQL Config.
Gatsby's GraphQL Typegen feature is solving most common use cases. If you find yourself limited by its features you should open a feature request or trying using one of these community plugins: