Theo's Typesafe Cult

TTC

Theo's Typesafe Cult

Join the community to ask questions about Theo's Typesafe Cult and get answers from other members.

Join

Serverside api call - uploadthing

Hi! I have implemented the uploadthing nextjs and works great clientside with upload button! But I want to use uploadthing from the serverside in nextjs. Is there a easy way of doing it? Can I reuse the fileRouter or /api/uploadthing endpoint? Sorry if it is a noob question 🙂...

Complete idiot and noob here: Skeletonize a dashboard with Shadcn ui

complete noob here to frontend dev. want to make a web dashboard for a competition type thing. any ideas?...

Error with tRPC & Drizzle with numeric data type

Im quite confused on this one. I'm getting an overload error saying the properties don't exist on type and then lists the type with those exact properties. Its not unique to one individual property. Any that I try give me the same error. I've attached screenshots of the trpc function as well as my schema. Plz let me know if you want any more info or have any idea as I'm flabbergasted :/...
Solution:
I have a feeling that a numeric data type is a string. So you would use z.string() Please test I may be wrong...
No description

Cannot catch or log error, onUploadError

``` const { startUpload } = useUploadThing('imageUploader',{ onUploadError(e) { console.log(e) },...
No description

T3 Turbo - Run a typescript app with node

I'm using create-t3-turbo starter, only the tooling and the web app side of things. Within this turbo repo I'm trying to run a simple typescript app, I can't seem to figure out how to run it with the existing tsconfigs. All the examples I've seen either use expo start, next start or nitro.

I still don´t get server actions

This might be a shallow question but I still don't get server actions comprehensively: I have this server action that just queries all car records from my db: - Then I call it from a server component. - And then I call this server component from a client component. But I keep getting an error "async/await is not yet supported in Client Components, only Server Components." despite the fact I'm not using any of that inside my client component Should I use useEffect to fetch data like in the good old times?...
No description

Is anyone actually using the Effect library in production?

I've stumbled across the Effect (https://effect.website) library which promises "TypeScript for production"... Although a lot of it's features seem very enticing I have some hardships actually using it in my projects... Plus, the way some people shill this product, makes me think it's kinda sus... So... Is anyone using Effect? Are you satisfied? Do you see any cons? Etc....

Looking for a way of doing TypeScript validation of static files

Hi fellow typesafe cultists. I have a project with a lot of POJO-style data which I need to: 1) keep in version control (the data gets updated fairly regularly, they're game data files so with each playtest they change, but I want the ability to revert) 2) keep strictly typed (and if possible have autocomplete/error highlighting while editing them)...

Next.js app router with dynamic routes and trpc weird behaviour

Hi guys, been running into a couple issue trying to implement type safety from a dynamic route in next.js through to a zod validated trpc router... Stack: T3 with postgres (neon) and drizzle Versions:...

package lib to preview pdf or docx

hey guys im looking for package to preview pdf or docx but i need to add form on the side and if we input something the preview documents changes too. any idea what kinda of package i should use?
No description

if all my components are "use client" should I even use NextJS?

all my components in my website happen to have use client at the top Should I even use NextJS at this point , if I fully prefer normal React, is there any benefit i am getting with NextJS if all my components are client?...

Cannot find module whenever running 'npm run dev' on t3 app

Cannot find module '/Users/dylanosullivan/Documents/runtime/library.jsruntime/library.jsPersonal/pagewriter/pagewriterapp/node_modules/@prisma/client/runtime/library.
Solution:
output = "../node_modules/.prisma/client"

web_dev vs software developer

What is the difference between web developer and software developer. What qualities does one require to be considered as software engineer...

trpc resource: the server responded with a status of 500 I'm really confused

This problem always happens when I add a second mutation or more trpc:Src -> server -> api -> routers -> auth.ts Being used : Src -> components -> auth -> [ register.tsx. | login.tsx ] The rest of the configuration is default ...

Typescript "implements"?

Hello, guys, i have two interfaces that have same name fields but different implementation, but i want when i create new interface without all fields from A in new interface, it should throws an error any help please? ```js interface A{ a: boolean; b: boolean;...
Solution:
What you're asking for is almost like an interface B implements A {} - which doesn't work. I tried a few different things. I'm not sure there's a way to do exactly what you're asking. The closest I can get is a single interface with unknown types, where the class can then define the types however it wants...

Optimistic Updates with TRPC Hook

I've made a hook with TRPC and am trying to create optimistic updates.. simplified below ```ts export function useComments(urlId: string) { const [comments, setComments] = useState([] as urlComments[]);...

redirect issues

I have issues with redirect not working properly when called from a server actions , the account deletion work as intended but
redirect('/')
redirect('/')
doesn't seems to work it just finish the task and remain on the same page what am I missing am using app-router with drizzle-orm ```javascript "use server";...

Bundle type defs for a package in node_modules

I want to send type definitions for a package that is present in my node_modules folder to the frontend so that i can use it with monaco editor. The problem is how can i bundle all the types of the module into a single file. Sometimes a package has external type dependencies too, how can i handle that.

Self-hosting Next.js with graceful shutdown

Anyone self-hosting Next.js on places like Fly, Render, or Railway? Need guidance on how to handle rolling deploys: how do I gracefully shutdown my app? The default behavior with Next when receiving SIGINT or SIGTERM is to just quit the Next.js process with a 0 exit code. That’s nasty as it stops all work in requests that are in flight. ...