TypeScript/tests/baselines/reference/TypeGuardWithArrayUnion.js
2015-01-12 14:51:20 -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
}
}