Mirror: TypeScript LSP plugin that finds GraphQL documents in your code and provides diagnostics, auto-complete and hover-information.
at main 686 B view raw
1import { graphql } from './graphql'; 2 3const pokemonFragment = graphql(` 4 fragment PokemonBasicInfo on Pokemon { 5 id 6 name 7 } 8`); 9 10// This query correctly includes the fragment as a dep 11const FirstQuery = graphql( 12 ` 13 query FirstQuery { 14 pokemons(limit: 1) { 15 ...PokemonBasicInfo 16 } 17 } 18 `, 19 [pokemonFragment] 20); 21 22// This query uses the fragment but DOES NOT include it as a dep 23// It should show an error, but currently doesn't because the fragment 24// was already added as a dep in FirstQuery above 25const SecondQuery = graphql(` 26 query SecondQuery { 27 pokemons(limit: 2) { 28 ...PokemonBasicInfo 29 } 30 } 31`); 32 33export { FirstQuery, SecondQuery };