Describe Union Types in TypeScript

Instruction: Explain the concept of union types in TypeScript and provide an example.

Context: This question tests the candidate's understanding of union types and their ability to illustrate how union types allow variables to store values of different types, enhancing code flexibility.

Upgrade to view answer

Related Questions