Title: readonly modifier is ignored in unions · Issue #9108 · microsoft/TypeScript · GitHub
Open Graph Title: readonly modifier is ignored in unions · Issue #9108 · microsoft/TypeScript
X Title: readonly modifier is ignored in unions · Issue #9108 · microsoft/TypeScript
Description: interface X { readonly value: 'x'; } interface Y { value: 'y'; } type Z = X | Y; var z: Z =
Open Graph Description: interface X { readonly value: 'x'; } interface Y { value: 'y'; } type Z = X | Y; var z: Z =
X Description: interface X { readonly value: 'x'; } interface Y { value: 'y'; } type Z = X | Y; var z: Z = <Z>{ value: 'y' }; z.value = 'x'; // expected an error saying that ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/9108
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"readonly modifier is ignored in unions","articleBody":"``` typescript\ninterface X {\n readonly value: 'x';\n}\ninterface Y {\n value: 'y';\n}\ntype Z = X | Y;\nvar z: Z = \u003cZ>{ value: 'y' };\nz.value = 'x'; // expected an error saying that value: 'x' is readonly and cannot be set, actual OK\n```\n\nUPDATE:\n\neven this example doesn't work (with both possible options being `readonly`)\n\n``` typescript\ninterface X {\n readonly value: 'x';\n}\ninterface Y {\n readonly value: 'y';\n}\ntype Z = X | Y;\nvar z: Z = \u003cZ>{ value: 'y' };\nz.value = 'x'; // expected an error saying that value: 'x' is readonly and cannot be set, actual OK\n```\n","author":{"url":"https://github.com/zpdDG4gta8XKpMCd","@type":"Person","name":"zpdDG4gta8XKpMCd"},"datePublished":"2016-06-12T18:57:51Z","url":"https://github.com/microsoft/TypeScript/issues/9108"}
| 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:aaef3aff-2785-1600-dbd4-64c67e3ad0f7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B26A:B53AF:862869:B48192:6B00E17E |
| html-safe-nonce | 9a925b7320ed91049dc0ca5a6025e5cf477ae43acb0d4c8a83f48374671a5fc6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMjZBOkI1M0FGOjg2Mjg2OTpCNDgxOTI6NkIwMEUxN0UiLCJ2aXNpdG9yX2lkIjoiNzY2ODA2MDkxMDcxMTI2NzcxMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 37376f7dc1fb23a5299f126d1058ae1292f5f630f3acc9b6dbe75220c579f8e6 |
| hovercard-subject-tag | issue:159842013 |
| 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/9108/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f003afb0dfd799dfb9fdc2f9aa1023eb8d172c517fea52e4de0abc916e0a455e/microsoft/TypeScript/issues/9108 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f003afb0dfd799dfb9fdc2f9aa1023eb8d172c517fea52e4de0abc916e0a455e/microsoft/TypeScript/issues/9108 |
| og:image:alt | interface X { readonly value: 'x'; } interface Y { value: 'y'; } type Z = X | Y; var z: Z = |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zpdDG4gta8XKpMCd |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| 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 | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width