René's URL Explorer Experiment


Title: Suggestion: readonly constructor parameters · Issue #7590 · microsoft/TypeScript · GitHub

Open Graph Title: Suggestion: readonly constructor parameters · Issue #7590 · microsoft/TypeScript

X Title: Suggestion: readonly constructor parameters · Issue #7590 · microsoft/TypeScript

Description: I've been using the new readonly properties feature (#6532) and have found it to be a very productive alternative to using getters or getWhatever() functions, or as is often the case, simply doing nothing to enforce read-only properties....

Open Graph Description: I've been using the new readonly properties feature (#6532) and have found it to be a very productive alternative to using getters or getWhatever() functions, or as is often the case, simply doing ...

X Description: I've been using the new readonly properties feature (#6532) and have found it to be a very productive alternative to using getters or getWhatever() functions, or as is often the case, simply do...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Suggestion: readonly constructor parameters","articleBody":"I've been using the new `readonly` properties feature (#6532) and have found it to be a very productive alternative to using getters or `getWhatever()` functions, or as is often the case, simply doing nothing to enforce read-only properties. However I'm really yearning for the ability to mark constructor parameters as `readonly`.\n\nIn 1.8 a common pattern for me is to write classes where all properties are public and readonly like so:\n\n``` typescript\nexport class Foo {\n  constructor(public bar: number,\n              public baz: number) {}\n}\n\n```\n\nBut now with `readonly` I'm missing out unless I rewrite the above code to:\n\n``` typescript\nexport class Foo {\n  public readonly bar: number;\n  public readonly baz: number;\n\n  constructor(bar: number, baz: number) {\n    this.bar = bar;\n    this.baz = baz;\n  }\n}\n```\n\nWhich is pretty cumbersome. What I'd really like to be able to write is:\n\n``` typescript\nexport class Foo {\n  constructor(public readonly bar: number,\n              public readonly baz: number) {}\n}\n```\n\nRight now I'm worried about hitting 2.0 and having to rewrite all my constructors just to take advantage of `readonly`. Because it's an advantage I definitely want to have.\n","author":{"url":"https://github.com/jahewson","@type":"Person","name":"jahewson"},"datePublished":"2016-03-19T01:05:43Z","url":"https://github.com/microsoft/TypeScript/issues/7590"}

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:6c2831a5-28f4-eda2-5d70-1884578481af
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCCD0:3D97C8:3648C8:4A5139:6B00C6EF
html-safe-noncecfa28ac0945e37ffb93414e8fee24ec812008840bb0b520efd1ac5775a455962
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQ0QwOjNEOTdDODozNjQ4Qzg6NEE1MTM5OjZCMDBDNkVGIiwidmlzaXRvcl9pZCI6IjE5MzM3MDQ1NzMyMTQ1NzQzMTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac60793e7e66b9c72399effcde5ae5ad116cb7c13fa54748048179be5a8e3acd08
hovercard-subject-tagissue:142010526
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/7590/issue_layout
twitter:imagehttps://opengraph.githubassets.com/62bd8980bdaae8b5a4dcd97372c0debaf4a259447f5c5726bbf901e59f856ef7/microsoft/TypeScript/issues/7590
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/62bd8980bdaae8b5a4dcd97372c0debaf4a259447f5c5726bbf901e59f856ef7/microsoft/TypeScript/issues/7590
og:image:altI've been using the new readonly properties feature (#6532) and have found it to be a very productive alternative to using getters or getWhatever() functions, or as is often the case, simply doing ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejahewson
hostnamegithub.com
expected-hostnamegithub.com
None98dc00e171c204462a6f367482a0f8c3c6b5dbca99cd7390e82d2df49ce096e4
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
releaseef013399cf0a3c324bea644a685d7c1e0f06b5b7
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/7590#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F7590
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%2F7590
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/7590
Reloadhttps://github.com/microsoft/TypeScript/issues/7590
Reloadhttps://github.com/microsoft/TypeScript/issues/7590
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests307 (307)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/insights
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/7590
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/7590
Suggestion: readonly constructor parametershttps://github.com/microsoft/TypeScript/issues/7590#top
CommittedThe team has roadmapped this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Committed%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
TypeScript 2.0https://github.com/microsoft/TypeScript/milestone/1
https://github.com/jahewson
John Hewson (jahewson)https://github.com/jahewson
on Mar 19, 2016https://github.com/microsoft/TypeScript/issues/7590#issue-142010526
#6532https://github.com/microsoft/TypeScript/pull/6532
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Proposal%22
on Mar 19, 2016https://github.com/microsoft/TypeScript/issues/7590#event-595670542
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Mar 19, 2016https://github.com/microsoft/TypeScript/issues/7590#issuecomment-198610426
https://github.com/jahewson
John Hewson (jahewson)https://github.com/jahewson
on Mar 21, 2016https://github.com/microsoft/TypeScript/issues/7590#issuecomment-199094100
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Proposal%22
on Mar 24, 2016https://github.com/microsoft/TypeScript/issues/7590#event-602330775
https://github.com/leonyu
Leon Yu (leonyu)https://github.com/leonyu
on Apr 4, 2016https://github.com/microsoft/TypeScript/issues/7590#issuecomment-205453080
https://github.com/jahewson
John Hewson (jahewson)https://github.com/jahewson
on Apr 5, 2016https://github.com/microsoft/TypeScript/issues/7590#issuecomment-205562236
Leon Yu (@leonyu)https://github.com/leonyu
https://github.com/nbransby
Nicholas Bransby-Williams (nbransby)https://github.com/nbransby
on May 4, 2016https://github.com/microsoft/TypeScript/issues/7590#issuecomment-216969683
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
CommittedThe team has roadmapped this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Committed%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
on May 9, 2016https://github.com/microsoft/TypeScript/issues/7590#event-655082884
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 2.0https://github.com/microsoft/TypeScript/milestone/1
on May 9, 2016https://github.com/microsoft/TypeScript/issues/7590#event-655082896
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on May 9, 2016https://github.com/microsoft/TypeScript/issues/7590#issuecomment-218017169
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on May 10, 2016https://github.com/microsoft/TypeScript/issues/7590#event-655121733
https://github.com/jahewson
John Hewson (jahewson)https://github.com/jahewson
on May 10, 2016https://github.com/microsoft/TypeScript/issues/7590#issuecomment-218035003
on May 11, 2016https://github.com/microsoft/TypeScript/issues/7590#event-657352777
Fix #7590: Allow 'readonly' to be used in constructor parametershttps://github.com/microsoft/TypeScript/commit/fb7df962c613e152fa33a8411d767c5ec2c9d4e3
#7590https://github.com/microsoft/TypeScript/issues/7590
https://docs.github.com/articles/closing-issues-via-commit-messages
fb7df96https://github.com/microsoft/TypeScript/commit/fb7df962c613e152fa33a8411d767c5ec2c9d4e3
on May 11, 2016https://github.com/microsoft/TypeScript/issues/7590#event-657368355
Fix #7590: Allow 'readonly' to be used in constructor parametershttps://github.com/microsoft/TypeScript/commit/ad2634e34309954b80ed6f2ed1d5d8de3460dc5d
#7590https://github.com/microsoft/TypeScript/issues/7590
https://docs.github.com/articles/closing-issues-via-commit-messages
ad2634ehttps://github.com/microsoft/TypeScript/commit/ad2634e34309954b80ed6f2ed1d5d8de3460dc5d
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#8555https://github.com/microsoft/TypeScript/pull/8555
on May 12, 2016https://github.com/microsoft/TypeScript/issues/7590#event-658912156
on May 12, 2016https://github.com/microsoft/TypeScript/issues/7590#event-658912227
Merge pull request #8555 from Microsoft/readonly_ctrhttps://github.com/microsoft/TypeScript/commit/7806de0f45aca97515344a9c8e905660fd8ec461
#8555https://github.com/microsoft/TypeScript/pull/8555
https://docs.github.com/articles/closing-issues-via-commit-messages
7806de0https://github.com/microsoft/TypeScript/commit/7806de0f45aca97515344a9c8e905660fd8ec461
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
on May 12, 2016https://github.com/microsoft/TypeScript/issues/7590#event-658916937
https://github.com/aluanhaddad
Aluan Haddad (aluanhaddad)https://github.com/aluanhaddad
on May 23, 2016https://github.com/microsoft/TypeScript/issues/7590#issuecomment-220915378
microsofthttps://github.com/microsoft
on Jun 19, 2018https://github.com/microsoft/TypeScript/issues/7590#event-1689643921
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/7590
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/7590
CommittedThe team has roadmapped this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Committed%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
TypeScript 2.0https://github.com/microsoft/TypeScript/milestone/1
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.