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

Easy drop in payment solution? that works with t3 or nextjs

Easy drop in payment solution? that works with t3 or nextjs

Dashboards with Tailwind

Anyone know some good Dashboard starts with tailwind which then I can customize?

motion one doesn't allow for initial values?

motion one (https://motion.dev) seems very cool and all, but does it not have an API for initial values (similar to framer-motion)? its quite possible that I simply am making up an issue here, but surely if I want a fade in, the solution isn't to by default have the opacity of everything be 0 and then later change that in JS world? sorry if I'm just missing something and being stupid :)...

is Astro SPA a good idea?

Okay the plan is this (say we are making a dashboard or some other form of web apps, ignoring SEO stuff): - Create an astro project - have only a [...app].astro file in the routing, which contain an <App/> react component - handle everything else inside <App /> like a classic React SPA app It's probably not the type of things astro was built for, but what are the actual downsides of this I can expect versus other ways of making the same app (say t3 stack for e.g.)?...

What is everyone using for testing their T3 App?

I just wanted to hear some thoughts on testing philosophy as well as any implementation that people have.

Why are the default prettier, tailwind and postcss configs are in .config.cjs type?

Is there any specific reason to it? I’ve tried adding rules to prettier.config.cjs, but they didn’t seem to work. Created .prettierrc file, same rules - worked. I’ve read that .prettierrc takes priority over .config.cjs file. So one of the assumptions - this choice was made so it’s simple for us to override the styles? But it doesn’t really make sense IMO, so looking for more sensible answers 🙂...

Zustand Syntax & Conventions

Been experimenting with Zustand a bit and really liking the simplicity so far. Got a few questions regarding syntax and conventions(?). 1. For defining actions, do you do logic inside the set function or outside? i.e. which of these would you prefer? ```ts export const useStore = create<Store>((set, get) => ({...

Generic return type of function in record

I have a function with a param of type Foo<T> = <T extends string | number | symbol> = Record<T, (context: Context) => unknown> I'd like to keep the return type of whatever the function is. How would I use generics to get this to work?...

wtf prisma errors

How am i supposed to know what the hell is wrong here lol

Syntax Highlighting

What do you guys usually use for code highlighting? Anything that works well with tailwind?

please i need resource recommendation for pagination on trpc the official docs is very confusing

Please any recommendations will be much appreciated be it video or blog post or code snippet etc

Type error at custom fetch function for tRPC client

Hey. I'm running an Electron app as my front end. I used tRPC for the API which will communicate with my back-end, all good there. However, since it's an Electron app, I needed to give it a fetch function otherwise I get this error:

AccessToken for external API communication

What would be the best approach to pass the AccessToken from NextAuth Session to the Http Client which is being called from tRPC procedures to access external API?? Should I attach the AccessToken to the request object from NextAuth session callback and then provide it to the HttpClient instance in the tRPC context initialization for the request?? Or is there better alternative to handle this?...

object updating incorrectly

I feel like i'm missing something fundamental here. when I add a new entry into object b it resets to an empty object upon a subsequent request. Can anyone help? ```js addNewTicket: ticketsDomainProcedure .input( z.object({...

Securing API Route for use with IoT devices

Hey, what would peoples recommendations be for securing my nextjs api for use with Iot devices. Previously I would use a JWT, or OAuth to secure them but im not really sure if this would suit an iot device. Essentially my device needs to be able to connect, and then send some telemetry data over https, and will do this at random intervals. ...

Best Practices When Using Components with Tailwind

Hi all, just wondering what the best practices are for passing additional class names as props for a component using Tailwind. Is this the recommended way, or is there a better alternative?

How to enable tRPC (v10) queries that don't have data passed in them

Just updated to trpc v10 and have no idea how to enable/disable queries. Couldn't find anything in the docs. Here is what I'm trying that doesn't work: trpc.subscription.getUserSubscription.useQuery(undefined, { enabled: !!user?.customer && !!user.individual })...

Programmatically determine which field to update in a Prisma mutation

I want to update a specific field in my database. I'm passing the id of the record to update, the name of the field and the new value for this field, into my router to the chgField procedure. Can this be done with some syntax like that shown in * input.field: input.nu * below , if so, help on the syntax here would be great (this doesn't work). ```ts export const peopleRouter = router({ chgField: publicProcedure .input(...