K
Kysely•2mo ago
fed

Improving TS compile speed with multiple conditional selects?

Hi, I have API endpoints that query Postgres via Kysely. The API endpoints accept an include object that determines whether to include various optional fields. Some endpoints have grown to accept 5-10 optional fields. Each of these optional fields results in an additional $if branch in the Kysely query. And this seems to harm TS compile speed -- I'm now waiting 1-3min for each compilation. What are the best ways to mitigate the compile speed downsides of using many $if calls?
4 Replies
fed
fedOP•2mo ago
(I should add that some of these optional fields use jsonObjectFrom and I'm aware of https://github.com/kysely-org/kysely/issues/867)
GitHub
Issues · kysely-org/kysely
A type-safe typescript SQL query builder. Contribute to kysely-org/kysely development by creating an account on GitHub.
Igal (mobile)
Igal (mobile)•2mo ago
Dealing with the Type instantiation is excessively deep and possibl...
Kysely uses complex type magic to achieve its type safety. This complexity is sometimes
fed
fedOP•2mo ago
Thanks, will try that over the coming weeks How would one replace many $if with a single $call? Is there a toy example of that somewhere?
Igal
Igal•2mo ago
Something like this: https://kyse.link/Ij5JL

Did you find this page helpful?