···11+import { gql } from '@urql/core';
22+33+export const PokemonFields = gql`
44+ fragment pokemonFields on Pokemon {
55+ id
66+ name
77+ }
88+` as typeof import('./Pokemon.generated').PokemonFieldsFragmentDoc
···6262};
63636464/** Elemental property associated with either a Pokémon or one of their moves. */
6565-export enum PokemonType {
6666- Bug = 'Bug',
6767- Dark = 'Dark',
6868- Dragon = 'Dragon',
6969- Electric = 'Electric',
7070- Fairy = 'Fairy',
7171- Fighting = 'Fighting',
7272- Fire = 'Fire',
7373- Flying = 'Flying',
7474- Ghost = 'Ghost',
7575- Grass = 'Grass',
7676- Ground = 'Ground',
7777- Ice = 'Ice',
7878- Normal = 'Normal',
7979- Poison = 'Poison',
8080- Psychic = 'Psychic',
8181- Rock = 'Rock',
8282- Steel = 'Steel',
8383- Water = 'Water'
8484-}
6565+export type PokemonType =
6666+ | 'Bug'
6767+ | 'Dark'
6868+ | 'Dragon'
6969+ | 'Electric'
7070+ | 'Fairy'
7171+ | 'Fighting'
7272+ | 'Fire'
7373+ | 'Flying'
7474+ | 'Ghost'
7575+ | 'Grass'
7676+ | 'Ground'
7777+ | 'Ice'
7878+ | 'Normal'
7979+ | 'Poison'
8080+ | 'Psychic'
8181+ | 'Rock'
8282+ | 'Steel'
8383+ | 'Water';
85848685export type Query = {
8786 __typename?: 'Query';
-20
example/src/fragment.ts
···11-import { gql } from '@urql/core'
22-33-export const PokemonFields = gql`
44- fragment pokemonFields on Pokemon {
55- id
66- name
77- }
88-` as typeof import('./fragment.generated').PokemonFieldsFragmentDoc
99-// TODO: how to type
1010-// export const PokemonFields = gql`
1111-// fragment pokemonFields on Pokemon {
1212-// id
1313-// name
1414-// }
1515-1616-// fragment morePokemonFields on Pokemon {
1717-// id
1818-// name
1919-// }
2020-// ` as typeof import('./fragment.generated').PokemonsDocument
+5-11
example/src/index.generated.ts
···104104export type PokemonsQueryVariables = Exact<{ [key: string]: never; }>;
105105106106107107-export type PokemonsQuery = { __typename?: 'Query', pokemons?: Array<{ __typename?: 'Pokemon', id: string, name: string } | null> | null };
107107+export type PokemonsQuery = { __typename?: 'Query', pokemons?: Array<{ __typename: 'Pokemon', id: string, name: string } | null> | null };
108108109109export type PokemonFieldsFragment = { __typename?: 'Pokemon', id: string, name: string };
110110111111-export type PokemonQueryVariables = Exact<{ [key: string]: never; }>;
112112-113113-114114-export type PokemonQuery = { __typename?: 'Query', pokemon?: { __typename?: 'Pokemon', id: string, name: string } | null };
115115-116116-export type DonkemonQueryVariables = Exact<{
111111+export type PokemonQueryVariables = Exact<{
117112 id: Scalars['ID'];
118113}>;
119114120115121121-export type DonkemonQuery = { __typename?: 'Query', pokemon?: { __typename?: 'Pokemon', id: string } | null };
116116+export type PokemonQuery = { __typename?: 'Query', pokemon?: { __typename: 'Pokemon', id: string, name: string } | null };
122117123118export const PokemonFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"pokemonFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Pokemon"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]} as unknown as DocumentNode<PokemonFieldsFragment, unknown>;
124124-export const PokemonsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Pokemons"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"pokemons"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<PokemonsQuery, PokemonsQueryVariables>;
125125-export const PokemonDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Pokemon"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"pokemon"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"StringValue","value":"1","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"pokemonFields"}}]}}]}},...PokemonFieldsFragmentDoc.definitions]} as unknown as DocumentNode<PokemonQuery, PokemonQueryVariables>;
126126-export const DonkemonDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Donkemon"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"pokemon"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<DonkemonQuery, DonkemonQueryVariables>;119119+export const PokemonsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Pokemons"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"pokemons"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"pokemonFields"}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}}]}}]}},...PokemonFieldsFragmentDoc.definitions]} as unknown as DocumentNode<PokemonsQuery, PokemonsQueryVariables>;
120120+export const PokemonDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Pokemon"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"pokemon"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}}]}}]}}]} as unknown as DocumentNode<PokemonQuery, PokemonQueryVariables>;