{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9410","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9410/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9410/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9410/events","html_url":"https://github.com/Microsoft/TypeScript/issues/9410","id":162845893,"number":9410,"title":"Intersection types and string literals","user":{"login":"Quantumplation","id":49870,"avatar_url":"https://avatars2.githubusercontent.com/u/49870?v=4","gravatar_id":"","url":"https://api.github.com/users/Quantumplation","html_url":"https://github.com/Quantumplation","followers_url":"https://api.github.com/users/Quantumplation/followers","following_url":"https://api.github.com/users/Quantumplation/following{/other_user}","gists_url":"https://api.github.com/users/Quantumplation/gists{/gist_id}","starred_url":"https://api.github.com/users/Quantumplation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Quantumplation/subscriptions","organizations_url":"https://api.github.com/users/Quantumplation/orgs","repos_url":"https://api.github.com/users/Quantumplation/repos","events_url":"https://api.github.com/users/Quantumplation/events{/privacy}","received_events_url":"https://api.github.com/users/Quantumplation/received_events","type":"User","site_admin":false},"labels":[{"id":117630560,"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/In%20Discussion","name":"In Discussion","color":"556b75","default":false},{"id":113971155,"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Suggestion","name":"Suggestion","color":"006b75","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-06-29T05:49:27Z","updated_at":"2018-04-24T16:32:14Z","closed_at":null,"author_association":"NONE","body":"**TypeScript Version:**  1.8.0\n\n**Code**\n\n``` ts\n// A *self-contained* demonstration of the problem follows...\nclass MyClass<T> {\n  value: T & string\n}\n\nvar myInstance: MyClass<\"A\" | \"B\">\nmyInstance.value = \"A\" // Case 1\nmyInstance.value = \"B\" // Case 2\nmyInstance.value = \"other value\" // Case 3\n```\n\n**Expected behavior:**\n(prefix: I'm not sure if this was intentional or not, or whether it's a known issue or not, and I looked through other issues looking for mention of it and didn't see anything)\n\nCase 1 and 2 should be valid, while case 3 should be an error.\n\n**Actual behavior:** \nAll three cases are errors, as the intersection results in an empty type, rather than the type \"A\" | \"B\"\nFrom one perspective, the type \"string\" is a super set of type \"A\" | \"B\".\n\nThis might also impact the recent work done in #9407 \n\nIf this was intentional behavior, i'll edit this issue into a question as to why that decision was made, so it can serve as future documentation for anyone else searching for this issue.\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/383997310","html_url":"https://github.com/Microsoft/TypeScript/issues/9410#issuecomment-383997310","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9410","id":383997310,"user":{"login":"mhegazy","id":8000722,"avatar_url":"https://avatars3.githubusercontent.com/u/8000722?v=4","gravatar_id":"","url":"https://api.github.com/users/mhegazy","html_url":"https://github.com/mhegazy","followers_url":"https://api.github.com/users/mhegazy/followers","following_url":"https://api.github.com/users/mhegazy/following{/other_user}","gists_url":"https://api.github.com/users/mhegazy/gists{/gist_id}","starred_url":"https://api.github.com/users/mhegazy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhegazy/subscriptions","organizations_url":"https://api.github.com/users/mhegazy/orgs","repos_url":"https://api.github.com/users/mhegazy/repos","events_url":"https://api.github.com/users/mhegazy/events{/privacy}","received_events_url":"https://api.github.com/users/mhegazy/received_events","type":"User","site_admin":false},"created_at":"2018-04-24T16:32:14Z","updated_at":"2018-04-24T16:32:14Z","author_association":"CONTRIBUTOR","body":"Though it has no effect on the scenario in the OP, the type of `myInstance.value` is still `\"A\" & string`. it should be just `\"A\"`."}}
{"actor":{"display_login":"mhegazy"}}