How do I create a helper to be used on a select array of fields?

I want to create a toBool helper to convert from tinyint, however I'm lost on the type I need to pass to get autocomplete of the possible fields in the select

import { sql } from 'kysely'

export const toBool = (
  field: string // what type should I add here?
) => {
  return sql<boolean>`IF(${field} > 0, true, false)`
}
Solution
I think checking equality to 0 would make this safer (and swapping true/false order), as tinyint can be negative.
Was this page helpful?