{"action":"opened","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/1587","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/1587/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/1587/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/1587/events","html_url":"https://github.com/Microsoft/TypeScript/issues/1587","id":53324949,"number":1587,"title":"Type Guard syntax for array","user":{"login":"basarat","id":874898,"avatar_url":"https://avatars.githubusercontent.com/u/874898?v=3","gravatar_id":"","url":"https://api.github.com/users/basarat","html_url":"https://github.com/basarat","followers_url":"https://api.github.com/users/basarat/followers","following_url":"https://api.github.com/users/basarat/following{/other_user}","gists_url":"https://api.github.com/users/basarat/gists{/gist_id}","starred_url":"https://api.github.com/users/basarat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basarat/subscriptions","organizations_url":"https://api.github.com/users/basarat/orgs","repos_url":"https://api.github.com/users/basarat/repos","events_url":"https://api.github.com/users/basarat/events{/privacy}","received_events_url":"https://api.github.com/users/basarat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-01-04T04:32:39Z","updated_at":"2015-01-04T04:32:39Z","closed_at":null,"body":"Perhaps a bug, the following does not work although I think its the right syntax: \r\n\r\n```ts\r\nclass Message {\r\n    value: string;\r\n}\r\n\r\nfunction saySize(message: Message | Message[]) {\r\n    if (message instanceof Array) {\r\n        return message.length; // test.ts(7,24): error TS2339: Property 'length' does not exist on type 'Message | Message[]'.\r\n    }\r\n}\r\n```\r\n\r\nHowever, the following does work. \r\n\r\n```ts\r\nclass Message {\r\n}\r\n\r\nfunction saySize(message: Message | Message[]) {\r\n    if (message instanceof Array) {\r\n        return message.length; // Okay\r\n    }\r\n}\r\n```\r\n\r\n\r\nNote to team: Feel free to edit this query to increase its life. original report: https://github.com/Microsoft/TypeScript/issues/805#issuecomment-68615662. "}}