Implement closest and closestIndex in a type-safer(ish...) way