function inlineFragmentSpread(spread, document) {
  const fragment = document.definitions.find(
    def =>
      def.kind === Kind.FRAGMENT_DEFINITION &&
      def.name.value === spread.name.value
  )
  if (!fragment) {
    throw new Error(`Fragment ${spread.name.value} does not exist`)
  }
  const { typeCondition, selectionSet } = fragment
  return {
    kind: Kind.INLINE_FRAGMENT,
    typeCondition,
    selectionSet,
    directives: spread.directives,
  }
}
Replaces fragment spread with inline fragment

Example:
  query { ...Spread }
  fragment Spread on Query { bar }

Transforms to:
  query { ... on Query { bar } }