K
Kysely5mo ago
tzezar

How to narrow type in select

Is it possible to narrow type from enum company, person to just person in select query?
const results = await db
.selectFrom('receiver')
.where('type', '=', 'person')
.select(eb => [
'receiver.type',
])
.execute()
const results = await db
.selectFrom('receiver')
.where('type', '=', 'person')
.select(eb => [
'receiver.type',
])
.execute()
Solution:
See $narrowType
Jump to solution
2 Replies
tzezar
tzezarOP5mo ago
EB.ref with castTo might work, gonna try it later
Solution
koskimas
koskimas5mo ago
See $narrowType
Want results from more Discord servers?
Add your server