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

SVGR and next/Image

Hey guys, a noob question I'm wondering if there is any difference in using one of these to render svgs? Like which one is the most effective way to use svg? Can't really wrap my head around it 😂

s3 type error

Not great at typescript so I'm not sure why this is throwing a type error. ```ts export const r2 = globalForR2.r2 || new S3Client({...
No description

HTTP requests in next 13

I sending http requests in a server component and i want to inspect these requests, but they arent showing up in network tab in the browser nor in the terminal. How do i inspect them?

Notion can't detect my timezone

Anyone knows why notion can't detect the timezone my mac is in? When i set to detect on its own, it keeps using (GMT+00:00) UTC

NextJS Onload Function

I was trying to check whether an user has an auth token in cookies on load. And if it is there I was passing down that token to a client component to change client auth state as it was required to perform some other UX based things. Now, in my approach I was doing it in layout.tsx but when built the app it showed now everypage is by default using server side rendering. So, my question is there a better way to this above mentioned stuff like moving it into some other component and just making the pages statically render reducing the server cost. Or is it the only way to do this stuff and if so is there any performance hits that I would face or any cost related hits in production. Also if there is a better way to do this please mention? Thanks in advance....

Unsafe assignment of an `any` value

I searched and read details regarding this linter error but nothing has worked for me so far. I am trying to create a router for a Prisma model...
No description

Parameter 'props' implicitly has an 'any' type

I'm a typescript noob. How do i specify that props should have hrefs and children. should i use typeof Link or something here?
No description

Undici error (Drizzle + Next.js 13.5)

I'm getting an odd error with Undici; after looking things up, I've not had any luck. Here is the error I'm getting: ``` ⨯ Internal error: TypeError: fetch failed at Object.fetch (node:internal/deps/undici/undici:11576:11)...

Weird header response randomly

Not sure what causes it but randomnly when trying to convert an image to a stream to upload to youtube, uploadthing returns a weird header value and it breaks the parser. This link specifically: https://uploadthing.com/f/b17adb06-212c-4002-9685-c3b0653d14ad-albtc1.png

How do I redirect using middleware?

I have a /signup page and I'm trying to get all client requests to redirect to that page. I've tried using next config and vercel without much luck, now trying with middleware Middleware looks like this: import { NextResponse } from 'next/server'...

# React PDF Project Setup

I am attempting to setup react pdf from the quick start. I have added React and react pdf renderer to my project and have added the example into my node project and am trying to run node index.js but when I do I get this error
<Document>
^

SyntaxError: Unexpected token '<'
<Document>
^

SyntaxError: Unexpected token '<'
Can anyone help with this error?...

Image Memory Leak in NextJS?

Hi, we're running a NextJS application on a VPS, and from the looks of it the Next Image has a memory leak of some sort? Whenever loading in images, memory increases, which is expected, but it should reduce after the minimumCacheTTL as far as I understand, but it seems it's infinitely caching images in memory (as well as in the file-system, but that's expected). Memory baseline for our application starts at ~200mb, and build up to 1 GB+ overtime when hundreds of images are loaded in, memory is never released. I am also confident it's caused by Next/Image since running it with unoptimized images has zero issues and RAM stays at the baseline forever. ...

vercel deployment failed

https://stackoverflow.com/questions/77204414/deployment-on-vercel-failed-with-export-encountered-errors-on-following-paths so basically just trying to deploy my new portfolio but the deployment is failing with an Error occurred prerendering page "/". i dunno why this is happenning even after reading the documentation...

Seriously:: Github contributions

Seriously, how do you approach contributing to open-source projects, especially when they appear to be extremely complex? I'm not just talking about 'UploadThing,' but projects in general. What motivates you to take part and what steps do you follow to contribute?

Webpack Compilation Error

I am using t3-config with nextjs 13 and cypress it is working fine with nextjs alone but when i use cypress i am getting ``` Error: Webpack Compilation Error Module not found: Error: Can't resolve 'process/browser' in '/home/project'...

TS, derive type from key of another type

Let's say we have this type ```typescript type DataFile = { name: string;...
Solution:
sorry, I forgot to actually post the simpler way lmao: ```typescript type DataDisplay = { name: string;...

How to properly do data call on SSR with tRPC before loading render content?

https://pastebin.com/pFiaYsMk - Content of my file. I need line 10 to be loaded before my route hydrates the page. I much do a check when /dashboard (called Home) loads, to know if the user already has an associated organization. Currently when I refresh the page, my page doesn't do the call....

Node Modules not working

Imports are only working if it is ../node_.../name does anyone know why?
No description

[next-auth + google] can't login on production

[next-auth, next 12, google provider, vercel] Logging-in works in dev, but no in production. When I choose an email on the google widget, it redirects me to the login page. There is no error to be seen, all network requests have 200 status,...