1import { TypedDocumentNode } from '@graphql-typed-document-node/core';
2import { graphql } from './gql';
3
4export const PokemonFields = graphql(`
5 fragment pokemonFields on Pokemon {
6 id
7 name
8 attacks {
9 fast {
10 damage
11 name
12 }
13 }
14 }
15`)
16
17export const Pokemon = (data: any) => {
18 const pokemon = useFragment(PokemonFields, data);
19 return `hi ${pokemon.name}`;
20};
21
22export function useFragment<Type>(
23 _fragment: TypedDocumentNode<Type>,
24 data: any
25): Type {
26 return data;
27}