Closed
Description
Perhaps a bug, the following does not work although I think its the right syntax:
class Message {
value: string;
}
function saySize(message: Message | Message[]) {
if (message instanceof Array) {
return message.length; // test.ts(7,24): error TS2339: Property 'length' does not exist on type 'Message | Message[]'.
}
}
However, the following does work.
class Message {
}
function saySize(message: Message | Message[]) {
if (message instanceof Array) {
return message.length; // Okay
}
}
Note to team: Feel free to edit this query to increase its life. original report: #805 (comment).