Leverage union types in Typescript to avoid invalid states | Hacker News Reader