TypeScript/tests/baselines/reference/TypeGuardWithArrayUnion.js
2015-12-08 17:51:10 -08:00

24 lines
506 B
TypeScript

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