`buildSubgraphSchema` type signature difficult to work with

I’m finding buildSubgraphSchema wildly difficult to work with. I’m working on the Neo4j GraphQL Library (GitHub - neo4j/graphql: A GraphQL to Cypher query execution layer for Neo4j and JavaScript GraphQL implementations.), which is a library which accepts simple type definitions defining a data model and augments them with resolvers and all of the types needed to query data in a Neo4j database.

I’m building a plugin for the library which will generate the __resolveReference resolvers needed for a Federation router. I want this plugin to be part of the augmentation flow, rather than completely redirecting logic when we “realise” Federation is happening.

We currently have a getSchema function which builds a schema using makeExecutableSchema from graphql-tools and returns it. This has already been an obstacle given that buildSubgraphSchema is so different, so we added a new function to return unbuilt type definitions and resolvers. We used TypeSource and IResolvers from graphql-tools, as once again, this is essentially the industry standard for creating GraphQL schemas.

However, here I am again struggling with Apollo’s custom typings, because buildSubgraphSchema accepts a DocumentNode and GraphQLResolverMap. DocumentNode I can kind of see… But the GraphQLResolverMap is proving to be a nightmare. It’s not an option for us to use an Apollo specific type for our generic export, and we don’t want our users to have to do a tonne of manipulation to the IResolvers type to get it working with buildSubgraphSchema. Any suggestions here?