TypeScript/tests/cases/conformance/expressions/typeGuards/TypeGuardWithArrayUnion.ts
2015-01-12 14:51:20 -08:00

9 lines
207 B
TypeScript

class Message {
value: string;
}
function saySize(message: Message | Message[]) {
if (message instanceof Array) {
return message.length; // Should have type Message[] here
}
}