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

What about Panda CSS?

Hey there! I can't find any talk about using Panda CSS over Tailwind on this Discord. I would like to have different opinions (especially from people with CSS skills) about it, I just started using it on a personal project with Next.js and I find its integration with TS awesome. Theo's recent video about Tailwind is not talking about this kind of solution. https://panda-css.com...

NextAuth sign in function not working properly

hey, i have nextauth set up with credentialsProvider on, i have the following onClick on a button: ``` onClick={async () => await signIn("credentials", { email: "some eamil",...

Fetching only once

so i have an authToken being stored in the local storage and i want to send it in a POST request each time the user opens the site to check if its still valid, but how do i make the POST request only fire once when the website first loads, that way i know if the user is authenticated or not and dont have to fetch it again while they are using the app. Im using next 13 with the app dir

import mysql into planetscale

Has anyone imported a database from your local pc into planetscale? With regard to the hostname what do i use? I've given it my local mysql hostname (eg my-macbook-pro.local) but I keep getting an "invalid" error.

Promise.all is not working in transaction in drizzle

Can anyone tell me why this transaction is not working in drizzle? it does not throwing any error but it is not deleting it either ```js "use server"; ...

shortest import path with eslint + tsconfig.json paths

Is there any way to configure eslint (I am using eslint-plugin-import + eslint-import-resolver-typescript as well) to use the shortest import between my "absolute" path configured in my tsconfig, and just the relative path? For example if I have "src/*": ["./src/*"] defined in my paths, I want the linter to pick src/components/myComponent/MyComponent over ../../../components/myComponent/MyComponent, but pick ./MyComponent over src/components/myComponent/MyComponent. Thx

GitHub workflow doesnt run

I have this PR here which requires the CI to pass but it doesnt run. Do I miss something or have I something configured wrong? https://github.com/alex289/CleanArchitecture/pull/10...

getServerAuthSession returning null in production

I have absolutely no clue how that is happening because I've implemented the same solution in another app before and it works perfectly, but for some reason, this code only words in localhost: ```typescript export const authenticatedServerSideProps: GetServerSideProps<{ session: Session | null;...

Not able to get the jwt token through cookies

Hii all I'm trying to send the jwt token through cookies like first image .. Now I 'm trying to fetch the data after login as shown in second image.. Through postman everything is working out but from fetch it's saying unauthorized.. after debugging I found out that cookie is not reaching there.. Can anyone help here?

Next api routes stoped working since clerk installed

I installed clerk in my app and auth is working as expected. My probles is that all my api routes stoped working, all of them throw error 404.

Disable batching multiple useQuery

I'm using useQuery as below: ``` const CompanyPage: NextPage<{ asxCode: string }> = ({ asxCode }) => { const { data } = api.company.getByCode.useQuery( ... ); // Quick query const { data: historicalData } = api.company.getHistorical.useQuery( ... ); // Long query...

TypeScript

Hi guys i am trying to learn TypeScript. Is there any good resources you can suggest besides the documentation ?

Zod type email string and number message not working correctly

Hey guys i am facing a issue i am also new to typescript ```ts const authschem = z.object({ email: z.union([...

next auth jwt session

Hello im having some problems with making the session for credentials provider i managed to make it for google provider using the Prisma adapter but since there's no adapters for the credentials i tried to make it with jwt but i don't have any idea if this is the right implementation That's the github repo : https://github.com/CLOG9/PuzChess ...

How to pass typesafe react-hook-form form object

I'm using react-hook-form to handle update user profile form. ```typescript const form = useForm<FormData>({ resolver: zodResolver(updateProfileSchema),...

Flattening data structure on backend or frontend commonly?

like nested data structure to become array of objects with 1level depth ,u flat it on backend or frontend i can do either but wanna follow best practices thx

Getting drizzle working with next-auth

Has anyone gotten drizzle working with next-auth? Here's the implementation that I've been using: https://github.com/c-karaolis/drizzle-next-auth-adapter-postgres/blob/main/src/lib/drizzle-next-auth-postgres-adapter.ts From what I can see I have all of my callback urls set up correctly, all environment vars that I need, and nothing else that is barring it from working that I can remember from previous times of setting it up. ...

How can I make node.js package that have a custom command?

Like "npm", "next", "prisma", "drizzle", etc. things whenever you start a command. How do I find terms/keywords to implement this....

How much do you usually save in your db when using an external service like clerk?

As the title states, aside from saving the external id to reference, do you save anything else from the external service?

Should I condense my hooks output array?

Hey guys, so I have my useValidation function and it returns the following array. ```ts...