If you build apps using Gatsby (opens in a new tab), you can use its built-in feature called GraphQL Typegen (opens in a new tab). 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 (opens in a new tab).
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: