0no-co / gql.tada

🪄 Magical GraphQL query engine for TypeScript
https://gql-tada.0no.co
MIT License
2.52k stars 41 forks source link

feat(cli): cache typescript types #183

Closed JoviDeCroock closed 4 months ago

JoviDeCroock commented 4 months ago

Resolves #160

Summary

This compiles types Ahead Of Time so that we can have a cache and that during dev TypeScript has less to worry about, current output looks like:

{
  'graphql(`\r\n  fragment PokemonItem on Pokemon {\r\n    id\r\n    name\r\n  }\r\n`)': 'TadaDocumentNode<{ name: string; id: string; }, {}, { fragment: "PokemonItem"; on: "Pokemon"; masked: true; }>',
  'graphql(`\r\n  query Pokemons ($limit: Int = 10) {\r\n    pokemons(limit: $limit) {\r\n      id\r\n      ...PokemonItem\r\n    }\r\n  }\r\n`, [PokemonItemFragment])': 'TadaDocumentNode<{ pokemons: ({ [$tada.fragmentRefs]: { PokemonItem: "Pokemon"; }; id: string; } | null)[] | null; 
}, { limit?: number | null | undefined; }, void>'
}
changeset-bot[bot] commented 4 months ago

🦋 Changeset detected

Latest commit: f662fb19e33e9ba08dea32c37f673f3ae7d50020

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR