Gabriel
Gabrielβ€’2w ago

How to improve typescript performance?

The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.ts(7056) 😒 😒
tRPC has long been my favorite tool to use. However, as time has passed, my application has grown slightly bigger, and now I cannot see how it will be possible for me to continue using it... I need a way for tRPC to be scalable, to allow for the creation of hundreds of endpoints and not have to constantly worry about my editor performance. But... it's getting increasingly hard to do this. So much so that I am considering moving off it to something more scalable. I heard that there are ways to break up trpc so that it will keep being performant for typescript. but how? I saw that KATT had a comment here: https://github.com/trpc/trpc/discussions/3574 saying that it is possible to break up trpc into multiple packages. But it's not clear to me how? I am using turborepo, so I believe this would be possible.
GitHub
Specifying output types to improve TypeScript performance? Β· trpc t...
Hello! I'm using tRPC 10 with TypeScript 4.9.4. I have a monorepo with a client and a server. My editor's auto-complete is pretty slow; I'd like to speed it up by explicitly specifying ...
No description
5 Replies
Alex / KATT 🐱
you can do a hack and split it up the inference by router https://gist.github.com/KATT/af6079e6fcc31f292776266dd76dadbb a better solution is to do a monorepo where ts is precompiled on save
kbemaster
kbemasterβ€’7d ago
any articles on this?
Gabriel
Gabrielβ€’3d ago
Hi @Alex / KATT 🐱 , I hadn't seen your reply. Thanks for the link. I want to actually have this working on my repo, and if it works, I even want to create a video/article about it. I use a monorepo setup from julius's create t3 turbo Trying to figure out what this is doing exactly. If you could share a repo with this implemented, it would help a lot, because my file structure is different from what the template/generator expects
Alex / KATT 🐱
Keen to watch/read (and reshare) that video/article
Gabriel
Gabrielβ€’3d ago
Yeah, but I think that… if I am already using ct3turbo And in there they already statically generate the dist folder with the types, then is there a way to make it even better? Because you said β€œa better solution is to do a monorepo where ts is precompiled on save” Not sure if it’s possible to make it even faster? @Alex / KATT 🐱