Complete worked example
typescript
function count(value: string | readonly unknown[]): number { return value.length; }
const total = count(["QA", "PM"]);- Reasoning
- A union is sufficient because both accepted input categories produce the same result type.