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

Chainable without () ?

Hi all, I have this: ```ts export function JSZComponent() { return ( div()...

Building CT3 app with docker - libssl error

When building ct3 app I get an error saying that in prisma generate it can't load libssl package. I've done it before like a milion times in 2022 and it worked. I haven't changed anything in dockerFile since and it is just copied from the docs. Error: ``` #13 87.17 > 360review@0.1.0 postinstall /app...

UseEffect not being called

Hey, I've got a weird bug in my react component ```ts const MqttProvider = ({ children, options }: Props) => {...

Invalidating queries with tRPC

Hi all! I am trying to do something similar to the screenshot: I use useQuery() to fetch the initial data, and for each day, there are multiple start/end times with an id. Then, if any of them changes, I want to use mutate() and then somehow invalidate the query or optimistically update the data. I know how to do it by following React Query docs, but not 100% sure on how to execute this using tRPC....

What to use to generate pdfs?

I've been searching for a couple of days and yet I'm not sure about which lib to use. jsPDF seems like a good option, it does what I need and has types. Any suggestions?

How to stop working after work?

Especially if a bug report comes in after I'm home from work, I will panic debug and crawl through logs until 1 AM. It's seriously messing with my sleep and I have no time to de-stress lol. How do I stop caring as much in my off time?

React: Passing value to prop callback ?

I want to pass a value to my props call back function Example: <input onChange={(e) => console.log(e.target.value) /> ...

How to search for msgs that include a string

my model is Video {videoId, comments [[ 60 messages], [ 60 messages], [ 60 messages], [ 60 messages]] it used to be Video{videoId, comments[ message {}, message {}. message {}, ] the first method has 1000 arrays of 60 messages ...

I can't figure out how to make an authentication middleware for my API please help

I'm using credentials provider with jwt from nextauth and then I have a middleware.ts in the root folder with just this content ```export { default } from "next-auth/middleware" export const config = { matcher: ['/api/user/getuser'],...

inferring types from tRPC array

I'm trying to understand how to correctly work with inferring types when using a tRPC query, when i get an array of objects. Since i'm using prisma - i'm getting the types of the objects in the DB that i'm fetching, so my ucrrent solution is this; type Question = RouterOutputs["question"]["getAll"][0]; ...

Prisma: filter include statement by nullable relation, exclude when null

I have the following code, being used to get a cart on a user session. ```ts type CartType = Cart & { items: (Item & { product: Product })[] }; ...

tRPC Websockets | package subpath not defined by exports

So basically I am playing around with tRPC Websockets/Subscriptions. I am primarily using this repo as a reference -> https://github.com/trpc/examples-next-prisma-websockets-starter I've created a server.ts which has the following contents ->...

Next.js Blog Dynamic Routes Tutorial - 404 when visiting /pages/[id]

Hi everyone, I've started learning Next.js by following the starter blog tutorial (https://nextjs.org/learn/basics) but I'm stuck in the "Implement getStaticProps" section - I'm getting a 404 error whenever I try to visit localhost:3000/posts/ssr-ssg or localhost:3000/posts/pre-rendering. I've triple-checked that pages/posts/[id].js and lib/posts.js match the files in the next-learn repo (https://github.com/vercel/next-learn/blob/master/basics/dynamic-routes-step-1/), as suggested by the tutorial's troubleshooting section, but it's still not working. I'm not sure if it's an issue with getStaticPaths() or getStaticProps() in the pages/posts/[id].js file....

Next's Link bundle size too heavy (70.53kb)

So, I noticed that importing Next's Link component bundle size is pretty heavy (70.53kb), so I looked for an alternative. I found this link that talks about replacing React with Preact, but that sounds like an impactful change. Are there trade offs? Has anyone ever tried it?...

Error function trpc

Okay, so im kinda new to trpc stuff and not that familiar with that. I want to throw error on backend when Email is not unique. So when i write it like this in my router it works great, it throws that error:
```registerUser: publicProcedure .input(z.object({ email: z.string(), password: z.string() })) .mutation(async ({ input, ctx }) => { const user = await ctx.prisma.user.findUnique({...

T3-Turbo Installing Expo Packages Error

Hey, when I try to add packages or update packages to my expo app in create-t3-turbo it tries running random npm commands... ```
yarn add @shopify/flash-list@1.1.0 react-native@0.69.6...

Share components between Next.js and React Native?

Is it possible to share react components between Next.js and React Native? I'm aware of Solito, but is there some other established method?...

tRPC client from swagger

I have a backend that is written using FastAPI, and it is already quite large and utilizes unique technologies. I would like to use tRPC in my create-t3-app, but I haven't been able to find a solution for generating a tRPC client from a swagger API through my research. I am unsure if this is even possible. I would greatly appreciate any help or suggestions on how to proceed.

Typing self-returning proxy

```ts function div(){ const props = {} function createChainable(obj: any = {}){ return new Proxy(() => obj, {...