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

Archiving on serverless functions

Does anyone know any zipper/achiver library that works on serverless functions?

Admin dashboard

How could I create an admin dashboard where if the user is not authenticated with next-auth it goes to /login but if he does not have admin give a 403 ? Maybe something like roles ?
Solution:

Clerk - can’t get types of unsafeMetadata properties on user object?

I have some unsafeMetadata stored on the user object for users in my t3-app. When I try to access any property of the object, TypeScript seems unable to get/infer the type of that property. So for example: user.unsafeMetadata.stringProperty...

how to get rid of t3 icon in Head component?

I mean, it's a good icon, but I'd like to have my own in place. I have <link rel='icon' href='/my-icon.svg' /> under <Head> in app.tsx, but: For example, when I open deployed project address, for a split second there is t3 icon. And if I open the same site from my phone, I don't see my icon at all, only t3 one....

Mutation alters user in database then redirects to homepage. How can i force user session to update

I have a page /form when i press the submit button i activate a mutation that updates a field on user to true it then redirects to "/". When it redirects it does not update the ui and show green arrows for that form. I have to refresh page for the updated user object to come in with that field set to true. even tho it is true when i am redirected and i see red arrows indicating its false in database

Storing a Triple Nested Object

So my prisma schema is as follows: ```prisma model Game { id Int @id @default(autoincrement())...

Cold starts on Edge?

Hi, I have an API route that I made using Planetscale's database-js library. Here's the code: ``` import { Client } from "@planetscale/database"; export const runtime = 'edge' // 'nodejs' (default) | 'edge'...

Year old IntelliJ bug is actively making my development experience miserable

IntelliJ has had some type of CPU bug while trying to parse mildly complex Typescript types for about a year now. Its an IDE & machine stopper. I've personally seen CPU spikes up to 800+%. The Jetbrains team has been less than responsive on this issue and it seems like there is no urgency to fix it. I am posting here in order to gain some type of traction or...to sadly convince me to finally move on.. https://github.com/d-pollard/intellij-typescript-cpu-issue...

How can I let users download files uploaded to UploadThing?

Hey all. Total noob with anything to do with files in the web dev space. I adopted UploadThing in my ct3a project and was wondering if there was a way to make these files downloadable somehow. Currently, when the src link is pressed on an <Image /> or <a> tag, the uploaded image opens in another tab. Anyone know the best way to go about this? Thanks!

Force page data fetch with TRPC? Edit form cacheing older data.

I have an edit form. If a user creates edits, submits, then immediately returns to the page the data is cached and displays the old information. What is the correct policy for handling this issue?...

ts-node not recognize

i alr tried reinstall and global install still didn't work,i stuck here 6hours straight. my case : i just want nodemon to transpile my ts to js and execute the js which on dist and restart the server like usual :). help thx...

`env.mjs` as opposed to `env.cjs` or `env.js`

Heya, is there a reason why the env definition is in an mjs file as opposed to cjs or simply js? Reason I'm asking is because I'm trying to setup websockets and mjs won't work as we're compiling with commonjs.

Where would I initialize a 3rd party API to use in TRPC routes?

I am currently initializing this client in server/client.ts similar to the global definition of prisma. I then import client in my TRPC router. Does this make sense or would it be smarter to do that somewhere else. ```ts interface Client { $ad: typeof api.$ad;...

Next.js / React international physical conferences?

Does anyone know of any good upcoming Next.js / React international physical conferences?

is it bad to have many Prisma instances ?

I was using prisma and i was making a new prisma instance for each file and then i got an warning saying you are having more than 10 active prisma instances at once so i removed them and just exported one from a file but im wondering what's the issue with many prisma instances ?...

Prisma extensions and i18n

Hello! I have an issue with creating an extension that would append a computed field based on relations. I read in the docs that adding anything besides scalars to the needs field is impossible, so I wanted to take another approach and append relations using 1 extension. Next, I would use them in a second extension....

How to populate ShadCN search/comand component with options, but only have them show up when typing?

I want to use the ShadCN command/search component, but I only want about 3 or 4 of the options to show as deafult, the rest should be there, but only upon searching (with the correct letters)

Backend Nodejs with ts

which better for nodejs,expresss with ts use a ecma(imp,exp) or cjs(module)??...

TypeScript ESLint errors on deploying to Vercel but not in local environment

Hey! Hope you are doing great I'm seeing these errors on the building phase when deploying to Vercel (screenshot attached). But I can successfully build on my local environment (screenshot attached)....
errors on the building phase when deploying to Vercel