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

nanoid prisma schema /w planetscale

Hey gang, does anyone know how I can define a nanoid field with prisma if I am using planetscale? From the create-t3-stack example: ``` model User { id String @id @default(cuid())...

My company wants us to install Vanta Agent on our laptops

I am at an early start up, seed round. They are asking us to install Vanta , but we weren't provided company laptops. I don't really feel comfortable installing it on my personal laptop. I've interned at a well-known place before, so I thought I'd be getting a company laptop or tech stipend for one at this place. My laptop is 16gb ram and I run docker, db, and 3-5 microservices at a time, so sometimes my tools crash. I am considering getting a new laptop just for the job, but they just started l...

What is the `:::tip` syntax in markdown called and how do I use it?

I saw it in the astro docs, but it's not part of the default markdown spec. I tried to search for it, but it's hard to search for special characters.

Creating a related record with Prisma returning all records / how to get just one?

Hi folks! I'm pretty new to prisma so i have something a little annoying happening, love your guidance. I'm running some reporting - one batch has many reports... so first i create the batch ```js...

Issue adding import path to tsconfig.js

I wanted to create a path I can import my ui components from to make imports cleaner. Wanted to call the path "@ui" for ".src/components/ui/" but running into compiler issues. My tsconfig.json looks like ```...

getStaticProps next 13 with tRPC

I'm not being able to find a solution to get this working, I'm using create-t3-turbo but the createTRPCContext function takes req and res which are not accessible with the getStaticProps. Not only that but the Can't resolve v8 error also appears when trying to use getStaticProps Any ideas?...

Login in with credentials with next auth

Hello! I'm trying to learn how to use next auth with credentials. So i got this next auth settings: ```export const authOptions: NextAuthOptions = { session: { strategy: "jwt", }, providers: [...

TypeError: Failed to parse URL from /api/commands

why am i getting this error? i declared my component as async, and the route exists and it works. I also call /api/signup in another component's event handler, so i'm not sure why it's mad here

Can I zod this gamestate?

``` export interface GameState { id: string; status: "initializing" | "waitingOpponent" | "started" | "finished"; field: Field;...

Next.js conditional rendering

Hi guys! I just started with Next.js and I am a bit confused. How should I use conditional rendering here? I have an "Auth" boilerplate in which I want to render <Login /> or <Register /> based on prop/something. ...

How to refetch query after mutation?

I now this is very basic task but seriously i don't know how to do it.

Using undefined for empty input field in react-hook-form

First off: I feel I'm thinking way too complicated here, but can't wrap my brain around it, so here we are: Let's say I have a schema: ```typescript const MySchema = z.object({...

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 ...