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

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

On line 18 of https://pastebin.com/9EXv58Bn I am getting the error shown in the title. Should I just disable this eslint error with // eslint-disable-next-line @typescript-eslint/no-misused-promises as suggested in the "Quick Fix" ? Or update the default .eslintrc.json provided by create-t3-app?

HeadlessUI & Astro

Is it possible to use the react tailwind ui components (based on headless ui) in an astro project or i should stick with the default js + html template for the components. Really want to try out astro as an SSG but most of the code we currently have is in React.

Python app + nextjs frontend writing to the same database

I have a python app (discord bot) that keeps track of settings/stats in a postgres database. I want to build a dashboard with the t3 stack where you can view and change those settings, but I'm worried about schema clashing with prisma. I currently use asyncpg and no ORM in my python app and plan to use prisma on my frontend. I'm early enough in development where it wouldn't be an issue to switch to prisma in my python app, but that might create more issues like schema sharing. Also, is possible to create a monorepo with a nextjs app and a python app? I couldn't find anything answers online....

Is there a String Union Type of all HTML Element names?

Pretty much what the title says. I want to be able to pass in any name of an html element, to then apply a style to, and return to the user.

How to make tRPC calls from the server side

I have tried following https://trpc.io/docs/server-side-calls however I get the error shown in screenshot Is it possible to call one tRPC method, from another on the server side?...

Need help to approach Layout issue

So i've got a Layout wrapper component for my (almost fully) static app - Problem is, this Layout requires certain Static Data, product categories. The way I do it now is every page calls my <Layout categories={categories}/> component with the categories props which are statically fetched on every page's getStaticProps - Is there a good way for me to be able to wrap this Layout component across all pages in _app while still having access to the categories data?...

How does one handle a lot of conditional rendering based on the permissions of the logged in user?

It kind of seems annoying to have check(user.permissions, Permissions.MANAGE_OTHER_USERS) for everything, especially when different permissions activate different UI elements.

How would you securely call a protected tRPC route from a webhook?

I want to call a protectedProcedure from a webhook, but how could you do that without a user/session? What could I pass to ensure the call is coming from my webhook?

Any suggestions for good resources to learn about refactoring react applications

That can help us understand the industry standard tips and tricks, that will allow us to build large applications in react.

Why is my Vercel Analytics score so low?

I'm getting 90+ on performance on Lighthouse tests and Google PageSpeed Insights. However, on Vercel it shows 45 performance score with LCP and FCP of > 10 seconds. Anyone have an idea what the problem could be?...

Type of field based on sibling

Hi all, I'm trying to construct an interface for a constructor. It would work like this:...

can I have overlapping primary keys? (mysql)

I have this DB where I have two entities that has to be managed by a user. The user can manage either one of the two entities or both. So here is the structure: ```sql create table users(...

NextJS for SPA

Does anyone have any thoughts on using NextJS for a pure SPA? Assuming this is app will be delivered on a private network, therefore SSR and SEO are of no concern. This would be delivered as a pure SPA or at most a Node server with a very limited number of routes (perhaps Auth if NextAuth is a big boon to authenticating with something like LDAP)....

create video on nodejs

i have 2 buffers - 1 audio file and 1 image file i want to join both of those into a video, extend the image until the audio ends i tried using ffmpeg, but then it can't take 2 input streams and there was another lib fluent-ffmpeg-multistream which also didnt work...

Hide console.error when mocking error response in jest?

I'm writing a few client-side unit tests and want to assert what happens when an error is returned from the procedure. My tests pass ok, but I end up with a wall of console.error's when I do so. I don't want to mock the return value of console.error so that it never fires, as there may be some valid errors that are thrown that I want to catch, especially when running my tests on my CI/CD....

Best practice making multiple TRPC calls

I have one component, that needs to make two API calls. The first call callOne, happens on page load. callTwo should happen once the user selects data rendered from callOne, I'm having issue finding an elegant solution to this. My current solution is just the following within the component (this works, but callTwo is called much more than is required, including on page load, and every unrelated prop change). ...

T3 + sockets?

I've been working with https://github.com/trpc/examples-next-prisma-websockets-starter which works just fine but I need a channel/room implementation with I believe socket.io provides, is there any existing repos that use this? with preferably WSS attaching to trpc's server 🙂

Types for deep merging defaults in TS

``` export const deepMergeDefaults = <T>( defaultObj: { [k: string]: unknown; },...

How to handle Schema changes with Prisma?

Is there some established process to handle schema changes (i.e. user has first name + last name, but now we want to add the 'fullName' attribute for some reason)? In this example we would need to run a migration job, which iterates over all the existing users, and adds the new field. But where would we run this job? Are there some guidelines / tips?...