Mika
Mika
TtRPC
Created by Vengeance on 5/27/2024 in #❓-help
Send File Back From Procedure
No, you cannot do that using tRPC.. Use regular API endpoints for that
3 replies
TtRPC
Created by G$Row on 5/3/2024 in #❓-help
How to get data type from onMutate function in useMutation
But then you'll lose everything else in tRPC context, and you'll get a typescript error saying that context type is not compatible with loginOpts..
30 replies
TtRPC
Created by G$Row on 5/3/2024 in #❓-help
How to get data type from onMutate function in useMutation
If you really want to solve this problem your way, change your type to the following
type loginOpts = {
input: z.infer<typeof loginSchema>
}
type loginOpts = {
input: z.infer<typeof loginSchema>
}
30 replies
TtRPC
Created by G$Row on 5/3/2024 in #❓-help
How to get data type from onMutate function in useMutation
When you try to retrieve the router inputs, typescript has to analyze the entire definition of that router, which includes the function definition ... It won't just read the .input(loginSchema) and be like ok, I'm done, here you go
30 replies
TtRPC
Created by G$Row on 5/3/2024 in #❓-help
How to get data type from onMutate function in useMutation
It's hard to explain but if you think about it, it makes sense
30 replies
TtRPC
Created by G$Row on 5/3/2024 in #❓-help
How to get data type from onMutate function in useMutation
But the auth login points to a function
30 replies
TtRPC
Created by G$Row on 5/3/2024 in #❓-help
How to get data type from onMutate function in useMutation
When you write RouterInputs["auth"]["login"] typescript goes to the procedure and tries to read it's definition
30 replies
TtRPC
Created by G$Row on 5/3/2024 in #❓-help
How to get data type from onMutate function in useMutation
The error you're getting is correct, this is a circular definition
30 replies
TtRPC
Created by G$Row on 5/3/2024 in #❓-help
How to get data type from onMutate function in useMutation
It's not a ts bug, let me try to explain
30 replies
TtRPC
Created by G$Row on 5/3/2024 in #❓-help
How to get data type from onMutate function in useMutation
FWIW, I have a production app running with dozens of routers, which in turn have dozens of procedures inside them. No big deal .
30 replies
TtRPC
Created by G$Row on 5/3/2024 in #❓-help
How to get data type from onMutate function in useMutation
For now you're just making your life harder by letting typescript stand in the way between you and the app that you're building
30 replies
TtRPC
Created by G$Row on 5/3/2024 in #❓-help
How to get data type from onMutate function in useMutation
When it gets big, you'll refactor it
30 replies
TtRPC
Created by G$Row on 5/3/2024 in #❓-help
How to get data type from onMutate function in useMutation
Try not to fall into premature optimization trap. This is the perfect example of premature optimization
30 replies
TtRPC
Created by Jacob on 5/27/2024 in #❓-help
Losing type-safety with merged routers
I know this sounds dumb but try reloading/restarting vscode if you haven't already. more often than not whenever I see any my reflex is to reload vscode
5 replies
TtRPC
Created by G$Row on 5/3/2024 in #❓-help
How to get data type from onMutate function in useMutation
You should inline your functions and keep the logic inside the router file
30 replies
TtRPC
Created by G$Row on 5/3/2024 in #❓-help
How to get data type from onMutate function in useMutation
This means that you completely lose the context type information, which you tried to recover by inferring the router inputs
30 replies
TtRPC
Created by G$Row on 5/3/2024 in #❓-help
How to get data type from onMutate function in useMutation
You will keep seeing these kinds of errors and even more frustrating errors because you define the mutation function somewhere else
30 replies
TtRPC
Created by Upsided on 5/24/2024 in #❓-help
change data from query
Look up tRPC optimistic updates (query setData)
3 replies
TtRPC
Created by bill92 on 5/24/2024 in #❓-help
conditional useQuery without input
I'm a bit late but perhaps you're looking for mutations , not queries. Makes no sense to have a logout as a query. Queries are data loaders (get data) Mutations are actions (do something)
6 replies
DTDrizzle Team
Created by joshborseth on 9/14/2023 in #help
TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')
You guys should probably consider adding "noUncheckedIndexedAccess": true, to Drizzle-kit tsconfig.json, otherwise these kinds of errors will always keep popping up
44 replies