Closed esamattis closed 2 years ago
The input and resolver are now just positional arguments
input
resolver
trpc.resolver( trpc.zod( z.object({ hello: z.string() }) ), (params) => { return { data: { greeting: "hello " + params.ctx.user?.id ?? params.input.hello } }; } );
to me this feels bit more cryptic, especially when adding context creation too, than the current version where the resolver definition is an object. Would this be possible here as well?
trpc.resolver({ input: z.object({ hello: z.string() }), resolver(params) { return { data: { greeting: "hello " + params.ctx.user?.id ?? params.input.hello } }; } });
I believe the object version would be also more future proof since it is easily extendable without breaking existing apis.
Please discuss in #25
The
input
andresolver
are now just positional argumentsto me this feels bit more cryptic, especially when adding context creation too, than the current version where the resolver definition is an object. Would this be possible here as well?
I believe the object version would be also more future proof since it is easily extendable without breaking existing apis.