{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/10776","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/10776/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/10776/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/10776/events","html_url":"https://github.com/Microsoft/TypeScript/issues/10776","id":175730073,"number":10776,"title":"Nominal enum assignability after union","user":{"login":"ivogabe","id":4706418,"avatar_url":"https://avatars.githubusercontent.com/u/4706418?v=3","gravatar_id":"","url":"https://api.github.com/users/ivogabe","html_url":"https://github.com/ivogabe","followers_url":"https://api.github.com/users/ivogabe/followers","following_url":"https://api.github.com/users/ivogabe/following{/other_user}","gists_url":"https://api.github.com/users/ivogabe/gists{/gist_id}","starred_url":"https://api.github.com/users/ivogabe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivogabe/subscriptions","organizations_url":"https://api.github.com/users/ivogabe/orgs","repos_url":"https://api.github.com/users/ivogabe/repos","events_url":"https://api.github.com/users/ivogabe/events{/privacy}","received_events_url":"https://api.github.com/users/ivogabe/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Bug","name":"Bug","color":"e11d21"}],"state":"open","locked":false,"assignee":{"login":"sandersn","id":293473,"avatar_url":"https://avatars.githubusercontent.com/u/293473?v=3","gravatar_id":"","url":"https://api.github.com/users/sandersn","html_url":"https://github.com/sandersn","followers_url":"https://api.github.com/users/sandersn/followers","following_url":"https://api.github.com/users/sandersn/following{/other_user}","gists_url":"https://api.github.com/users/sandersn/gists{/gist_id}","starred_url":"https://api.github.com/users/sandersn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandersn/subscriptions","organizations_url":"https://api.github.com/users/sandersn/orgs","repos_url":"https://api.github.com/users/sandersn/repos","events_url":"https://api.github.com/users/sandersn/events{/privacy}","received_events_url":"https://api.github.com/users/sandersn/received_events","type":"User","site_admin":false},"assignees":[{"login":"sandersn","id":293473,"avatar_url":"https://avatars.githubusercontent.com/u/293473?v=3","gravatar_id":"","url":"https://api.github.com/users/sandersn","html_url":"https://github.com/sandersn","followers_url":"https://api.github.com/users/sandersn/followers","following_url":"https://api.github.com/users/sandersn/following{/other_user}","gists_url":"https://api.github.com/users/sandersn/gists{/gist_id}","starred_url":"https://api.github.com/users/sandersn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandersn/subscriptions","organizations_url":"https://api.github.com/users/sandersn/orgs","repos_url":"https://api.github.com/users/sandersn/repos","events_url":"https://api.github.com/users/sandersn/events{/privacy}","received_events_url":"https://api.github.com/users/sandersn/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/27","html_url":"https://github.com/Microsoft/TypeScript/milestones/TypeScript%202.0.3","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/27/labels","id":1973150,"number":27,"title":"TypeScript 2.0.3","description":"","creator":{"login":"mhegazy","id":8000722,"avatar_url":"https://avatars.githubusercontent.com/u/8000722?v=3","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},"open_issues":16,"closed_issues":5,"state":"open","created_at":"2016-08-30T17:00:00Z","updated_at":"2016-09-08T17:50:24Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-09-08T11:30:15Z","updated_at":"2016-09-08T18:38:24Z","closed_at":null,"body":"**TypeScript Version:**  2.0 RC. This was working correctly in 2.0 beta.\r\n\r\n**Code**\r\n\r\n```ts\r\nmodule X {\r\n\texport enum Foo {\r\n\t\tA, B\r\n\t}\r\n}\r\nmodule Y {\r\n\texport enum Foo {\r\n\t\tA, B\r\n\t}\r\n}\r\nconst x: X.Foo = Y.Foo.A;\r\nconst y: X.Foo | undefined = Y.Foo.A;\r\n```\r\n\r\n**Expected behavior:**\r\nBoth assignments are valid.\r\n\r\n**Actual behavior:** \r\nThe first assignment is valid, the second throws an error saying \"Type 'Foo' is not assignable to type 'Foo | undefined'.\"\r\n\r\nThis block a project that depends on the TypeScript api, and on some package that also depends on TypeScript. So TS is installed on `node_modules/typescript` and `node_modules/foo/node_modules/typescript`. (Normally NPM would install TypeScript only once, but `foo` is a symlink.) This causes that objects from one installation of TypeScript cannot be passed to the other. The following code illustrates that:\r\n```typescript\r\n\r\n\r\nimport * as ts from \"typescript\";\r\nimport * as ts2 from \"foo/node_modules/typescript\";\r\n\r\nconst identifier: ts.Identifier = undefined as any;\r\nconst identifier2: ts2.Identifier = identifier;\r\n\r\nconst ok: ts.SyntaxKind = ts2.SyntaxKind.AbstractKeyword;\r\nconst error: ts.SyntaxKind | undefined = ts2.SyntaxKind.AbstractKeyword;\r\n```\r\nError on the declaration of `identifier2`:\r\n```\r\nType 'ts.Identifier' is not assignable to type 'ts.Identifier'.\r\n  Types of property 'originalKeywordKind' are incompatible.\r\n    Type 'SyntaxKind | undefined' is not assignable to type 'SyntaxKind | undefined'.\r\n      Type 'SyntaxKind.Unknown' is not assignable to type 'SyntaxKind | undefined'.\r\n```\r\nAnd on `error`:\r\n```\r\nType 'SyntaxKind' is not assignable to type 'SyntaxKind | undefined'.\r\n```"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/245696271","html_url":"https://github.com/Microsoft/TypeScript/issues/10776#issuecomment-245696271","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/10776","id":245696271,"user":{"login":"sandersn","id":293473,"avatar_url":"https://avatars.githubusercontent.com/u/293473?v=3","gravatar_id":"","url":"https://api.github.com/users/sandersn","html_url":"https://github.com/sandersn","followers_url":"https://api.github.com/users/sandersn/followers","following_url":"https://api.github.com/users/sandersn/following{/other_user}","gists_url":"https://api.github.com/users/sandersn/gists{/gist_id}","starred_url":"https://api.github.com/users/sandersn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandersn/subscriptions","organizations_url":"https://api.github.com/users/sandersn/orgs","repos_url":"https://api.github.com/users/sandersn/repos","events_url":"https://api.github.com/users/sandersn/events{/privacy}","received_events_url":"https://api.github.com/users/sandersn/received_events","type":"User","site_admin":false},"created_at":"2016-09-08T18:38:24Z","updated_at":"2016-09-08T18:38:24Z","body":"Note: requires `\"strictNullChecks\": true` to repro"}}
{"actor":{"display_login":"sandersn"}}