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

_app

Stale Environment Varaibles. Hey everyone, I had a quick question about stale environment variables when using CT3A. For some reason when I update my .env file it seems like I have stale variables and the updates don't take effect. I tested this with printenv and it seems my current work around is to - remove yarn.lock - remove node_modules...

Typescript Function to make specific nested keys non nullable?

Does anyone know of a Typescript Function to make a bunch of provided nested keys non-nullable? Sometimes I want to reuse a GQL type but want to remove a bunch of nulls/undefined from nested keys. E.g. ```ts type User = {...

how do I send complex criteria in a get request?

I have this db where I need to fetch a certain data from a certain table, and I want that data to be filtered depending on the client's needs. and the filtration goes like this. ```js const body = { props: ['title', 'id', 'qrCode'],...

Requirements to start with t3

I just joined so hi everyone :). I was very interested in Theo's videos and would like to build something using create-t3. I'm a full-time React developer, but only with a year of pro experience and unfortunately I don't have much knowledge about backend, databases and the like. Before delving into next.js / prisma and so on, do you suggest learning node.js and some databases first? Maybe something more? If so I would appreciate suggestions. It seems to me that I should do so, but maybe I'm wrong. Sorry if this is a "stupid" question, have a nice day...

Tool to find unused functions

Is there a tool to find unused function in a node codebase?

Many-to-many relationship in SQL as table or JSONB array?

Hi! I'm new to SQL and I'm wondering which way to model data makes more sense. I want queries to be performant, yet I don't want to over-engineer. My database is PostgreSQL in Supabase. I'm modeling players and games where each player can be in many games and each game can have many players — so a many-to-many relationship. I've enabled Row Level Security so a player only has access to the games that they participate in....

Why typescript type inference is behaving like this?

Screenshot 1: Does not work! Screenshot 2: Works!! 😵‍💫...

How would you run something like eslint locally? (contributing)

So I'm wanting to contribute to eslint_d but I have no clue how to run it locally. How do you test your local changes that you want to attempt to make with a package like this?

Is MongoDB Atlas killing my company?

In a recent video about hosting solutions, Theo reluctantly added Atlas as an option for database hosting. Saying: "Guys, I'm looking for hosting solutions, not ways to kill your company" Now as someone who has a company and uses Atlas I'm rather curious where the resentment is coming from....

Proper use of useEffect with KeyboardEvent eventListener

If there is state in my onKeyDown function which is set in document.addEventListener("keydown", onKeyDown), how would i keep my state within onKeyDown from getting stale? Should it be added as a dependency in my useEffect? For example: ```useEffect(() => { document.addEventListener("keydown", onKeyDown);...

writing tests for trpc

i am aware of theo's stance on tests, but we really need them we're building a payment gateway can't fuck with money. how do we write tests for trpc, couldn't find anything in the docs

Most performant way to check props against a massive list?

I'm building a component that takes in a large amount of boolean props and uses the prop key as a className value. I was thinking of building an array of starting values that can be used to check each prop against, in order to determine which props are valid as a className. However, iterating through this array for each prop is not very performant. I know I can check each prop for values it can't be, like "aria", camelcase etc. But still, for valid props it will need to iterate through the array with an O(n*i) which is not ideal. Perhaps there is a different approach to this problem?...

Is there any reason to use start a docker container without using compose?

I have always run docker containers using docker-compose, even if it's just a single container. But every guide I see for dockerizing things includes instructions for how to build and run the container without compose, something like
docker build -t ct3a-docker --build-arg NEXT_PUBLIC_CLIENTVAR=clientvar .
docker run -p 3000:3000 -e DATABASE_URL="database_url_goes_here" ct3a-docker
docker build -t ct3a-docker --build-arg NEXT_PUBLIC_CLIENTVAR=clientvar .
docker run -p 3000:3000 -e DATABASE_URL="database_url_goes_here" ct3a-docker
...

Whats the correct way to wait for `trpc.useQuery` to finish and then update state?

Like the title said, I have a case where I need to press a button 2x to update my state. That happens because useEffect does not wait for useQuery to be finished. Is there a way to sync those two ?...

Kind of stupid question

But I've recently discovered T3 stack. What are some interesting project ideas to build with it?

Is there a guide or best practices about hosting a web app build with T3?

Really curios about how you guys go about this. You host database + backend + frontend in the same place? Or do you like to split things.

why don't we have a compiled version of css and html?

The development speed wouldn't be any better. it might take a bit longer to setup, but the result is gonna be really good. - less memory needed. - no parsing which means faster runtime. and if it's well optimized for the size it's gonna be even better. because of the lower latency....

Documentation section inside an already made React app ?

Just looking to create an accesible documentation section without the need of creating a different app for that purpose, not really limited to, but wondering if I could run some sort of Docosaurus inside or if anyone know any other alternative.