Run time issue with `typegraphql-prisma` . I follo...
# orm-help
j
Run time issue with
typegraphql-prisma
. I followed the doc of
typegraphql-prisma
. What I installed as per doc of typegraphql-prisma is
Copy code
npm i -D typegraphql-prisma @types/graphql-fields
npm i graphql-scalars graphql-fields
I also configured the default output folder
Copy code
generator typegraphql {
  provider = "typegraphql-prisma"
  output   = "../prisma/generated/type-graphql"
}
my tsconfig.json is
Copy code
{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "lib": ["dom", "es6", "es2017", "esnext.asynciterable"],
    "sourceMap": true,
    "outDir": "./dist",
    "moduleResolution": "node",
    "declaration": false,
    // "esModuleInterop": true,

    "composite": false,
    "removeComments": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "noImplicitThis": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    // "allowSyntheticDefaultImports": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "skipLibCheck": true,
    "baseUrl": "."
    // "rootDir": "src"
  },
  "exclude": ["node_modules"],
  "include": ["./src/**/*.tsx", "./src/**/*.ts"]
}
But now When i try to start my server with
npm start
(ts-node src/index.ts). i get the following error
Copy code
D:\Work\coding\testing\rough\ben_Typegraphql\node_modules\ts-node\src\index.ts:587
    return new TSError(diagnosticText, diagnosticCodes);
           ^
TSError: ⨯ Unable to compile TypeScript:
prisma/generated/type-graphql/models/User.ts:2:1 - error TS6133: 'GraphQLScalars' is declared but its value is never read.

2 import * as GraphQLScalars from "graphql-scalars";
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prisma/generated/type-graphql/models/User.ts:3:1 - error TS6133: 'Prisma' is declared but its value is never read.

3 import { Prisma } from "@prisma/client";
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prisma/generated/type-graphql/models/User.ts:4:1 - error TS6133: 'DecimalJSScalar' is declared but its value is never read.

4 import { DecimalJSScalar } from "../scalars";
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    at createTSError (D:\Work\coding\testing\rough\ben_Typegraphql\node_modules\ts-node\src\index.ts:587:12)
    at reportTSError (D:\Work\coding\testing\rough\ben_Typegraphql\node_modules\ts-node\src\index.ts:591:19)
    at getOutput (D:\Work\coding\testing\rough\ben_Typegraphql\node_modules\ts-node\src\index.ts:921:36)
    at Object.compile (D:\Work\coding\testing\rough\ben_Typegraphql\node_modules\ts-node\src\index.ts:1189:32)
    at Module.m._compile (D:\Work\coding\testing\rough\ben_Typegraphql\node_modules\ts-node\src\index.ts:1295:42)
    at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Object.require.extensions.<computed> [as .ts] (D:\Work\coding\testing\rough\ben_Typegraphql\node_modules\ts-node\src\index.ts:1298:12)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
r
I would suggest checking out the examples here and check what’s the difference.
j
Thanks. Looking into it
👍 1
I found the issue. But i dont know how it relates. When i removed the line
output = "../prisma/generated/type-graphql"
then the issue is gone. Why is that?
r
Because your
tsconfig
has only
src
in
include
and not
prisma
.
💯 1
j
Oops. Thank for figuring it out. That is the snippet taken from @Ben Awad typegraphql git repository as shown in his typegraphql tutorial. I am not so confident in typescript yet. What should i edit in
tsconfig
to make it work with configuring default output folder
r
If you want to keep the folder that you had previously then add
prisma
to
include
in
tsconfig
.
1