@gql2ts/from-query
Version:
generate typescript interfaces from a graphql schema and query
18 lines (17 loc) • 706 B
TypeScript
/**
* @file This is a work-in-progress attempt to flatten queries, in order to be able to process them easier
* This could in the future be used for some optimization cases - at least parts of it can
*
* This was a quick hack I wrote on the couch to explore. This is not final and should not be used :D
* (but it does seem to work without issues)
*/
import { DocumentNode, GraphQLSchema } from "graphql";
/**
* This function flattens queries by:
* - inlining FragmentSpreads
* - flattening fragments of the same type
*
* @param document A parsed Query
* @param schema A parsed Schema
*/
export declare const flattenFragments: (document: DocumentNode, schema: GraphQLSchema) => DocumentNode;