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

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?...

How easy or difficult is to move from postgres to planetscale at a later point of time ?

Does anyone have experience in migrating the data from postgres to other solutions which support scale?

T3 Stack Using MongoDB

I can't seem to find a repo that uses T3 and MongoDB. Could anyone link a repo? Thanks!

How to not pass first argument into useQuery

Hey guys, real quick one here. I have a useQuery I don't need to pass any input into as first argument, but want to specify stuff like onSuccess in second arg. I get an error on the first empty object arg "Argument of type '{}' is not assignable to parameter of type 'void'". I probably should know how to fix this, but being a big TS noob Im a bit lost. It works fine, but would like to not have an error there for debugging purposes. Thanks!...

Is it possible to use tRPC as *just* a fullstack API server and client?

I don't need the features that react-query brings, I just need to be able to make my usual rest endpoint calls. My app isn't there yet, and would like to learn that when I eventually use it.

Cannot enlarge memory arrays

Trying to import a package to convert some data into a file type for me, so i can send it to the client via a base64 string. And I get this error when im converting: """ Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 16777216, (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0...

odd runtime error but just for mobile

The problem ONLY occurs when a mobile devices (touch devices) clicks on the filter select element and selects the default value while it already is set to the default value. In our case the default value is recent. Just to reiterate on the just "mobile" part of the title. If I'm using just the responsive mobile view in the dev tools everything works. If I select a device, say nexus 6p, and then try to select recent with it already being set to recent I receive the following error(or see screenshot): Unhandled Runtime Error TypeError: Converting circular structure to JSON ...

Fetching Data for Search Bar Homepage

So I'm trying to make a website with a homepage that has a search bar along with pre-computed data shown. The data is fetched through an API I would write in next.js. I want the search bar to begin showing suggestions as the user types. Assuming this is a clothes website, the search bar is used to find clothes. My question is how should I approach implementing the search bar? How do I maintain SEO? One way I'm thinking is using SSG and have all the possible clothes pre-loaded to the client? Any help is appreciated thanks!...

Good npm package for displaying weighted hypergraph? (T3 App)

Hello! Im using T3 App and looking for a good library to display weighted hypergraphs. Preferably something that has TS support and even better if it also has React 18 support. I checked out Cytoscape and Vis but they feel ancient and not very up-to-date. Are these the only viable choices? ...

Global CSS cannot be import, src directory issue

Probably a noob question, just trying the T3 stack with turbo. No changes to the code other than adding, turbo and setting environment variables. However, I am getting an issue with the global css import due to the src directory usage....

Conditional Wrap Component

This is not too much of a deep question, I just want to know if is there a more intelligent and non-complicated way of doing this, because I keep confusing myself with this alternative.. and I don't want to use a hook to do this

og image meta tag with Next.js is not working

Hey guys I am trying to generate a link preview for my hosted url, but it is not working, can someone please help me Hosted vercel deployement: https://context-gamma.vercel.app/ ...