Prisma example code needs explicit types specified for PostsResolver
See original GitHub issueI’m submitting a…
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
/mnt/d/dev/_learn/nest/repo/sample/22-graphql-prisma/node_modules/type-graphql/dist/helpers/findType.js:17
throw new errors_1.NoExplicitTypeError(prototype.constructor.name, propertyKey, parameterIndex);
^
Error: You need to provide explicit type for PostsResolver#getPosts parameter #0 !
at Object.findType (/mnt/d/dev/_learn/nest/repo/sample/22-graphql-prisma/node_modules/type-graphql/dist/helpers/findType.js:17:15)
at Object.getParamInfo (/mnt/d/dev/_learn/nest/repo/sample/22-graphql-prisma/node_modules/type-graphql/dist/helpers/params.js:9:49)
at Args (/mnt/d/dev/_learn/nest/repo/sample/22-graphql-prisma/node_modules/type-graphql/dist/decorators/Args.js:9:120)
at Args (/mnt/d/dev/_learn/nest/repo/sample/22-graphql-prisma/node_modules/@nestjs/graphql/dist/decorators/args.decorator.js:27:49)
at /mnt/d/dev/_learn/nest/repo/sample/22-graphql-prisma/src/posts/posts.resolver.ts:12:37
at DecorateProperty (/mnt/d/dev/_learn/nest/repo/sample/22-graphql-prisma/node_modules/reflect-metadata/Reflect.js:553:33)
at Object.decorate (/mnt/d/dev/_learn/nest/repo/sample/22-graphql-prisma/node_modules/reflect-metadata/Reflect.js:123:24)
at __decorate (/mnt/d/dev/_learn/nest/repo/sample/22-graphql-prisma/src/posts/posts.resolver.ts:4:92)
at Object.<anonymous> (/mnt/d/dev/_learn/nest/repo/sample/22-graphql-prisma/src/posts/posts.resolver.ts:20:3)
at Module._compile (module.js:653:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nest-typescript-starter@1.0.0 start: `ts-node src/main`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nest-typescript-starter@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/delmadord/.npm/_logs/2019-05-13T22_59_07_077Z-debug.log
Expected behavior
Working Nest + Prisma example
Minimal reproduction of the problem with instructions
git clone https://github.com/nestjs/nest.git
cd nest/sample/22-graphql-prisma
npm install
# npm WARN @nestjs/graphql@6.0.5 requires a peer of type-graphql@^0.17.0 but none is installed. You must install peer dependencies yourself.
npm install --save type-graphql@^0.17.0
npm run build
npm run start
What is the motivation / use case for changing the behavior?
The sample code does not run on my machine. Related: https://github.com/19majkel94/type-graphql/issues/135
Environment
Bothe environments output the same error, master on 0137ebce0034eada279abae64231789bd11dfbe1
- Windows node v8.10.0
- WSL Bash node v8.16.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
A Guide to Common Resolver Patterns - Prisma Tutorials
This tutorial gives an overview about common scenarios you might encounter when implementing your GraphQL server with graphql-yoga and Prisma.
Read more >Advanced type safety (Reference) - Prisma
The generated code for Prisma Client contains several helpful types and utilities that you can use to make your application more type-safe.
Read more >Upgrading from Prisma 1 with prisma-binding to SDL-first
Overview. This upgrade guide describes how to migrate a Node.js project that's based on Prisma 1 and uses prisma-binding to implement a GraphQL...
Read more >Operating against partial structures of your model types - Prisma
This page documents various scenarios for using the generated types from the Prisma ... For example, assume you have the following User and...
Read more >Prisma schema API (Reference)
Examples. Specify a PostgreSQL data source. In this example, the target ... When running a Prisma CLI command that needs the database connection...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
thansk for the reply. the @nestjs/graphql package is at version 6.2.4
this is my package.json :
I have the same error than @peterbabic when I run npm run start:
Update your packages to the latest
@nestjs/graphql