Is it possible to type an array where the items match a string literal union so that .find will never return undefined. For example:
const COLUMNS = ['id', 'name', 'date'] as const
type COLUMN = (typeof COLUMNS)[number]
const columns = [ { name: 'id', databaseName: 'FOOBAR_ID' }, { name: 'name', databaseName: 'FOOBAR_NAME', } { name: 'date', databaseName: 'FOOBAR_DATE" } ]
// This is of type { name: string, databaseName: string } | undefined
// and ideally it wouldn't be undefined since name is type COLUMN
const getColumn = (name: COLUMN) => columns.find((column) => column.name === name)