New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typings in Prisma client only work for the first model in the schema #7014
Comments
Ok, that is really weird. I know this sounds stupid, but have your fully restarted your VSCode and possibly computer? The language server sometimes is a bit stubborn... |
Hi @janpio, thanks so much for taking the time to get back to me. It is weird! I upgraded and quit VSCode, restarted computer, deleted node_modules, npm installed and ran |
Not yet, but someone will soon try to use your reproduction and see if it happens for them as well. |
@janpio I tried it on a different machine and the problem persisted. Seems that it is not my local machine after all. The repos I tried were the prisma example repos for graphql-express and heroku deployment. Same exact problem with both repos on both of my machines: only the first model in the schema can make use of the Prisma client typings. All subsequent models are untyped with the same error described in my original issue. |
WOW. Thank you for pointing out the obvious @pantharshit00!!! Problem solved. |
Ah, I'm glad that solved the issue, Thanks! |
Can we do anything to catch this @pantharshit00? Either in our tooling or VSCode? |
There is already an issue about this: #5728 It will block the generator process when it detects user is using the wrong TS version . |
Probably you're using Docker, and inside container, the generated types aren't present. You can fix this mapping the directory |
Bug description
Typings in Prisma client only work for the CRUD operations of the first model in
node_modules/.prisma/client/index.d.ts
.The typings for the first model in the schema work fine. i.e.
prisma.user.createMany()
are auto completed with TS as I type. Hovering overcreateMany
brings me to the typed definition in prisma clientindex.d.ts
file.The same is not true for all other models in the schema. i.e.
prisma.property.createMany
stops auto completing after.property
and hovering overcreateMany
displays typeany
.If I go to
node_modules/.prisma/client/index.d.ts
I see thatPrisma.PropertyDelegate
has TS error ofnode_modules/.prisma/client/index".Prisma' has no exported member 'PropertyDelegate'
.However,
PropertyDelegate
DOES exist in the file. The code will run successfully but I get none of the benefits of using TS with Prisma client.Why would all
XDelegate
types after the first model appear to TS as not existing?How to reproduce
I created a repo to reproduce the error
npm install
prisma.post.createMany
- it will not workprisma.user.createMany
- it will work because it is first model in schemaExpected behavior
I expect prisma client typings to work for all models - not just the first model in the schema.
Prisma information
Schema
Queries
Typings work and autocomplete for model
Typings DO NOT work or autocomplete for model
Environment & setup
The text was updated successfully, but these errors were encountered: