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

Zod File Upload Validation with Open-Api Support?

Hi guys, anyone know how to validate file upload with zod and get also open-api support?

Zod File Upload Validation with Open-Api Support?

Hi guys, anyone know how to validate file upload with zod and get also open-api support?

Zod validation and open-api support for Express.Multer.File or any File type on the server?

Hi guys, anyone know how to validate a File upload using zod? and also have open-api support?

Caching Data for a trpc endpoint

I need to hit an external API every few minutes to update my local data Call this BigDataList ...

React Query - Slow performance with many small cached requests

I have a list of accordions. Every accordion have items that contain image. On accordion click, I fetch items text data and image id to speed up list loading and load images later. Inside an item, I use image id to fetch an image per item. Image is in base64 format. In every accordion, I can have 10 or more items, so in total there can be few hundreds. ...

Can you run a NextJS project on a closed network?

I would like to run a NextJS project in a closed network that doesn't have access to the internet. Assuming i have all the dependencies already installed, can i just run the project, will it work?

Weird min-width: max-content behavior (jsfiddle)

Can someone explain to me what's happening in this fiddle? https://jsfiddle.net/th147dmf/53/ This is a simplified version of something that is happening in my actual app. If you comment out the width: 1px the overflow behavior is ruined, even though the 1px width doesn't seem to be used....

Discord/Slack page embeds not working

Hello - I am trying to add some meta tags to my Next page so that the metadata is collected by Discord when I link my website. I'm following the instructions from here: https://stackoverflow.com/questions/54266598/meta-tags-for-url-with-description-and-image-in-skype-discord, and have added the tags to a Head component in the image below (hardcoded to test functionality). These tags are visible when inspecting the elements on the production site (in my browser at https://playbook-sand.vercel.app/play/cleihuzk30005cxcizs743oim), but for some reason they're not appearing as a Discord embed. I do not believe caching is the issue as I've tried adding random strings to my URL to force a refresh from Discord. Does anyone know if Next automatically hides these tags from scrapers or something? I'm a bit lost on how to fix this and hoping someone here has had a similar issue....

Promise-returning function provided to attribute where a void return was expected.

Hello, doing app with t3. I am using react-hook-form and I am getting error from handleSubmit: Promise-returning function provided to attribute where a void return was expected.eslint@typescript-eslint/no-misused-promises ```ts...

Prefetching more items than requested on client side

Hey guys, I was wondering about prefetching a long list of items (100) with getServerSideProps, but then - user will request just 10 of them on every page. Is that actually going to work and take 10 items of prefetched 100 every time?...

How can I cache blob image provided by backend (React)?

I have a list of accordions. Every accordion have items that have images. On accordion click, I fetch items text data and image id to speed up list loading and load images later. Inside item I use image id to fetch image per item. I get a blob which I convert to URL with URL.createObjectURL(blob) I use react query, so I can cache and stale request response. However, even if the request is cached, the image doesn't load instantly after closing and opening accordion, probably because it creates new image URL from blob....

How do I find OSS to contribute to?

Hello, I'm graduating this semester and I want to boost my resume and get experience by contributing to OSS, but I have no idea where to even find something to contribute to. I assume there is a better way than just looking through the explore page on GitHub. Do you all have any advice? ...

toZod package - Inferring schema from return type

Anyone have experience with the toZod package? I've used it to infer schemas from types, but now I'm trying to infer a schema from a return type (generated from trpc's inferRouterOutputs): Typically I use it like this: ```...

Where to check if user is owner

Hello, I have and app with three entities User, Deck and Card, and now for any operation on card/deck I need to check if user is owner of that deck I'm doing it like this: ...

Does anyone know of a way to programmatically lift classNames into typescript intellisense?

For example, if I import this component somewhere else, I'd like to be able to see the classNames that were applied to the div when I hover over <Example /> ``` export const Example = () => { return <div className="h-fit w-fit bg-red-500">Example</div>;...

How to make emit when some variable changes?

I have a websockets server, in which i want to fire emit when there are n amount of users only ONCE. But for some reason it fires 2 times instead of 1. How would i get desired behavior?

regex

\"/cdn-cgi/l/email-protection#1a726d2d2385a7f777570737e7b753475687d25696f78707f796e27577b68717f6e73747d3f282a567f7b7e3f282a7b6e3f282a5e756f78767f3f282a4a68756e757975763f282a75743f282a5968636a6e75796f68687f7479633f282a50757869\"
\"/cdn-cgi/l/email-protection#1a726d2d2385a7f777570737e7b753475687d25696f78707f796e27577b68717f6e73747d3f282a567f7b7e3f282a7b6e3f282a5e756f78767f3f282a4a68756e757975763f282a75743f282a5968636a6e75796f68687f7479633f282a50757869\"

Types have no overlap, but i have defined the type so that it does in fact have overlap

This is the error that i am getting `This comparison appears to be unintentional because the types '"KVA"' and '"XYZ"' have no overlap.ts(2367)`` Why is this not working 🙂 ?...

Recommendations for auth setup

I've been rolling Auth0 with the nextjs library for Auth0. Now I need to do a full re-write of the site and I'm considering other auth options. Allot of auth0's features cost money, the admin UI is terrible and the login screen we get form auth0 could be more sexy Whatever happens I'm shifting to NextAuth, but what providers do you guys prefer? I want email+password login, about 10-20 users a month. O365/Google login would also be nice, but is not necessary. I don't mind self hosting, the most important part is a good DX and ability to store data about users (like what they should have access too) ...