rik
rik
TtRPC
Created by rik on 2/26/2024 in #❓-help
Zod.enum makes my tRPC explode
I'm having an issue with what appears to be circular dependencies. My problem is that I'm not sure what is being parsed that is causing the issue. I don't see a circular dependency. I think that the error message is not indicating the problem line correctly, as I just added more debug to the file and the error message didn't change. Is there a way to switch on more debug logging in v10 on the server side, so that I can see what's happening more? The error message: ⨯ TypeError: Cannot read properties of undefined (reading 'parseAsync') at getParseFn (file:///C:/repos/automation/automate/node_modules/@trpc/server/dist/index.mjs:190:23) at Object.input (file:///C:/repos/automation/automate/node_modules/@trpc/server/dist/index.mjs:357:28) at eval (webpack-internal:///(api)/./src/server/api/routers/usbDeviceControl.ts:20:79) The marker for that last line doesn't seem to change with the content of the file. How do I go about finding what's undefined here?
4 replies
TtRPC
Created by rik on 2/21/2024 in #❓-help
Beginner Client Problems
Node 21, npm 10.2.4, tRPC 10, from a create-t3-app run yesterday. I've got a zod validator create by drizzle-zod, for inserting into a table. There is a .omit() call to remove fields not allowed to be set by my user. I'm using this in a publicProcedure as the argument to .input(TableValidator), and there's a .mutation() that inserts the data into the database. I have also used a z.infer<typeof TableValidator> to get a type for this data, which I'm using on the client to coerce the single data structure I'm using as test data to that type, to use as an argument to the .useMutation() call. My editor thinks that the data structure type does not match the expected input type of the .useMutation(). The error message reads: Type { command: "add" | "remove"; argument: string }' has no properties in common with type 'UseTRPCMutationOptions<{ command: "add" | "remove"; argument string; },TR{CCLientErrorLike<BuildProcedure<"mutation", { _config: RootConfig<{ ctx { db: BetterSQLite3Database<...>; }; meta: object; errorShape { ...; }; transfor...' and the parameter type. How do I go about finding what I have failed to understand?
8 replies