Nexus-plugin-prisma: Type 'NexusExtendTypeDef<TypeName>' is not assignable to type 'NexusInputObjectTypeDef<string>'.

Created on 19 Feb 2019  路  9Comments  路  Source: graphql-nexus/nexus-plugin-prisma

Getting some TS errors when I run tsc --project tsconfig.json

node_modules/nexus-prisma/dist/definitions/extendType.d.ts:10:151 - error TS2344: Type 'NexusExtendTypeDef<TypeName>' does not satisfy the constraint 'AllNexusNamedTypeDefs'.
  Type 'NexusExtendTypeDef<TypeName>' is not assignable to type 'NexusInputObjectTypeDef<string>'.
    Property 'config' is protected but type 'NexusExtendTypeDef<TypeName>' is not a class derived from 'NexusInputObjectTypeDef<TypeName>'.

my tsconfig.json

{
  "compilerOptions": {
    "lib": ["esnext", "dom"],
    "rootDir": "src",
    "outDir": "dist",
    // "strict": true,
    "sourceMap": true
  },
  "include": [
    "src/**/*"
  ]
}

Workaround till this is fixed

Add skipLibCheck: true to your tsconfig.json

typbug

Most helpful comment

Still having this issue.

All 9 comments

Hey there, this is indeed a problem related to nexus typings that should be solved soon! For now, would you mind enabling skipLibCheck: true in your tsconfig.json?

EDIT I'm not sure your problem is related to the one I'm talking after all. Could you please show me a snippet where the error is raised?

Thanks @weakky, adding skipLibCheck: true to my tsconfig did make the error go away. Here is the exact error being thrown:

> tsc --project tsconfig.json

node_modules/nexus-prisma/dist/definitions/extendType.d.ts:10:151 - error TS2344: Type 'NexusExtendTypeDef<TypeName>' does not satisfy the constraint 'AllNexusNamedTypeDefs'.
  Type 'NexusExtendTypeDef<TypeName>' is not assignable to type 'NexusInputObjectTypeDef<string>'.
    Property 'config' is protected but type 'NexusExtendTypeDef<TypeName>' is not a class derived from 'NexusInputObjectTypeDef<TypeName>'.

10 export declare function prismaExtendType<TypeName extends PrismaObjectTypeNames>(typeConfig: PrismaExtendTypeConfig<TypeName>): core.NexusWrappedType<core.NexusExtendTypeDef<TypeName>>;
                                                                                                                                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error.

There isn't much more information beyond that.

same issue here

Any update with this yet? Thanks!

Still having this issue.

Also running into this :confused:

For everyone still having this issue and until #6 is merged, a workaround for now is to add "skipLibCheck": true to your tsconfig.json. As its name suggests, this command will skip error checks in your modules (highly unsafe so use at your own discretion).

{
    "compilerOptions": {
      "target": "ES6",
      "moduleResolution": "node",
      "outDir": "dist",
      "sourceMap": true,
      "suppressImplicitAnyIndexErrors": true,
      "suppressExcessPropertyErrors": true,
      "strict": false,
      "removeComments": false,
      "lib": ["esnext", "dom"],
      "skipLibCheck": true,        <----- Add this line
      "types": [
        "node"
      ],
    },
    "include": [
        "src/**/*",
        "index.ts"
    ],
    "exclude": [ "dist", "./node_modules/*" ]
}

We will investigate if this is still an issue with the next version.

Hey there 馃憢,

I just tried running tsc with the example contained in the next version.

The only error that showed up is the following:

node_modules/subscriptions-transport-ws/dist/server.d.ts:2:28 - error TS7016: Could not find 
a declaration file for module 'ws'. '/Users/flavian/projects/prisma/nexus-prisma/example/node
_modules/ws/index.js' implicitly has an 'any' type.
  Try `npm install @types/ws` if it exists or add a new declaration (.d.ts) file containing `
declare module 'ws';`

2 import * as WebSocket from 'ws';

It therefore looks like this is no longer an issue in the next version.

Closing now

Was this page helpful?
0 / 5 - 0 ratings