Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
phunguyen19 opened this issue Jan 7, 2019 · 15 comments

Comments

@phunguyen19
Copy link

phunguyen19 commented Jan 7, 2019

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 
@fuqihan
Copy link

fuqihan commented Jan 9, 2019

Have this problem in linux,but windows nothing.

@SqueezeToyAliens
Copy link

Having the same problem on Windows.

Any idea?

@fbrbovic
Copy link

same problem here

@workoo
Copy link

workoo commented Jan 11, 2019

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

@nikitakot
Copy link

same issue, Mac

@sgraham785
Copy link

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+

@phunguyen19
Copy link
Author

@sgraham785 It works. Thanks. But I this issue should be kept opened.

@kamilmysliwiec
Copy link
Member

Should be fixed in 5.5.1

@jon301
Copy link

jon301 commented Feb 4, 2019

I still get this error in 5.5.1

@yangchongduo
Copy link

No fix, why should I close it?

@phunguyen19
Copy link
Author

It should not be closed.

@kamilmysliwiec
Copy link
Member

I have just published 5.5.2 Could you check now?

@yangchongduo
Copy link

Already fixed

@phunguyen19
Copy link
Author

It's fixed. So, this bug can be closed.

@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants