René's URL Explorer Experiment


Title: Interface with readonly property is assignable to interface with mutable property · Issue #13347 · microsoft/TypeScript · GitHub

Open Graph Title: Interface with readonly property is assignable to interface with mutable property · Issue #13347 · microsoft/TypeScript

X Title: Interface with readonly property is assignable to interface with mutable property · Issue #13347 · microsoft/TypeScript

Description: TypeScript Version: 2.1.4 Code interface MutableValue { value: T; } interface ImmutableValue { readonly value: T; } let i: ImmutableValue = { value: "hi" }; i.value = "Excellent, I can't change it"; // compile-time error le...

Open Graph Description: TypeScript Version: 2.1.4 Code interface MutableValue { value: T; } interface ImmutableValue { readonly value: T; } let i: ImmutableValue = { value: "hi" }; i.value = "Excellent, I ca...

X Description: TypeScript Version: 2.1.4 Code interface MutableValue<T> { value: T; } interface ImmutableValue<T> { readonly value: T; } let i: ImmutableValue<string> = { value: "hi" }...

Opengraph URL: https://github.com/microsoft/TypeScript/issues/13347

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Interface with readonly property is assignable to interface with mutable property","articleBody":"**TypeScript Version:**  2.1.4\r\n\r\n**Code**\r\n\r\n```ts\r\ninterface MutableValue\u003cT> {\r\n    value: T;\r\n}\r\n\r\ninterface ImmutableValue\u003cT> {\r\n    readonly value: T;\r\n}\r\n\r\nlet i: ImmutableValue\u003cstring> = { value: \"hi\" };\r\ni.value = \"Excellent, I can't change it\"; // compile-time error\r\n\r\nlet m: MutableValue\u003cstring> = i;\r\nm.value = \"Oh dear, I can change it\";\r\n```\r\n\r\n**Expected behavior:**\r\nThe assignment of `i` to `m` would fail, to stop us accidentally allowing `value` to be modified.\r\n\r\n**Actual behavior:**\r\nThe assignment is allowed.\r\n\r\n[The current behaviour was a deliberate choice](https://github.com/Microsoft/TypeScript/pull/6532#issuecomment-174356151) so this is a breaking change (or strict flag) feature request rather than a bug report!\r\n\r\nThe Handbook [has this snippet](https://www.typescriptlang.org/docs/handbook/interfaces.html):\r\n\r\n```ts\r\nlet a: number[] = [1, 2, 3, 4];\r\nlet ro: ReadonlyArray\u003cnumber> = a;\r\nro[0] = 12; // error!\r\nro.push(5); // error!\r\nro.length = 100; // error!\r\na = ro; // error!\r\n```\r\n\r\nIt notes that `a = ro` being an error is helpful. But this happens because `ReadonlyArray` has no `push` method, making it incompatible with `Array`.\r\n\r\nMy example above seems \"morally equivalent\" to modelling the input/output flow of values with separate methods:\r\n\r\n```ts\r\ninterface MutableValue\u003cT> {\r\n    getValue(): T;\r\n    setValue(v: T): void;\r\n}\r\n\r\ninterface ImmutableValue\u003cT> {\r\n    getValue(): T;\r\n}\r\n\r\ndeclare let i: ImmutableValue\u003cstring>;\r\ni.setValue(\"Excellent, I can't change it\"); // compile-time error\r\n\r\nlet m: MutableValue\u003cstring> = i;\r\nm.setValue(\"Oh dear, I can change it\");\r\n```\r\n\r\nAnd sure enough, this stops the assignment of `i` to `m`.\r\n\r\nWould be great if mutable and readonly properties had the same relationship as if they were modelled by separate get/set methods (which of course they might actually be, via property getter/setters).","author":{"url":"https://github.com/danielearwicker","@type":"Person","name":"danielearwicker"},"datePublished":"2017-01-07T23:47:19Z","url":"https://github.com/microsoft/TypeScript/issues/13347"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:3e8410d3-363b-db69-12df-47acba370212
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDF38:16E9FD:666F84:87A47F:6AFBC86F
html-safe-noncea19cfc09f29b537f94672b88a03ef3ec7cd44e996eacb9d08e69a93aa37d9964
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjM4OjE2RTlGRDo2NjZGODQ6ODdBNDdGOjZBRkJDODZGIiwidmlzaXRvcl9pZCI6IjY0MjQ1MTYxMjQ0Mzk0NjQwNDciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac37e734c6a4af51dc90955379f78989691db5d683b86def925bd7759382820279
hovercard-subject-tagissue:199392398
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/13347/issue_layout
twitter:imagehttps://opengraph.githubassets.com/aa1551d82b5332acc28270d3a077f7340287fb095288ae7e89af1102acb86e53/microsoft/TypeScript/issues/13347
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/aa1551d82b5332acc28270d3a077f7340287fb095288ae7e89af1102acb86e53/microsoft/TypeScript/issues/13347
og:image:altTypeScript Version: 2.1.4 Code interface MutableValue { value: T; } interface ImmutableValue { readonly value: T; } let i: ImmutableValue = { value: "hi" }; i.value = "Excellent, I ca...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedanielearwicker
hostnamegithub.com
expected-hostnamegithub.com
Noned440bda0d812801778b27bfe9f7c1ce9ff22420c73f6f95150c4fcbca311c50b
turbo-cache-controlno-preview
go-importgithub.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id20929025
octolytics-dimension-repository_nwomicrosoft/TypeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id20929025
octolytics-dimension-repository_network_root_nwomicrosoft/TypeScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2c43021aed8695990c86c0eaaedc600bfeffec36
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/13347#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F13347
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F13347
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/issues/13347
Reloadhttps://github.com/microsoft/TypeScript/issues/13347
Reloadhttps://github.com/microsoft/TypeScript/issues/13347
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests334 (334)https://github.com/microsoft/TypeScript/pulls
Actionshttps://github.com/microsoft/TypeScript/actions
Projectshttps://github.com/microsoft/TypeScript/projects
Wikihttps://github.com/microsoft/TypeScript/wiki
Security and qualityhttps://github.com/microsoft/TypeScript/security
Insightshttps://github.com/microsoft/TypeScript/pulse
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/13347
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/13347
Interface with readonly property is assignable to interface with mutable propertyhttps://github.com/microsoft/TypeScript/issues/13347#top
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featurehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Awaiting%20More%20Feedback%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
https://github.com/danielearwicker
Daniel Earwicker (danielearwicker)https://github.com/danielearwicker
on Jan 7, 2017https://github.com/microsoft/TypeScript/issues/13347#issue-199392398
The current behaviour was a deliberate choicehttps://github.com/Microsoft/TypeScript/pull/6532#issuecomment-174356151
has this snippethttps://www.typescriptlang.org/docs/handbook/interfaces.html
Nexthttps://github.com/microsoft/TypeScript/issues/13347?timeline_page=1
https://github.com/danielearwicker
Daniel Earwicker (danielearwicker)https://github.com/danielearwicker
on Jan 8, 2017https://github.com/microsoft/TypeScript/issues/13347#issuecomment-271119179
#6614https://github.com/microsoft/TypeScript/issues/6614
https://github.com/aluanhaddad
Aluan Haddad (aluanhaddad)https://github.com/aluanhaddad
on Jan 8, 2017https://github.com/microsoft/TypeScript/issues/13347#issuecomment-271120556
Daniel Earwicker (@danielearwicker)https://github.com/danielearwicker
Aleksey-Bykovhttps://github.com/Aleksey-Bykov
readonly modifiers are a jokehttps://github.com/Microsoft/TypeScript/issues/13002
https://github.com/danielearwicker
Daniel Earwicker (danielearwicker)https://github.com/danielearwicker
on Jan 8, 2017https://github.com/microsoft/TypeScript/issues/13347#issuecomment-271137729
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featurehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Awaiting%20More%20Feedback%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
on Jan 8, 2017https://github.com/microsoft/TypeScript/issues/13347#event-915278023
https://github.com/DavidKDeutsch
David Deutsch (DavidKDeutsch)https://github.com/DavidKDeutsch
on May 2, 2017https://github.com/microsoft/TypeScript/issues/13347#issuecomment-298677831
https://github.com/Pauan
Pauanhttps://github.com/Pauan
on May 2, 2017https://github.com/microsoft/TypeScript/issues/13347#issuecomment-298746537
David Deutsch (@DavidKDeutsch)https://github.com/DavidKDeutsch
https://github.com/dead-claudia
Claudia Meadows (dead-claudia)https://github.com/dead-claudia
on Jun 15, 2017https://github.com/microsoft/TypeScript/issues/13347#issuecomment-308650418
reprohttp://www.typescriptlang.org/play/index.html#src=interface%20RO%20%7B%20readonly%20value%3A%20string%20%7D%0D%0Ainterface%20RW%20%7B%20value%3A%20string%20%7D%0D%0Alet%20ro%3A%20RO%20%3D%20%7B%20value%3A%20%22foo%22%20%7D%0D%0Alet%20rw%3A%20RW%20%3D%20%7B%20value%3A%20%22bar%22%20%7D%0D%0Alet%20roAsRw%3A%20RW%20%3D%20ro%0D%0Alet%20rwAsRo%3A%20RO%20%3D%20rw
https://github.com/dead-claudia
Claudia Meadows (dead-claudia)https://github.com/dead-claudia
on Jun 15, 2017https://github.com/microsoft/TypeScript/issues/13347#issuecomment-308650891
https://github.com/leoasis
Leonardo Garcia Crespo (leoasis)https://github.com/leoasis
on Aug 25, 2017https://github.com/microsoft/TypeScript/issues/13347#issuecomment-325040886
https://github.com/aluanhaddad
Aluan Haddad (aluanhaddad)https://github.com/aluanhaddad
on Aug 25, 2017https://github.com/microsoft/TypeScript/issues/13347#issuecomment-325041577
Leonardo Garcia Crespo (@leoasis)https://github.com/leoasis
#13002https://github.com/microsoft/TypeScript/issues/13002
https://github.com/Ailrun
Junyoung/"Clare" Jang (Ailrun)https://github.com/Ailrun
on Feb 20, 2018https://github.com/microsoft/TypeScript/issues/13347#issuecomment-367101498
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
https://github.com/EisenbergEffect
Rob Eisenberg (EisenbergEffect)https://github.com/EisenbergEffect
on May 9, 2018https://github.com/microsoft/TypeScript/issues/13347#issuecomment-387859139
https://github.com/jlandrum
James Landrum (jlandrum)https://github.com/jlandrum
on Oct 7, 2023https://github.com/microsoft/TypeScript/issues/13347#issuecomment-1751794134
https://github.com/cefn
Cefn Hoile (cefn)https://github.com/cefn
on Oct 7, 2023https://github.com/microsoft/TypeScript/issues/13347#issuecomment-1751859072
https://github.com/jlandrum
James Landrum (jlandrum)https://github.com/jlandrum
on Oct 8, 2023https://github.com/microsoft/TypeScript/issues/13347#issuecomment-1751896390
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Oct 9, 2023https://github.com/microsoft/TypeScript/issues/13347#issuecomment-1753939317
code of conducthttps://microsoft.github.io/codeofconduct/
https://github.com/aboodman
Aaron Boodman (aboodman)https://github.com/aboodman
on Oct 10, 2023https://github.com/microsoft/TypeScript/issues/13347#issuecomment-1755977086
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Oct 10, 2023https://github.com/microsoft/TypeScript/issues/13347#issuecomment-1756090127
https://github.com/adrian-gierakowski
Adrian (adrian-gierakowski)https://github.com/adrian-gierakowski
on Oct 10, 2023https://github.com/microsoft/TypeScript/issues/13347#issuecomment-1756161334
https://github.com/cedw032
Chad Edwards (cedw032)https://github.com/cedw032
on Apr 4, 2024https://github.com/microsoft/TypeScript/issues/13347#issuecomment-2036142408
https://github.com/MartinJohns
Martin Johns (MartinJohns)https://github.com/MartinJohns
on Apr 19, 2024https://github.com/microsoft/TypeScript/issues/13347#issuecomment-2066328092
#58236 (comment)https://github.com/microsoft/TypeScript/issues/58236#issuecomment-2065166982
https://github.com/ahejlsberg
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
on Apr 23, 2024https://github.com/microsoft/TypeScript/issues/13347#issuecomment-2073196715
#58296https://github.com/microsoft/TypeScript/pull/58296
https://github.com/denis-migdal
Denis Migdal (denis-migdal)https://github.com/denis-migdal
on Sep 5, 2025https://github.com/microsoft/TypeScript/issues/13347#issuecomment-3256953052
https://github.com/denis-migdal
Denis Migdal (denis-migdal)https://github.com/denis-migdal
on Sep 8, 2025https://github.com/microsoft/TypeScript/issues/13347#issuecomment-3264627576
https://github.com/phaux
Niki (phaux)https://github.com/phaux
on Sep 8, 2025https://github.com/microsoft/TypeScript/issues/13347#issuecomment-3265124405
https://github.com/denis-migdal
Denis Migdal (denis-migdal)https://github.com/denis-migdal
on Oct 1, 2025https://github.com/microsoft/TypeScript/issues/13347#issuecomment-3355166967
https://github.com/5cover
Scover (5cover)https://github.com/5cover
on Mar 28, 2026https://github.com/microsoft/TypeScript/issues/13347#issuecomment-4147868651
#13002https://github.com/microsoft/TypeScript/issues/13002
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/13347
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/13347
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featurehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Awaiting%20More%20Feedback%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.