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

Typescript error when trying to access more user properties in my JWT token

Hello! I am using Next Auth and I have it built so that users will also have a username, and in my auth file, my jwt callback looks like this: ```javascript jwt: ({ token, user }) => { console.log("JWT CALLBACK"); console.log({ user });...

Type-safe url params in NextJS app-router, similar to tanstack-router?

Some tankstack router features: - "first-class search-param for managing state in the URL." - "Search Param Parsing + Serialization" - "Search Param Validation" ...

Typescript Error in Authorize function of CredentialsProvider

authorize typescript error
Type '(credentials: Record<"email" | "password", string> | undefined) => Promise<User>' is not assignable to type '(credentials: Record<"email" | "password", string> | undefined, req: Pick<RequestInternal, "body" | "query" | "headers" | "method">) => Awaitable<...>'.
project/js/next/dropship/node_modules/.prisma/client/index").User' is not assignable to type
Type '(credentials: Record<"email" | "password", string> | undefined) => Promise<User>' is not assignable to type '(credentials: Record<"email" | "password", string> | undefined, req: Pick<RequestInternal, "body" | "query" | "headers" | "method">) => Awaitable<...>'.
project/js/next/dropship/node_modules/.prisma/client/index").User' is not assignable to type
...

DB deployment help

I need some advice on deployment. Right now, I have an app that I want to deploy using docker to containerise it with mysql, but I found out yesterday that it’s very flaky and nearly crashed the VM I have it hosted on for my staging server (smallest linode instance) How would you recommend hosting a DB for a shop? Keep it as SQL and use SQLite? Use planetscale? Or go NoSQL/serverless?...

Can you get current request on server components?

I want to get authorization token from a request on a server component, is it possible? My use case: render if the user is currently logged in directly from the server...

Disable Es-Lint rule

hello how can i disable the following rule? eslintimport/no-anonymous-default-export i tried with the following .eslintrc.cjs file: ```js // eslint-disable-next-line @typescript-eslint/no-var-requires...
Solution:
Here's the fix: i needed to put "off" in an array + the correct eslint rule is : import/no-anonymous-default-export + also needed to disable react/display-name ...

Monitor recommendation?

Gosh I love Theo's video about headphone reviews. I planned to start saving some money and build my setup, I wonder do yall have any monitor suggestions? I'm kind of a one-big-monitor-enjoyer but open to hear any recommendations!

Styled components react native ?

Hello Do you know any component lib already styled like Chakra but on native React and if possible that uses nativewind?...

Need help in implementing web app for running Jupyter Notebooks

Greetings everyone, I'm looking to develop a web app that enables us to open, run, and modify Jupyter Notebooks. However, I'm unsure of where to begin. While I'm aware of nbviewer, it only allows us to view notebooks without editing capabilities. What I'm aiming for is the ability to not only view but also edit, save, and download them. Initially, let's concentrate on the editing and downloading aspects. Any assistance or guidance would be greatly appreciated. Thank you....

t3-turbo packages

How do I install packages for expo and/or nextjs? I'm using pnpm. I tried to do pnpm i [package] -w then tried to pnpm expo install [package] inside the expo folder but no luck Unable to resolve "@react-navigation/native" from "..\..\node_modules\@react-navigation\native-stack\src\navigators\createNativeStackNavigator.tsx"...

Error when deploying T3-Turbo on vercel (using yarn)

Getting errors while trying to deploy to vercel, using the commands suggested on the repo readme as well. I'm using yarn as the pkg manager. The error im getting is "@acme%2Feslint" or "@acme%2db" not found. I can't use pnpm because it breaks the whole trpc type system for me....
Solution:
Getting errors while trying to deploy to vercel, using the commands suggested on the repo readme as well. I'm using yarn as the pkg manager. The error im getting is "@acme%2Feslint" or "@acme%2db" not found. I can't use pnpm because it breaks the whole trpc type system for me....

Site analysis

What do you use to analyze your site performace? FCP, TTI etc. I have come across light house (too simplistic), Web Vitals (chrome extension), unlighthouse (doesn't work with auth protected pages). I'd like to analyze my site, any suggestions are welcomed.

Having issues with state and TRPC serverside component -> Like button on zustand

I am really struggling to get the correct state when refreshing the page. If i leave the page and navigate back to it, the state is always correct. But if i refresh the page the state is always set to false and not in sync with what's currently in my store. I believe it has something to do with the serverside helpers and the id of my post not being available on the reloads. Has anyone come across this behaviour. it's basically forcing me to do this ...

Accessing t3 turbo envs inside expo's app.config

Hey guys. It seems that my app.config.ts inside apps/expo is not reading envs from the root project. I have specified them In both turbo.json and .envs and in app.config.ts. Any suggestions?...

Does anyone know how to fix this vercel error?

Does anyone know how to fix this vercel error? Build error occurred Error: Invalid environment variables at file:///vercel/path0/src/env.mjs:85:11...

Credentials Signin NextJs

Trying to signin by authorize user but getting the error
crypto.getRandomValue not supported
crypto.getRandomValue not supported
in /callback Using prisma and user register perfectly...

onHover tailwindCSS

although this generated the correct class name, but the onHover property is still empty? Is there a way to do this? other than hardcoding it?...

Simple server solution when serverless is not enough

I am building an app and I need to connect it to either BigQuery or ClickHouse. Fetching this data warehouses from Next js api folder seem to had connection overhead on every request which makes it slower and more expensive. Does Theo, or anyone else have a good solution for this? I guess the reasonable solution would be to have a server always running, what solution would you recomend for this?...

Clerk JS Multiple Request

I have added auth as clerk js in T3 app, for some reason the clerk fetches the token in regular intervals, is that supposed to happen ?? also this happens when i switch tabs and come back to the app...

background tasks in t3 stack?

is there a recommended way to run background tasks with the t3 stack? I am putting some objects in s3 buckets and returning the response to the user, but Iwant the s3 event to trigger some processing which then will update my db. Do I need to spin up a separate lambda that connects to my database via prisma, or is there a built-in solution?