tltl
tltl4mo ago

is there a definitive solution to the slow language server/compilation issue?

it takes 5-20 seconds to load suggestions in many files in our project.
6 Replies
BeastFox
BeastFox4mo ago
I don't know if it'll work for you @tltl , nor am I sure how long it'll work/be supported for. But I gave https://github.com/algora-io/xtrpc a shot yesterday as yeah, I was running into quite significant language server issues. This helped massively. There were some discussions here, which I think the TLDR of it was to split up your router definitions https://github.com/trpc/trpc/discussions/2448
GitHub
GitHub - algora-io/xtrpc: Export your tRPC router to massively impr...
Export your tRPC router to massively improve language server performance and/or let your users consume your API from a typed SDK - algora-io/xtrpc
GitHub
Resources for improving typescript performance? · trpc trpc · Discu...
Our project is at about 40 end points using tRPC V9 with react and we're experiencing a pretty substantial slowdown of typescript. Mutations in particular are excruciatingly slow at this point....
BeastFox
BeastFox4mo ago
Not exactly a very scientific testing method, however generating ~1000 endpoints with zod schemas etc.. i mean it's practically night and day.
Gabriel
Gabriel4mo ago
Hi @tltl a lot of people experiencing these types of issues. Some useful comments from Alex here: https://discord.com/channels/867764511159091230/1020132255567454310/threads/1260588869967937556
tltl
tltl3mo ago
I run into many errors trying to use xtrpc
InvalidOperationError: A descendant of kind ObjectLiteralExpression was expected to be found.
InvalidOperationError: A descendant of kind ObjectLiteralExpression was expected to be found.
Error: A sibling of kind 357 was expected.
Error: A sibling of kind 357 was expected.
I also see this caveat in the readme
𝕏tRPC may not work properly if your procedure outputs are not explicitly declared. For best results, add .output to all of your procedures (which is a good practice to not leak sensitive info anyways) and enable explicitOutputs in your xtrpc.config.json
Not sure if that's related, but we have zero use of .output in the codebase
BeastFox
BeastFox3mo ago
@tltl not using .output on our end either. As Gabriel said some good comments from Alex about what you could try alternatively there. But someone mentioned on the GH about a similar had issue https://github.com/algora-io/xtrpc/issues/3 so perhaps you might need to change some things in your tsconfig? Maybe also try and narrow down your AppRouter to begin with if you want to go down this direction further
GitHub
Error: A sibling of kind 357 was expected. · Issue #3 · algora-io/x...
Hi, I tried to use the tool in hope of improving the type completion. However, when I run it on our project I get the following error and I don't know how to really debug it. Error: A sibling o...
tltl
tltl3mo ago
is there a solution where each individual trpc mutation/query is it's own router? and then I just import and use the appropriate "router" when needed. would that help? I have no need for any of the query invalidation, caching, or nesting "paths", I'm basically just looking to import and run functions on the frontend.