cadams
Explore posts from serversTTCTheo's Typesafe Cult
•Created by cadams on 12/12/2023 in #questions
Correct if wrong: Since a tRPC procedure is a hook, they cant be used in the next api/ routes
Just thinking, maybe I could send the email inside the tRPC procedure, and not use the Next api route. This essentially makes the Next api/ route redundant then ? please correct me if I am wrong
5 replies
TTCTheo's Typesafe Cult
•Created by cadams on 11/3/2023 in #questions
Do you manually create Zod schemas for your Prisma models?
this DX seems amazing, thanks for the share @G3orge
11 replies
TTCTheo's Typesafe Cult
•Created by Eddy on 11/2/2023 in #questions
tRPC alternatives for a simple public API
Not sure I understand your question 100% but have you heard of trpc-openapi ? https://github.com/jlalmes/trpc-openapi
Apparently it can make you use your trpc routes like normal REST endpoints.
11 replies
TTCTheo's Typesafe Cult
•Created by cadams on 10/8/2023 in #questions
Non-primitive fields not showing on variables of type from RouterOutputs.
Thats a useful piece of documentation.... But it doesn't address the issue on RouterOutputs I have noted. Which is:
RouterOutputs types ignore "complex data type" fields and only have primitive fields
This seems like a critical issue.
Could someone be an absolute goat and try reproduce this error please ? 🌞🙏🌞🙏🌞🙏
1. Create a model in prisma with complex data type e.g. User
2. Create a router that returns ctx.prisma.newmodel.findMany();
3. Put that router in root.ts
4. run npx prisma db push
5. In any file, get the type : type NewType = RouterOutputs["newmodel"]["getAll"][number];
6. Create a variable of this type : const foo = {} as NewType
7. See if the complex data type field is on the variable
13 replies
TTCTheo's Typesafe Cult
•Created by cadams on 10/8/2023 in #questions
Non-primitive fields not showing on variables of type from RouterOutputs.
13 replies
TTCTheo's Typesafe Cult
•Created by cadams on 10/8/2023 in #questions
Non-primitive fields not showing on variables of type from RouterOutputs.
13 replies
TTCTheo's Typesafe Cult
•Created by cadams on 10/8/2023 in #questions
Non-primitive fields not showing on variables of type from RouterOutputs.
I did yes
13 replies
TTCTheo's Typesafe Cult
•Created by JojoHomefries on 10/2/2023 in #questions
Unsafe assignment of an `any` value
ctx.prisms.sketchbook ?
9 replies
TTCTheo's Typesafe Cult
•Created by cadams on 9/25/2023 in #questions
When to use "src/page/api/doStuff.ts" vs "src/server/api/routers/routerThatDoesStuff.ts"
I am still wondering about the title of this thread - does "src/server/api/routers" make "src/page/api" redudant ?
11 replies
TTCTheo's Typesafe Cult
•Created by cadams on 9/25/2023 in #questions
When to use "src/page/api/doStuff.ts" vs "src/server/api/routers/routerThatDoesStuff.ts"
11 replies
TTCTheo's Typesafe Cult
•Created by cadams on 9/25/2023 in #questions
When to use "src/page/api/doStuff.ts" vs "src/server/api/routers/routerThatDoesStuff.ts"
thanks for the advice! i have tried the enabled way, but get this error above ^ .... but trying the useMutation way now ....
11 replies
TTCTheo's Typesafe Cult
•Created by cadams on 9/25/2023 in #questions
When to use "src/page/api/doStuff.ts" vs "src/server/api/routers/routerThatDoesStuff.ts"
Trying this code below gives this error Error: Too many re-renders. React limits the number of renders to prevent an infinite loop.
const { data: billedFromServer } = api.sale.bill.useQuery({ rows: spreadSheet?.rows ?? [] }, { refetchInterval: false, refetchOnWindowFocus: false, enabled: hasBilled });
if (billedFromServer) {
setHasBilled(false);
setBillResultt(billedFromServer);
}
11 replies
TTCTheo's Typesafe Cult
•Created by westlaw on 9/25/2023 in #questions
❌ Attempted to access a server-side environment variable on the client get's thrown in db.ts
Is it possible to define a "shape" once and use it for both TRPC Router and client ?
13 replies