-
Notifications
You must be signed in to change notification settings - Fork 56
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
Make TypeScript type definitions from application schema work with Imports from Prisma #93
Comments
Hi @nickluger, I've just tried to reproduce this problem locally but it's working for me. Can you provide a repo with a minimal reproduction? Ideally with pinned versions. |
Was busy, but there you go: https://github.com/nickluger/graphql-import-from-prisma |
@kbrandwijk from looking into this, the problem seems to be in the Can you push a fix for this? This should solve @nickluger's problem. :) |
@nickluger this should be fixed by installing I was also talking to @kbrandwijk via Slack who suggested to use |
@nickluger Even though the latest app:
schemaPath: "src/schema.graphql"
extensions:
prepare-bundle: src/generated/app.graphql
prepare-binding:
output: src/generated/app.ts
generator: binding-ts
endpoints:
default: "http://localhost:4000" Now you can use the schema with imports already processed ( |
That solved the issue. Big thanks go to you @kbrandwijk and @schickling . |
Would it make sense to make this configuration the default one for |
I don't think it's the default use case that people want to get a binding for their actual GraphQL server (at least when getting started outside of a microservice architecture). Do you agree @nickluger? |
Personally, i would use it in every TypeScript project. I cannot imagine a reason not to have types for my models. Come in handy for seeding in tests for example. Also i re-import the types in the resolver files and set them as return types. createItem: async (parent, args: CreateItemInput, ctx: Context, info): Promise<Item>
// i see TS warnings now, e.g. when i miss to return an Item somewhere in the resolver But i cannot speak for default use cases. Might be overkill for smaller projects. |
@nickluger commented on Fri Feb 23 2018
prisma.graphql
in it:or just
yarn graphql prepare
if you have a proper definition in yourgraphqlconfig.yml
Mine looks like this
Result:
The text was updated successfully, but these errors were encountered: