{"action":"created","issue":{"url":"https://api.github.com/repos/palantir/tslint/issues/3505","repository_url":"https://api.github.com/repos/palantir/tslint","labels_url":"https://api.github.com/repos/palantir/tslint/issues/3505/labels{/name}","comments_url":"https://api.github.com/repos/palantir/tslint/issues/3505/comments","events_url":"https://api.github.com/repos/palantir/tslint/issues/3505/events","html_url":"https://github.com/palantir/tslint/issues/3505","id":275702460,"number":3505,"title":"`no-unnecessary-type-assertion` complains over valid code","user":{"login":"jeffijoe","id":2505474,"avatar_url":"https://avatars1.githubusercontent.com/u/2505474?v=4","gravatar_id":"","url":"https://api.github.com/users/jeffijoe","html_url":"https://github.com/jeffijoe","followers_url":"https://api.github.com/users/jeffijoe/followers","following_url":"https://api.github.com/users/jeffijoe/following{/other_user}","gists_url":"https://api.github.com/users/jeffijoe/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffijoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffijoe/subscriptions","organizations_url":"https://api.github.com/users/jeffijoe/orgs","repos_url":"https://api.github.com/users/jeffijoe/repos","events_url":"https://api.github.com/users/jeffijoe/events{/privacy}","received_events_url":"https://api.github.com/users/jeffijoe/received_events","type":"User","site_admin":false},"labels":[{"id":199772153,"url":"https://api.github.com/repos/palantir/tslint/labels/Status:%20Needs%20Investigation","name":"Status: Needs Investigation","color":"006b75","default":false},{"id":219838007,"url":"https://api.github.com/repos/palantir/tslint/labels/Status:%20Needs%20More%20Info","name":"Status: Needs More Info","color":"bfdadc","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-11-21T12:57:14Z","updated_at":"2017-11-27T17:36:30Z","closed_at":"2017-11-27T17:25:32Z","author_association":"NONE","body":"### Bug Report\r\n\r\n- __TSLint version__: 5.8.0\r\n- __TypeScript version__: 2.6.1\r\n- __Running TSLint via__: CLI\r\n\r\n#### TypeScript code being linted\r\n\r\n![image](https://user-images.githubusercontent.com/2505474/33073510-67328bfa-cec3-11e7-9d25-e21bcd19fc0d.png)\r\n\r\n```ts\r\nconst { response } = await throws<AxiosError>(\r\n  api.user1.createRole({ name: 'Nope' })\r\n)\r\nexpect(response!.status).toBe(400)\r\nexpect(response!.data.message).toMatch(/admin/)\r\n```\r\n\r\nwith `tslint.json` configuration:\r\n\r\n```json\r\n{\r\n  \"extends\": [\"tslint-config-standard\", \"tslint-config-prettier\"],\r\n  \"rules\": {\r\n    \"no-var-requires\": false,\r\n    \"ordered-imports\": [false],\r\n    \"no-console\": [false],\r\n    \"member-access\": [false],\r\n    \"object-literal-sort-keys\": false,\r\n    \"await-promise\": false,\r\n    \"no-use-before-declare\": false\r\n  }\r\n}\r\n```\r\n\r\n#### Actual behavior\r\n\r\n`no-unnecessary-type-assertion` complains over `response`, even though `response` is `AxiosResponse<any> | undefined`\r\n\r\n```\r\nERROR: myfile.ts[13, 14]: This assertion is unnecessary since it does not change the type of the expression.\r\nERROR: myfile.ts[14, 14]: This assertion is unnecessary since it does not change the type of the expression.\r\n```\r\n\r\n#### Expected behavior\r\n\r\nIt should not error."},"comment":{"url":"https://api.github.com/repos/palantir/tslint/issues/comments/347261031","html_url":"https://github.com/palantir/tslint/issues/3505#issuecomment-347261031","issue_url":"https://api.github.com/repos/palantir/tslint/issues/3505","id":347261031,"user":{"login":"aluanhaddad","id":5034656,"avatar_url":"https://avatars3.githubusercontent.com/u/5034656?v=4","gravatar_id":"","url":"https://api.github.com/users/aluanhaddad","html_url":"https://github.com/aluanhaddad","followers_url":"https://api.github.com/users/aluanhaddad/followers","following_url":"https://api.github.com/users/aluanhaddad/following{/other_user}","gists_url":"https://api.github.com/users/aluanhaddad/gists{/gist_id}","starred_url":"https://api.github.com/users/aluanhaddad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aluanhaddad/subscriptions","organizations_url":"https://api.github.com/users/aluanhaddad/orgs","repos_url":"https://api.github.com/users/aluanhaddad/repos","events_url":"https://api.github.com/users/aluanhaddad/events{/privacy}","received_events_url":"https://api.github.com/users/aluanhaddad/received_events","type":"User","site_admin":false},"created_at":"2017-11-27T17:36:30Z","updated_at":"2017-11-27T17:36:30Z","author_association":"NONE","body":"@jeffijoe I was just trying to get your goat :smiley:"}}
{"actor":{"display_login":"aluanhaddad"}}