nexus-plugin-prisma icon indicating copy to clipboard operation
nexus-plugin-prisma copied to clipboard

[email protected] not compatible with [email protected]?

Open jondewoo opened this issue 5 years ago • 3 comments

Hi,

When using [email protected] alongside with [email protected], I'm getting this error in Nexus.makeSchema():

src/schema/index.ts:40:15 - error TS2322: Type 'import("node_modules/nexus-prisma/node_modules/nexus/dist/plugin").NexusPlugin' is not assignable to type 'import("node_modules/nexus/dist/plugin").NexusPlugin'.
  The types of 'config.fieldDefTypes' are incompatible between these types.
    Type 'string | import("node_modules/nexus-prisma/node_modules/nexus/dist/utils").PrintedGenTyping | import("node_modules/nexus-prisma/node_modules/nexus/dist/plugin").StringLike[]' is not assignable to type 'string | import("node_modules/nexus/dist/utils").PrintedGenTyping | import("node_modules/nexus/dist/plugin").StringLike[]'.
      Type 'PrintedGenTyping' is not assignable to type 'string | PrintedGenTyping | StringLike[]'.
        Type 'import("node_modules/nexus-prisma/node_modules/nexus/dist/utils").PrintedGenTyping' is not assignable to type 'import("node_modules/nexus/dist/utils").PrintedGenTyping'.
          Property 'config' is protected but type 'PrintedGenTyping' is not a class derived from 'PrintedGenTyping'.
40     plugins: [NexusPrisma.nexusPrismaPlugin()],

Reverting to [email protected] solves it.

jondewoo avatar Dec 20 '19 16:12 jondewoo

I'm getting this problem even though I'm explicitly setting [email protected] and [email protected]. It seems to be pulling something too new:

yarn list|grep nexus
│  ├─ [email protected]
│  ├─ [email protected]
├─ [email protected]
│  ├─ nexus@^0.12.0-rc.4
│  ├─ [email protected]
├─ [email protected]

kokokenada avatar Feb 12 '20 21:02 kokokenada

EDIT:

Nevermind, lol... Just upgraded.

import {makeSchema}  from  '@nexus/schema'

I'm having the same problem, here is my config:

require('dotenv').config()
import * as path from 'path'

import { makeSchema } from 'nexus'
import { nexusPrismaPlugin } from 'nexus-prisma'
import { applyMiddleware } from 'graphql-middleware'

import { middleware } from './middleware'

import * as types from './types'

const executableSchema = makeSchema({
  types,
  shouldGenerateArtifacts: process.env.NODE_ENV === 'development',
  plugins: [
    nexusPrismaPlugin({
      shouldGenerateArtifacts: true,
    }),
  ],
  typegenAutoConfig: {
    contextType: 'C.Context',
    sources: [
      {
        source: path.join(__dirname, 'types', 'Context.ts'),
        alias: 'C',
      },
    ],
  },
  outputs: {
    typegen: path.join(
      __dirname,
      '../node_modules/@types/nexus-typegen/index.d.ts',
    ),
  },
})

export const schema = applyMiddleware(executableSchema, ...middleware)

package.json:

...
    "@nexus/schema": "^0.13.1",
    "@prisma/client": "2.0.0-beta.1",
...

hdngr avatar Apr 18 '20 13:04 hdngr

I am having the same problem!

    "@nexus/schema": "^0.20.1",
    "nexus": "^1.1.0",
    "nexus-plugin-prisma": "^0.35.0"

melanke avatar Sep 06 '21 21:09 melanke