{"action":"opened","issue":{"url":"https://api.github.com/repos/palantir/tslint/issues/326","labels_url":"https://api.github.com/repos/palantir/tslint/issues/326/labels{/name}","comments_url":"https://api.github.com/repos/palantir/tslint/issues/326/comments","events_url":"https://api.github.com/repos/palantir/tslint/issues/326/events","html_url":"https://github.com/palantir/tslint/issues/326","id":57928475,"number":326,"title":"Read optional properties without check","user":{"login":"NN---","id":580536,"avatar_url":"https://avatars.githubusercontent.com/u/580536?v=3","gravatar_id":"","url":"https://api.github.com/users/NN---","html_url":"https://github.com/NN---","followers_url":"https://api.github.com/users/NN---/followers","following_url":"https://api.github.com/users/NN---/following{/other_user}","gists_url":"https://api.github.com/users/NN---/gists{/gist_id}","starred_url":"https://api.github.com/users/NN---/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NN---/subscriptions","organizations_url":"https://api.github.com/users/NN---/orgs","repos_url":"https://api.github.com/users/NN---/repos","events_url":"https://api.github.com/users/NN---/events{/privacy}","received_events_url":"https://api.github.com/users/NN---/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-17T14:12:41Z","updated_at":"2015-02-17T14:12:41Z","closed_at":null,"body":"Is it possible to have rule that warns for this code:\r\n\r\n```typescript\r\ninterface A { x?: number; }\r\n\r\nfunction f(a :A): number {\r\n return a.x; // TSLint warning may return undefined.\r\n}\r\n```\r\n\r\nAnd doesn't warn here:\r\n\r\n```typescript\r\ninterface A { x?: number; }\r\n\r\nfunction f(a :A): number {\r\n if (!a.x) \r\n// or if(a.x !== undefined)\r\n// or if(typeof a.x !== \"undefined\")\r\n return a.x; // TSLint warning may return undefined.\r\nelse\r\n return -1;\r\n}\r\n```"}}