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

feat(server): add inferProcedureBuilderResolverOptions helper #5475

Merged
merged 17 commits into from
Feb 15, 2024

Conversation

dBianchii
Copy link
Contributor

@dBianchii dBianchii commented Feb 12, 2024

Closes #5473

🎯 Changes

Added inferProcedureBuilderContext type helper export for infering the context type of a specific procedure builder.
Added an example of how to use it on examples/next-big-router
Simplified internal code to use a single AnyProcedureBuilder exported type without redeclaration

✅ Checklist

  • I have followed the steps listed in the Contributing guide.
  • If necessary, I have added documentation related to the changes made.
  • I have added or updated the tests related to the changes made.

I will gladly add documentation for it. However, I want to start working on docs only if maintainers decide this is something we're going to add to trpc

@dBianchii dBianchii requested review from a team as code owners February 12, 2024 18:36
Copy link

vercel bot commented Feb 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
trpc-next-app-dir ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 15, 2024 2:08pm
www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 15, 2024 2:08pm

Copy link

vercel bot commented Feb 12, 2024

@dBianchii is attempting to deploy a commit to the trpc Team on Vercel.

A member of the Team first needs to authorize it.


export type inferProcedureBuilderContext<
TProcedureBuilder extends AnyProcedureBuilder,
> = Parameters<Parameters<TProcedureBuilder['mutation']>[0]>[0]['ctx'];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks weird to get the 'mutation' here directly. But it is what seemed to have worked correctly.

@dBianchii
Copy link
Contributor Author

Hi, would just like to point out that this is my first time contributing here. Want to make sure I follow all the guidelines. Please let me know if anything's missing

@KATT KATT changed the title feat(server + client) Add inferProcedureBuilderContext type helper feat(server): add inferProcedureBuilderResolverOptions helper Feb 15, 2024
Copy link

This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants