I am interested in inferring the number type within this function:
type Options = { count: number };
function bar<C extends Options>(options: C): C['count'] extends 3 ? 'x' : 'y' {}
bar({ count: 3 }) // x
bar({ count: 4 }) // y
Is there a method to achieve this without relying on as const
or enumerating all possible counts?