I recently found myself wanting a two-dimensional switch statement in TypeScript. Here's one way to write one!
You can represent types with both shared and type-specific attributes as a discriminated union in TypeScript. Let's model that relationship in a database.
Here's a workaround for resolving *ngSwitch type errors in Angular templates and switching on a discriminated union type.