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

New NodeError (looping error)

I sometimes get this error over and over again in a loop, and can't figure out what's causing it. Anyone else seen this? ``` at new NodeError (node:internal/errors:393:5) at Function.fail (node:internal/assert:20:9)...

trpc query only once parameter is not null

New in T3 stack so forgive me if this is a noob question: I am trying to run a trpc query only if a user is logged in. The user id is part of the query parameter. const { data: sessionData } = useSession();...

React Table getting weird key error

Hey guys, using react table in my current project. I was getting linting errors on Vercel for not having a key on my .maps inside of the table, so I tried adding them, however im getting some strange errors that I haven't really been able to understand whats going on. I have a code snippet of my head below, and screenshot of the error I am receiving . "'key' is specified more than once, so this usage will be overwritten." Any ideas on whats going on here? ...

Unsafe return of any typed value, using prisma upsert

Hi all; I'm getting a lot of warnings in my IDE in this code; `...

How to make the NextAuth custom signin page typesafe?

Hi all! I am trying to make the custom signin page described here: https://next-auth.js.org/configuration/pages In a typesafe way, but I only get it worked with suppressing a lot of eslint warnings, which I don't want to do. Does anyone has an example of how to do this in the proper way? The errors I get are:...

Complicated recursive types for self-relations in prisma models...

Prisma documentation says that types only contain the model's scalar fields, but doesn't account for any relations, thus you must use GetPayload. Prisma Model: ```model Category { id String @id @default(cuid())...

Next Auth + Next13 error

Error: [next-auth]: useSession must be wrapped in a <SessionProvider /> I get this error in the console when I want to wrap myApp component. I'm using Nexta13 and I'm not entirely sure if my folders are well organized. Maybe the error is due to this? Could you take a peek? ...

Refetch minimum duration?

I wish to always keep data up to date and I use ```json { refetchOnMount: true, refetchOnWindowFocus: true,...

tRPC "Cannot destructure property 'client' of 'useContext(...)' as it is null"

i'm using create-t3-app. i'm trying to call my trpc endpoint from my frontend and i get
TypeError: Cannot destructure property 'client' of 'useContext(...)' as it is null.
TypeError: Cannot destructure property 'client' of 'useContext(...)' as it is null.
...

Clerk auth

Curious to hear what people have to say about Clerk, and if anyone have experienced any issues, or challenges while using it. Mainly for Expo now. I am looking into it now that I want more auth providers other than just email/password, and I want to hear from someone how's been using it for a while 🙂...

Anyone have any opinions on using Vitest or Jest for testing a NextJS + TS app?

Hey, Im building a Nextjs app with TS, NextAuth and Prisma. Just wondering if anyone has used Vitest and Jest in production and could give their opinion on them?

trick to handle potentially undefined values

In my user table age is optional So my code looks like ```javascript await ctx.prisma.user.create({ data:{...

best way to handle image upload in t3 stack

I Am trying to upload image to digital ocean space which is similar to s3 bucket But i would like to do it from the backend How i approach this before now i create a function on the front-end then i upload them from the front-end straight then return the url location to the backend but am scared of my keys been public ...

trpc useContext()

what is useContext and how to use it and why we should and whats the best case to use it

Dynamic page omit assertion of router.query

Hey , I am using an eslint rule that prevents me from invalid template literals. Is there anything I can do to omit pid as string ? ```ts import { useRouter } from 'next/router' const Post = () => { const router = useRouter()...

Getting ts-jest to work with testing files that use the .env mjs files

I'm trying to write a unit test to verify some code. This code uses the t3 env variable which is setup in these .mjs files. When I run jest it keeps failing to import from "./schema.mjs". Does anyone have an example repo which has test working fine in this scenario?

Make a button which downloads PDF

I know this is a noob question, but I haven't actually done this before. I have a nextjs web page. I want to make a button which downloads my resume as a pdf. How would I do this ?

Failed to load next.config.mjs

When I run my T3 App, It shows Failed to load next.config.mjs ```
frontend-new@0.1.0 dev next dev
...

Turborepo, Docker and multiple Nextjs Apps.

Hi guys, i need some help, i have a monorepo (turborepo) of nextjs proyects, and they have a lot of common dependencies like react, next, etc. So i'm trying to dockerize my monorepo, and trying to 1 only install common dependencies once and 2 trying to reduce the final image size of each service, i already try it nextjs standalone and fail 😦 . Anyone know how to fix this?

how can i useQuery() useMutation() in a useEffect

I have a response sensitive trpc(t3 stack) route With the current way t3 stack works this is a bad idea Because everything must be block scope i can wrap calls in useEffect to enable me determine when it should be triggered ...