Use TypeScript discriminated unions for API loading states | MavenHost