Closed KATT closed 2 years ago
Naming of functions that returns functions and naming of functions that returns functions that return middlewares 🤦
createUseNewContext
Current usage:
const useNewContextFactory = createUseNewContext<TestContext>(); const useIsAuthed = useNewContextFactory((params) => { if (!params.ctx.user) { return { error: { code: 'UNAUTHORIZED', }, }; } return { ctx: { ...params.ctx, user: params.ctx.user, }, }; }); // in resolver const procedure = resolver( useIsAuthed(), () => { // .. } )
useX
useZod() returns a middleware for zod.
useZod()
app.use()
Created a helper function, idea by @mmkal, that seem to have removed the debate for now https://github.com/KATT/trpc-v10-playground/commit/7501de3a16038763101f0f8102e2d5b23c8b61d0
What to name the
createUseNewContext
middleware?Current usage:
~Do we like the
useX
format?~useX
format needs changinguseZod()
returns a middleware for zod.app.use()
when I came up with it.