Whenever you're ready, walk me through how you'd approach this.
How do you handle type safety when dealing with dynamic API payloads in TypeScript for Mercury?
Explain how you would safely process JSON whose shape is unknown at compile time, including where static TypeScript types stop helping and runtime validation begins. Discuss the trade-offs between type assertions, hand-written type guards, and a schema library such as Zod.
Scope: TypeScript applications consuming JSON REST APIs, with emphasis on validation at the API boundary and safely exposing typed data to the rest of the application.