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

should I use react-query or tanstack-query?

im not on a framework yet like nextjs or t3, but i will be learning those in the future which library should i use to replace my vanilla useEffect fetching in a react project? note, I want to learn tRPC/t3 stack in the future, so ideally the library which will prepare me more towards these will be good...

Clerk Role Based Auth

Hi, how do you deal with role based auth using clerk? I have 3 roles: Admin, Moderator and User. All users have the role User by default. And the User can't access Admin or Moderator pages. I can't find any resources about that.

Should we still be using react hook form in nextjs 13?

As the title says, should we be using react hook form in nextjs 13? or should we just create html style forms ? what's the pros and cons of each? Personally i'm running into CSS rendering issues while using Tailwind with react hook forms in nextjs 13 app dir and looking at how the official nextjs 13 form example makes me reconsider using react hook form...

error when deploying at vercel

does anyone know why this happening?

Error when studying trpc

Hi I am new to this t3 stack and really like the idea of it but just tried to build a notes app but unfortunately got an error. Could someone please help me out and let me know where I got it wrong? https://github.com/GeroWalther/notes_trpc

Using database-js to test Lambda function locally

So... I have a lambda function which should connect to Planetscale on prod. When developing locally, I want to connect to my localhost database. I also test my lambda function locally using serverless invoke local (https://www.serverless.com/framework/docs/providers/aws/cli-reference/invoke-local). Am I choosing the wrong approach here? How do you test your Lambda functions locally?...

Switching to double quotes and adding semicolon on save

I just created a new project with pnpm create t3-app@latest. How do I change the project prettier config so that it uses single quotes and no terminating semicolons?

Prisma zod enum validation

I have this prisma schema: ```ts enum RealEstateType { house...

'Component' cannot be used as a JSX component.

``` import { type AppType } from "next/dist/shared/lib/utils"; import "~/styles/globals.css"; const MyApp: AppType = ({ Component, pageProps }) => {...

T3 and GraphQL+Neo4j

Hello I am interested in combining those technologies because I need Neo4j for my project. Has someone tried stitching it with T3? If not, can someone guide me on how to achieve this? Thanks...

Google provider with dynamic links

I am using Next-auth and Google provider, the problem I have is whenever I make a pull request, I need to add the preview URL to Google console, but this is not how it should work, neither Google nor Chatgpt understand my question, can you help me out with it?

Neatly extract tRPC middleware to make it reusable

Does anybody have a snippet for neatly extracting a tRPC middleware, while also maintaining all the typesafety? I was able to hack something by importing MiddlewareFunction and extending a new interface from the ProcedureParams, imported from @trpc/server, omitting the _ctx_out and _input_out and replacing with mines, but it doesn't seem the right way....

Is there a library for grid-based drag-n-drop?

Hey, hopefully, the image makes sense. I'm looking for something that would help me implement this. The grid itself is dynamic (configurable) and I'd like to define custom rules for placing the elements on the grid - e.g., for detecting stack bonds. Has anybody ever seen apps or examples online that achieve similar behavior with libraries like dndkit/muuri/something else? Thanks.

Search URL structuring

Hi guys, I have a dynamic URL in Next: search/[word]/[[...rest]] and I was wondering how would I parse this best? I don't want to build the URL out directly, I want to keep it somewhat dynamic so I can do something like this: /search/Hello T3/tags/typescript|next/length/1-10 and structure it any way I like and leave stuff out I don't need. My code currently is this, but I feel like this is super stupid: ...

SCSS file being compiled as JS and (obviously) erroring on Nextjs "Collecting page data" step

I am quite stuck. Trying to get PayloadCMS running within NextJS by using the @payloadcms/next-payload package. All seems OK but when I run a build I get an error on the cjs loader not understanding SCSS syntax. In dev mode all is fine. I am not sure if the issue is even related to the payload package. How can the cjs loader think a scss file is js?...

Execute an external TS file in a T3 Stack app

Hello, I have my T3 stack up running and I need to execute a ts file I already searched online and tried using node-ts and tsc but neither work. Do you have any idea about how I can do this ? Thanks !...

Using Cloudinary

Hi guys using cloudinary but seems transformation is not working``` const fetchPosts=useCallback(async()=>{ const { data:files } = await supabase .from('category')...

NextJS(13) API call cache MISS

Hey everyone hoping for some help with an issue that is cause me a mountain of headaches. My app is having webhooks forwarded to my API route from StipeCLI. if a certain event type is forwarded I want to fetch an API route in my Next app. shown below: (BEEN STUCK FOR A WEEK< PLZ HELP) ```ts switch (event.type) {...

Recursive References in TypeScript

I'm stuck with a very specific TS/JS problem, which may not be solvable but I thought I'd see if anyone here has a cool idea on how to solve it. So I have a file index.ts with a mapping from some keys to objects: ```ts import A from "a.ts";...