Open emroot opened 4 years ago
I've been trying to debug this same issue over the past few hours.
"dependencies": {
"@nexus/schema": "^0.13.1",
"@prisma/client": "2.0.0-beta.4",
"apollo-server": "^2.13.0",
"apollo-server-express": "^2.13.0",
"bcrypt": "^4.0.1",
"graphql": "14.5.0",
"jsonwebtoken": "^8.5.1",
"nexus": "^0.21.0",
"nexus-prisma": "^0.13.0"
},
"devDependencies": {
"@prisma/cli": "2.0.0-beta.4",
"@types/bcrypt": "^3.0.0",
"@types/jsonwebtoken": "^8.3.9",
"ts-node": "^8.10.1",
"ts-node-dev": "^1.0.0-pre.44",
"typescript": "^3.9.2"
}
@moderndegree This is how I solved my issue:
Before in my scheme.ts, this is how things looked like:
export const schema = makeSchema({
types: [
...
],
plugins: [
// @ts-ignore
nexusPrismaPlugin({
outputs: {
typegen: join(__dirname, '/generated/nexus-types.ts'),
},
}),
],
outputs: {
schema: join(__dirname, '/schema.graphql'),
typegen: join(__dirname, '/generated/nexus.ts'),
},
typegenAutoConfig: {
contextType: 't.GraphqlContext',
sources: [
{
source: '@prisma/client',
alias: 'prisma',
},
{
source: require.resolve('./types'),
alias: 't',
},
],
},
});
I added this to my tsconfig.json
"skipLibCheck": true
and made sure to delete the old typescript generated nexus files and instead generate definition files by renaming my old files nexus*.ts
→ nexus*.d.ts
export const schema = makeSchema({
types: [
...
],
plugins: [
// @ts-ignore
nexusPrismaPlugin({
outputs: {
typegen: join(__dirname, '/generated/nexus-types.d.ts'),
},
}),
],
outputs: {
schema: join(__dirname, '/schema.graphql'),
typegen: join(__dirname, '/generated/nexus.d.ts'),
},
typegenAutoConfig: {
contextType: 't.GraphqlContext',
sources: [
{
source: '@prisma/client',
alias: 'prisma',
},
{
source: require.resolve('./types'),
alias: 't',
},
],
},
});
Thanks for the tip. Unfortunately,this solution disables some of the beneficial type checking that TypeScript affords us. It unblocks me but I would love to see this issue resolved.
@emroot I am still testing my theory but I am 99% sure the problem is with the typescript
version. If I change ^3.8.3
to 3.8.3
, it seems to fix the issue. Without locking the version down, we end up getting 3.9.2
, which is apparently not compatible.
There were definitely some breaking changes in 3.9 that could cause these issues: https://github.com/microsoft/TypeScript/wiki/Breaking-Changes
Can confirm @moderndegree observation: I also started seeing this problem after upgrading TypeScript from 3.8 to 3.9.
I just started getting this error. Out of the blue. I'm suspecting it might have to do my node_modules.
my package.json