.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:Jump to 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....7 Replies
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.but in theory, it would be possible?
Yeah its possible
magic
awesome, thanks again
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
ah
not in the most recent npm release?
Sorry, my bad, this is release pending