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

Need help with writing a function that accepts a trpc client router

```js interface CreateModelProps<GetResult> { name: string, procedures: DecoratedProcedureRecord<{ read: BuildProcedure<"query", any, any>...

shadcn .ui Select is no, it's working

i think the problem is coming from import { Check } from "lucide-react" I am not sure what to do
>...

drizzle many-to-many

https://gist.github.com/barrybtw/f4c54bf7bdac98af34069363d7b1be87 Trying to setup a many-to-many relationship between calendar and user. But I'm getting some weird Typescript errors. ``` Argument of type 'Relations<"calendar_participant", { calendar: One<"calendar", true>; user: One<"user", true>; }>' is not assignable to parameter of type 'Table<TableConfig$3<Column<any, object, object>>>'.ts(2345)...
Solution:
oh wait im a dumb dumb i was using the relation definition instead of the table for the many relation input

Async event handlers

First off, I come from Vue. I've barely touched React before, but not much. This is my first time using t3, so my assumptions could be wildly wrong here. How are you supposed to do async operations in reaction to dom events? If I create an async handler function, and attaches it to an input's change event (onChange={handleChange}), ESLint fires off with ESLint: Promise-returning function provided to attribute where a void return was expected.(@typescript-eslint/no-misused-promises)....

AWS Amplify Auth on a NextJS app

Hello everyone. I have a NextJS 13 app and I want to use the Amplify auth SDK for auth since it's convenient. The "problem" is that I've found it to be mostly a client-side SDK whereas I want to use it strictly on my API routes. Should I use it or should I go for raw Cognito ?...

Weird next-auth behaviour

I have a weird issue happening lately with next-auth. Whenever I call signIn('provider') , I get redirected to /api/auth/signin, and if on that page I click on whichever provider, I get redirected again to this same page. No errors are logged, even with debug: true set in nextAuth itself. On localhost, everything runs fine, even with a ngrok setup on top of it. I've already stripped away all of my custom configurations of next-auth, double checked my .env variables which seem to be in line with my production server (that is running fine). And the problem can't lie in the provider itself, as it's happening with every single provider, + email login (which doesn't trigger any of the next-auth stuff, and just redirects me back to /api/auth/signin. Would anybody know where I can continue to debug this? ...

Simple SSR + Hydration with tRPC and Next.js 13

I would like to see a simple example, where on server side all users are queried and the view with all these users are served. (Something like <Table data={users} />) I also want the option to search users by name but it should hydrate the view, so I want only get JSON from the server and re-render the view. ...

t3-turbo import alias in packages

Hi all, I want to install shadcn Ui in the tailwind-config package as I have multiple nextjs apps that need to share the design system. ShadcnUI uses import aliases to help reduce complexity, such as importing the CN function from lib/utils. Typescript is very happy with the imports in the package but when I try to import a component e.g button into one of the next apps it then complains that it can't find "@/lib/utils". Is there some rule that imported packages can't have import aliases?...

Does the next.js have types for getServerSideProps context

Solution:
have had much more luck not declaring a type on the function itself, and instead just typing the context as GetServerSidePropsContext

T3 stack app blog tutorial

Is there any blog type tutorial for creating a large t3 stack app like twitter clone that i can follow. I don't like video tutorials. For me blogs tutorial are more helpful...

Prisma and mySQL 'POST' method 401 Unauthorized

I have Prisma synced with mysql database (mariaDB). I have a "dashboard" that I can access with auth through discord. There I have a form that does POST (and prisma.[whatever].create()) method on submit, but I am getting a 401 error Unauthorized. Just for reference, fetching data with GET and doing prisma.[whatever].findMany(); works normally...

Inviting Theo to a conference

Hi, I would like to invite Theo to a conference. I try to figure out how can I send a message to him. Please let me know whether is there a way to do it without violating the rules of the servers.

error uploading images in production, works in development

I’m using UploadThing for my app but getting an error toast in production. Deployed on Vercel, environmental variables are up to date with the same keys as development. Also redeployed after adding the variables. Is there anything else I should be setting up?

Include txt into tsc build

I have a ascii.txt file which I read with fs since formatting it correctly in a ts file is a nightmare How do I include it in the build...

useSuspenseQuery halt until server action is called

Hey, server-action dummy here. I have a query in useSuspenseQuery that I want called only when a form is filled and submited. Ideally this should all be server-components ? https://github.com/Nsttt/nameseeker/blob/2746ec2528c3897661ffcb21937c94d3168934da/src/components/serviceList.tsx#L65 ...

How do tRPC WebSockets work with NextJS

Hey! I've recently stumbled upon this repo: https://github.com/trpc/examples-next-prisma-websockets-starter. I'm a little confused on how it would be able to hold a connection with a serverless environment....
Solution:
it looks like they setup a websocket server there, and host they on "render"

How Next.js 13 middleware is used as error handling?

My Next is currently used as a back-end framework, and the middleware only processes related api files. Now I have implemented the function of uniformly detecting apiKey, but I also want to add an error capture function for all apis. How to achieve it?

shadcn/ui is not really working ,it's rendering the elements but the styles are not there

The settings code: https://paste.gg/p/anonymous/1c892ec175414194b78aabc303312bc8 If any more information, please tell me what you need...
Solution:
This is the file structure

Uploading multiple files at once using uploadthing

Hey i currently set up uploadthing on a website to upload productImage, however, products might have more than 1 image and the UX of having to pick each of the images one after the other one has finished being uploaded seems not so fun So i wanted to ask if it was possible to upload multiple files at once in uploadThing, thank you....

[tsup] making a package

```ts Error: Command failed: taskkill /pid 13244 /T /F ERROR: The process "13244" not found. at ChildProcess.exithandler (node:child_process:419:12)...