Skip to content
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

Specify unknown Type For Relational Field Resolvers In Generated Services #5230

Closed
wants to merge 1 commit into from

Conversation

tubbo
Copy link

@tubbo tubbo commented Apr 18, 2022

When services are generated for models that have relations, Redwood generates field resolvers for those relations. This is very helpful, but defaults to showing alerts in a developer's editor for those lines of code on a TypeScript project. These alerts can be avoided by marking the type as unknown, since at the moment that's what it is, and allow users to add type definitions to the arguments if any arguments are added to the field in GraphQL.

When services are generated for models that have relations, Redwood
generates field resolvers for those relations. This is very helpful, but
defaults to showing alerts in a developer's editor for those lines of
code. These alerts can be avoided by marking the type as `unknown`,
since at the moment that's what it is, and allow users to add type
definitions to the arguments if any arguments are added to the field in
GraphQL.
@netlify
Copy link

netlify bot commented Apr 18, 2022

Deploy Preview for redwoodjs-docs canceled.

Name Link
🔨 Latest commit ca1a12b
🔍 Latest deploy log https://app.netlify.com/sites/redwoodjs-docs/deploys/625da32ef76aed00086be20b

@thedavidprice
Copy link
Contributor

Thanks, @tubbo! Is there a prior conversation on Discord/Forums that provide some background here? (Fine if not.) Asking because I think we have several related things in motion about this right now — want to make sure they're all in sync.

Looping in @jtoar @dthyresson

@tubbo
Copy link
Author

tubbo commented Apr 18, 2022

@thedavidprice

Is there a prior conversation on Discord/Forums that provide some background here?

No, it's just something I noticed I had to do every time I generated a new service object. Other than SDLs not generating their relations properly (which seems like a big chunk of work that's already been started, yay!) this is the only other gripe I have with Redwood's generators, that it generates code that causes alerts in my editor.

want to make sure they're all in sync.

This was an epic troll because I clicked this link thinking it would go to the "several related things in motion". I tip my hat to you, sir.

@orta
Copy link
Contributor

orta commented Apr 18, 2022

This PR won't be needed after #5216 👍🏻

@thedavidprice
Copy link
Contributor

This was an epic troll because I clicked this link thinking it would go to the "several related things in motion". I tip my hat to you, sir.

haha! gotta get the fun going on a Monday! Also, what better way to welcome people to the community, right? 😂

@tubbo tubbo closed this Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants