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

docs: Add TypeBox to Library integrations #5696

Open
1 task
sinclairzx81 opened this issue May 1, 2024 · 0 comments
Open
1 task

docs: Add TypeBox to Library integrations #5696

sinclairzx81 opened this issue May 1, 2024 · 0 comments
Labels
✅ accepted-PRs-welcome Feature proposal is accepted and ready to work on 📚 documentation / examples Improvements or additions to documentation

Comments

@sinclairzx81
Copy link

sinclairzx81 commented May 1, 2024

Area of Improvement

Hi,

I was wondering if it would be possible to add TypeBox to the Library Integrations section on the tRPC documentation website. The TypeBox setup is very similar to the Valibot setup where the @typeschema/* package enables tRPC compatibility via the wrap() function.


With TypeBox

import { initTRPC } from '@trpc/server';
import { wrap } from '@typeschema/typebox';
import { Type } from '@sinclair/typebox';

export const t = initTRPC.create();
 
const publicProcedure = t.procedure;
 
export const appRouter = t.router({
  hello: publicProcedure
    .input(wrap(Type.Object({ name: Type.String() })))
    .output(wrap(Type.Object({ greeting: Type.String() })))
    .query(({ input }) => {
      return {
        greeting: `hello ${input.name}`,
      };
    }),
});
 
export type AppRouter = typeof appRouter;

Cheers
S

Link to related docs

https://trpc.io/docs/server/validators

Additional information

No response

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd be down to file a PR implementing the suggested changes!

Funding

  • You can sponsor this specific effort via a Polar.sh pledge below
  • We receive the pledge once the issue is completed & verified
Fund with Polar
@sinclairzx81 sinclairzx81 added the 📚 documentation / examples Improvements or additions to documentation label May 1, 2024
@KATT KATT added the ✅ accepted-PRs-welcome Feature proposal is accepted and ready to work on label May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✅ accepted-PRs-welcome Feature proposal is accepted and ready to work on 📚 documentation / examples Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants