graphql: Error in compilation: TS2430: Interface 'GqlModuleOptions' incorrectly extends interface Pick<....>

I’m submitting a…


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request

Current behavior

I try using npm run prestart:prod to compile code and get the error

node_modules/@nestjs/graphql/dist/interfaces/gql-module-options.interface.d.ts:7:18 - error TS2430: Interface 'GqlModuleOptions' incorrectly extends interface 'Pick<Config, "modules" | "context" | "cache" | "debug" | "plugins" | "schema" | "formatError" | "rootValue" | "validationRules" | "formatResponse" | "fieldResolver" | "tracing" | ... 12 more ... | "playground">'.
  Types of property 'schemaDirectives' are incompatible.
    Type '{ [name: string]: typeof SchemaDirectiveVisitor; }' is not assignable to type 'Record<string, typeof SchemaDirectiveVisitor>'.
      Index signatures are incompatible.
        Type 'typeof import("node_modules/@nestjs/graphql/node_modules/graphql-tools/dist/schemaVisitor").SchemaDirectiveVisitor' is not assignable to type 'typeof import("node_modules/graphql-tools/dist/schemaVisitor").SchemaDirectiveVisitor'.
          Property 'getDeclaredDirectives' is protected but type 'SchemaDirectiveVisitor' is not a class derived from 'SchemaDirectiveVisitor'.

7 export interface GqlModuleOptions extends Omit<Config, 'typeDefs'>, Partial<Pick<ServerRegistration, 'onHealthCheck' | 'disableHealthCheck' | 'path' | 'cors' | 'bodyParserConfig'>> {

Environment


"@nestjs/common": "^5.1.0"
"@nestjs/core": "^5.1.0"
"@nestjs/graphql": "^5.4.0"
"graphql": "^14.0.2"
"graphql-tools": "^4.0.3"
"graphql-type-json": "^0.2.1"
"typescript": "^3.0.1"

tsconfig.json


{
  "compilerOptions": {
    "module": "commonjs",
    "lib": ["esnext", "dom"],
    "declaration": true,
    "noImplicitAny": false,
    "removeComments": true,
    "noLib": false,
    "allowSyntheticDefaultImports": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es6",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./src"
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "**/*.spec.ts"]
}

For Tooling issues:


- Node version: v10.14.2  
- Platform: Mac 

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 9
  • Comments: 15 (2 by maintainers)

Most upvoted comments

the quick fix is: ` // node_modules@nestjs\graphql\dist\interfaces\gql-module-options.interface.d.ts

import { Type } from ‘@nestjs/common’; import { ModuleMetadata } from ‘@nestjs/common/interfaces’; import { Config, IResolverValidationOptions, ServerRegistration, SchemaDirectiveVisitor } from ‘apollo-server-express’; import { IDirectiveResolvers, } from ‘graphql-tools’; ` import the SchemaDirectiveVisitor from apollo-server-express instead of graphql-tools ref#this

I have just published 5.5.2 Could you check now?

Already fixed

No fix, why should I close it?

the issue seems to only happen in version 5.5.0 you can set these to 5.4.0:

"@nestjs/common": "5.4.0"
"@nestjs/core": "5.4.0"
"@nestjs/graphql": "5.4.0"

no ^

this compiles for me. the issue that @workoo refers to is the true culprit and this package should look to upgrade from graphql-tools: 3.1.1 to 4+

same issue, Mac

Have this problem in linux,but windows nothing.