Title: Nominal enum assignability after union · Issue #10776 · microsoft/TypeScript · GitHub
Open Graph Title: Nominal enum assignability after union · Issue #10776 · microsoft/TypeScript
X Title: Nominal enum assignability after union · Issue #10776 · microsoft/TypeScript
Description: TypeScript Version: 2.0 RC. This was working correctly in 2.0 beta. Code module X { export enum Foo { A, B } } module Y { export enum Foo { A, B } } const x: X.Foo = Y.Foo.A; const y: X.Foo | undefined = Y.Foo.A; Expected behavior: Both ...
Open Graph Description: TypeScript Version: 2.0 RC. This was working correctly in 2.0 beta. Code module X { export enum Foo { A, B } } module Y { export enum Foo { A, B } } const x: X.Foo = Y.Foo.A; const y: X.Foo | undef...
X Description: TypeScript Version: 2.0 RC. This was working correctly in 2.0 beta. Code module X { export enum Foo { A, B } } module Y { export enum Foo { A, B } } const x: X.Foo = Y.Foo.A; const y: X.Foo | undef...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/10776
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Nominal enum assignability after union","articleBody":"**TypeScript Version:** 2.0 RC. This was working correctly in 2.0 beta.\n\n**Code**\n\n``` ts\nmodule X {\n export enum Foo {\n A, B\n }\n}\nmodule Y {\n export enum Foo {\n A, B\n }\n}\nconst x: X.Foo = Y.Foo.A;\nconst y: X.Foo | undefined = Y.Foo.A;\n```\n\n**Expected behavior:**\nBoth assignments are valid.\n\n**Actual behavior:** \nThe first assignment is valid, the second throws an error saying \"Type 'Foo' is not assignable to type 'Foo | undefined'.\"\n\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:\n\n``` typescript\n\n\nimport * as ts from \"typescript\";\nimport * as ts2 from \"foo/node_modules/typescript\";\n\nconst identifier: ts.Identifier = undefined as any;\nconst identifier2: ts2.Identifier = identifier;\n\nconst ok: ts.SyntaxKind = ts2.SyntaxKind.AbstractKeyword;\nconst error: ts.SyntaxKind | undefined = ts2.SyntaxKind.AbstractKeyword;\n```\n\nError on the declaration of `identifier2`:\n\n```\nType 'ts.Identifier' is not assignable to type 'ts.Identifier'.\n Types of property 'originalKeywordKind' are incompatible.\n Type 'SyntaxKind | undefined' is not assignable to type 'SyntaxKind | undefined'.\n Type 'SyntaxKind.Unknown' is not assignable to type 'SyntaxKind | undefined'.\n```\n\nAnd on `error`:\n\n```\nType 'SyntaxKind' is not assignable to type 'SyntaxKind | undefined'.\n```\n","author":{"url":"https://github.com/ivogabe","@type":"Person","name":"ivogabe"},"datePublished":"2016-09-08T11:30:15Z","url":"https://github.com/microsoft/TypeScript/issues/10776"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1c5d468c-3707-e6e8-1a33-a8a304b4dff0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BEF4:6DC60:21F24AB:2ADC8F7:6B01AB85 |
| html-safe-nonce | dd34d1c57c1c8b1870ebc47f6a7159ebcf66f3a16d3d104b83db440ff4ed470e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRUY0OjZEQzYwOjIxRjI0QUI6MkFEQzhGNzo2QjAxQUI4NSIsInZpc2l0b3JfaWQiOiIyMTc4MzEyMjI0OTY2MjkwMzA5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | bc16761052516930a2653a52431facf11746b93f9e5bb520ac0329a562d04143 |
| hovercard-subject-tag | issue:175730073 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/10776/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9e89679957c45efdbc94ff770cc585e5bdf16d92ce63fa0c15b96855255d7460/microsoft/TypeScript/issues/10776 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9e89679957c45efdbc94ff770cc585e5bdf16d92ce63fa0c15b96855255d7460/microsoft/TypeScript/issues/10776 |
| og:image:alt | TypeScript Version: 2.0 RC. This was working correctly in 2.0 beta. Code module X { export enum Foo { A, B } } module Y { export enum Foo { A, B } } const x: X.Foo = Y.Foo.A; const y: X.Foo | undef... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ivogabe |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width