typescriptgraphqlapolloapollo-servergraphql-tools

Can't import IResolvers from graphql-tools


import { IResolvers } from "graphql-tools"; I was trying to import IResolvers from graphql-tools and got the message Module: '"../node_modules/graphql-tools"' has no exported member 'IResolvers'.

My dependencies are:"apollo-server-express": "^3.1.2","graphql": "^15.5.1", "graphql-tools": "^8.1.0"

Is this because I am on apollo 3 instead of apollo 2 which has IResolver?


Solution

  • From the Migrating to Apollo Server 3#Removed exports doc, many types, and interfaces has been removed including IResolvers interface.

    There are two solutions:

    1. Run npm install graphql-tools@4.x and import the symbol from graphql-tools.
    2. Run npm install @graphql-tools/utils and import the IResolvers from @graphql-tools/utils

    codesandbox