Closed KATT closed 2 years ago
Really cool!
We're actually lying to the compiler
Does it matter if it is just the internals? Should not affect the users in any way? 🤔
Does it matter if it is just the internals? Should not affect the users in any way? 🤔
In some cases it might, if they miss using the proxy object for instance or are doing backend-stuff and trying to explicitly call the functions
Furthermore... Wondering how the React-api could look like. I've noticed that when I try to remap functions, I seem to lose CMD+click ability...
A few options
// this is a bit ugly but will work to do CMD+click on `greeting` with to jump to the backend
const { queries } = myQueries
trpc.useQuery(queries.greeting({ name: 'world' }), { /* .. further options */})
// these below won't work to CMD+click on :(
trpc.useQuery.greeting({ name: 'world' }, { /* .. further options */})
trpc.useGreetingQuery({ name: 'world' }, { /* .. further options */})
@colinhacks maybe you have ideas/input on the above?
@KATT
In some cases it might, if they miss using the proxy object for instance or are doing backend-stuff and trying to explicitly call the functions
Hmm, direct proxy usage might a bit too magical. Explicit query argument does indeed communicate better that there's something more than just a function call going on.
And if it does not work out for the React hook, there some value having them be consistent:
client.query(query.greeting, { name: "world" });
useQuery(query.greeting, { name: "world" });
Merging for now - can be discussed in #26
ProcedureResult
to check the results of a procedureAllows you to call your API like this:
Upsides
Downsides
trpc.resolver(() => /* ... */)