Branded Literal Types and Exhaustivity Checking Issue in TypeScript
Hey I'm trying to understand branded literal types and exhausitivity checking. When I define literal type without it being branded, exhaustivity checking works fine:
const FooBar = Schema.Literal('foo', 'bar');type FooBar = typeof FooBar.Type;function match(foobar: FooBar): string { switch (foobar) { // If either case is missing, I get compile error case 'foo': return "foo" case 'bar': return "bar" }}
const FooBar = Schema.Literal('foo', 'bar');type FooBar = typeof FooBar.Type;function match(foobar: FooBar): string { switch (foobar) { // If either case is missing, I get compile error case 'foo': return "foo" case 'bar': return "bar" }}