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

wtf prisma errors

How am i supposed to know what the hell is wrong here lol

Syntax Highlighting

What do you guys usually use for code highlighting? Anything that works well with tailwind?

please i need resource recommendation for pagination on trpc the official docs is very confusing

Please any recommendations will be much appreciated be it video or blog post or code snippet etc

does filtering this way have any performance issues? is it a good practice?

yes i know they is or and where etc just asking 😀

Type error at custom fetch function for tRPC client

Hey. I'm running an Electron app as my front end. I used tRPC for the API which will communicate with my back-end, all good there. However, since it's an Electron app, I needed to give it a fetch function otherwise I get this error:

AccessToken for external API communication

What would be the best approach to pass the AccessToken from NextAuth Session to the Http Client which is being called from tRPC procedures to access external API?? Should I attach the AccessToken to the request object from NextAuth session callback and then provide it to the HttpClient instance in the tRPC context initialization for the request?? Or is there better alternative to handle this?...

object updating incorrectly

I feel like i'm missing something fundamental here. when I add a new entry into object b it resets to an empty object upon a subsequent request. Can anyone help? ```js addNewTicket: ticketsDomainProcedure .input( z.object({...

Securing API Route for use with IoT devices

Hey, what would peoples recommendations be for securing my nextjs api for use with Iot devices. Previously I would use a JWT, or OAuth to secure them but im not really sure if this would suit an iot device. Essentially my device needs to be able to connect, and then send some telemetry data over https, and will do this at random intervals. ...

Best Practices When Using Components with Tailwind

Hi all, just wondering what the best practices are for passing additional class names as props for a component using Tailwind. Is this the recommended way, or is there a better alternative?

How to enable tRPC (v10) queries that don't have data passed in them

Just updated to trpc v10 and have no idea how to enable/disable queries. Couldn't find anything in the docs. Here is what I'm trying that doesn't work: trpc.subscription.getUserSubscription.useQuery(undefined, { enabled: !!user?.customer && !!user.individual })...

Programmatically determine which field to update in a Prisma mutation

I want to update a specific field in my database. I'm passing the id of the record to update, the name of the field and the new value for this field, into my router to the chgField procedure. Can this be done with some syntax like that shown in * input.field: input.nu * below , if so, help on the syntax here would be great (this doesn't work). ```ts export const peopleRouter = router({ chgField: publicProcedure .input(...

How to add item to array in prisma database at frontend?

Hello, lets say I have user and this user have coins. How can I then inside a React component add coins to this array? And then displaying them on different page? For example: ```model User {...

allowsMultipleSelection React-Native error

I got this error but only when setting allowsMultipleSelection to true but not when setting it to false. Anyone who knows why?

Next 13 - App Directory feature and tRPC

Is there any pre-release version of create-t3-app which has been updated to App Directory feature and also updated tRPC accordingly?

Why does tailwind have so few default options for min-width?

I'm getting into using tailwind and so far I've found it far easier to work with than css-in-js or other solutions I've tried in the past. However, I'm wondering why there are so few default options for min-w-*. It kinda makes me think I'm doing something wrong. For example, I have a page with some user generated rich text. I want this to have a max-w-prose so that the lines are always readable. However, on larger screens when the user hasn't entered much text, the rich text area is extremely narrow....

Typescript React Component Props Error

Hi, I'm trying to implemented an AuthenticatedRoute component. I'm wrapping the Route component from react-router-dom. Getting a frustrating TS error. I just don't understand how to fix it, can anyone help?

Turborepo + Prisma + TRPC

quick sanity check before I drop the idea of letting turborepo cache prisma has anyone run into this error when using prisma + a custom generated output with next-auth or trpc? https://github.com/prisma/prisma/issues/13233...

React + Typescript...Its return type 'Element | undefined' is not a valid JSX element.

React + Typescript...Its return type 'Element | undefined' is not a valid JSX element. I have a component where I did consume from an API that returns an array of objects but the parent component is giving me some error that says `'UsersTable' cannot be used as a JSX component. Its return type 'Element | undefined' is not a valid JSX element....

Ok, so what am I missing

I get a
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. when the changeFeildValue handler is fired.
import React from "react";...