I have code like this:
function (flavors: IceCreamFlavor): 'like'|'dislike' {
switch (flavors) {
case IceCreamFlavor.vanilla:
return 'dislike';
case IceCreamFlavor.chocolate:
return 'like';
}
}
This is exhaustive, and I have an eslint rule that ensures exhaustiveness.
For eslint / typescript, i have the consistent-return rule switched to on, which will complain during this. I don't want to add a default (b/c if I add a new ice cream flavor, i want the developer to have to handle it), but consistent-return doesn't realize this is exhaustive and will complain.
Any ideas on how I can handle this elegantly?