K
Kysely•2y ago
ohmi

.where('x', 'is not', null) and correspond type's nullability

Not sure if this even possible in typescript (although all of the work Kysely already makes it seem magical). But let's say we have a column 'x' that has type string | null. Is it possible to write a query that ends up resulting in a final type of string after using .where('x', 'is not', null) or any similar method?
Solution:
Hey 👋 Due to compiler performance and type maintainability, Kysely doesnt narrow the type in this case. We've recently introduced the .$narrowType that allows you to narrow the output type safely....
Jump to solution
7 Replies
Solution
Igal (mobile)
Igal (mobile)•2y ago
Hey 👋 Due to compiler performance and type maintainability, Kysely doesnt narrow the type in this case. We've recently introduced the .$narrowType that allows you to narrow the output type safely.
ohmi
ohmiOP•2y ago
but in theory, it would be possible?
Igal (mobile)
Igal (mobile)•2y ago
Yeah its possible
ohmi
ohmiOP•2y ago
magic awesome, thanks again
ohmi
ohmiOP•2y ago
what part of the instance should i be calling it on? did a quick search of this channel, and the docs but didnt see any examples
ohmi
ohmiOP•2y ago
ah not in the most recent npm release?
Igal
Igal•2y ago
Sorry, my bad, this is release pending
Want results from more Discord servers?
Add your server