I want to try out `graphqlgen` too, but where coul...
# orm-help
h
I want to try out
graphqlgen
too, but where could I get/generate
./src/types.ts:
? I am using JS prisma client. Should I just mirror the
datamodal
to
types.ts
?
w
Hey, The
./src/types.ts
file is something you have to create by hand. It should contains all the ‘hand-written’ typescript types that maps your GraphQL types. If you’re too lazy to do so, what you can do is to create an empty
./src/types.ts
file, and run
graphqlgen
. You will be given as output all the missing typescript types that you need to c&p into your
./src/types.ts
file. Be aware that for now, all types that aren’t scalar are outputed as
any
type, which you should manually replace by their correct types. Hopefully that clarifies your question!
h
Thank you. So that means my
types.ts
should be mirroring
schema.graphql
?
w
Your
types.ts
file should indeed mirror the types from your prisma api, but should not necessarily mirror the types from your graphql server on top of prisma. In fact, if you are using
prisma-client
, which I forgot to ask you, then you can just use the generated './src/generated/prisma-client/index.ts' file instead of creating your own
types.ts
file!
h
thanks so much!