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
Export AnyTRPCProcedureBuilder
from @trpc/server
#5497
base: next
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@ymc9 is attempting to deploy a commit to the trpc Team on Vercel. A member of the Team first needs to authorize it. |
…to export-proc-builder
An E2E test case is failing, but it doesn't seem to relate to the changes made. I can't reproduce the failure locally either. |
UnsetMarker, | ||
UnsetMarker, | ||
UnsetMarker, | ||
UnsetMarker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I'm basically 100% sure this is going to cause regressions which our test suite may not be capturing yet (because we never broke it before)
Here's the reason: https://trpc.io/docs/server/validators#input-merging
and here's the scenario:
It's totally valid to set up an input or output and then create a router with that procedure, so UnsetMarker wouldn't be the root type in that situation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay so as per https://github.com/trpc/trpc/pull/5497/files#r1494523733 I think what we could do is leave this AnyProcedureBuilder be
If you copy it over to packages/react-query/src/shared/polymorphism and export it from there though, I think we can live with its shortcomings as a limitation and open it up later. But we shouldn't make the rest of the codebase live with UnsetMarker hard-coded
@@ -33,10 +29,6 @@ export type FileExportStatusType = z.infer<typeof FileExportStatus>; | |||
// Dependencies | |||
// | |||
|
|||
type BaseProcedure<TRoot extends AnyRootTypes> = ReturnType< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly what was here before actually does produce a type with typeof unsetMarker there, so inter-compat with .input merging wouldn't work in production today for router factories. Maybe we can find a compromise then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried export this from @trpc/server basically and found the same problem popped up with procedure.input() being passed through
// type $RootTypes = ReturnType<typeof initTRPC.create>['_config']['$types'];
// export type AnyTRPCProcedureBuilder = ReturnType<
// typeof createBuilder<$RootTypes['ctx'], $RootTypes['meta']>
// >;
Closes #
🎯 Changes
What changes are made in this PR? Is it a feature or a bug fix?
✅ Checklist