Narrowing down the type of a Match pipe
In
However, with
I tried using
Is
ts-pattern, I can do the following:However, with
Match, I need to assert all values as const since I can't find a way to enforce a return type (making it a little bit more verbose):I tried using
withReturnType, however, I get a type error:Type string is not assignable to type never
Is
satisfies with as const the way to go with Match?