René's URL Explorer Experiment


Title: Why are TS get/set definedProperties in a class transpiled as enumerable/writable? · Issue #3610 · microsoft/TypeScript · GitHub

Open Graph Title: Why are TS get/set definedProperties in a class transpiled as enumerable/writable? · Issue #3610 · microsoft/TypeScript

X Title: Why are TS get/set definedProperties in a class transpiled as enumerable/writable? · Issue #3610 · microsoft/TypeScript

Description: I just confirmed in the TS Playground that the following TS: class Foo { get bar() { return true;} } Produces this JS: var Foo = (function () { function Foo() { } Object.defineProperty(Foo.prototype, "bar", { get: function () { return tr...

Open Graph Description: I just confirmed in the TS Playground that the following TS: class Foo { get bar() { return true;} } Produces this JS: var Foo = (function () { function Foo() { } Object.defineProperty(Foo.prototyp...

X Description: I just confirmed in the TS Playground that the following TS: class Foo { get bar() { return true;} } Produces this JS: var Foo = (function () { function Foo() { } Object.defineProperty(Foo.prototyp...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Why are TS get/set definedProperties in a class transpiled as enumerable/writable?","articleBody":"I just confirmed in the TS Playground that the following TS:\n\n```\nclass Foo {\n    get bar() { return true;}\n}\n```\n\nProduces this JS:\n\n```\nvar Foo = (function () {\n    function Foo() {\n    }\n    Object.defineProperty(Foo.prototype, \"bar\", {\n        get: function () { return true; },\n        enumerable: true,\n        configurable: true\n    });\n    return Foo;\n})();\n```\n\nThis [MDN link](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty) confirms that, for `Object.definedProperty` accessors:\n• enumerable: Defaults to false.\n• configurable: Defaults to false.\n\nClearly the generated code is overriding the default values for these keys.\n\nPlowing through the ES6 spec is not something I do. So  I’m not sure that ES6 hasn’t changed the defaults. But I’d be surprised.\n\nNow one of the things I miss in TS/ES6 class definitions is the ability to control these keys. It is also not easy to embellish a class with defined properties later … properties that might have non-default definitions\n\nBut that’s not my point or my question … which is, why is TS deviating from the defaults? \n\nI get why I’d want the property to be enumerable most of the time – strange that the spec defaults to false. I don’t understand why I should want it to be configurable (maybe because I don't like something about the property TS generated for me?).\n\nIn any case, I don’t get how TS (or ES6) gets away with changing the ES5 defaults.\n","author":{"url":"https://github.com/wardbell","@type":"Person","name":"wardbell"},"datePublished":"2015-06-24T00:31:29Z","url":"https://github.com/microsoft/TypeScript/issues/3610"}

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:97f6ac8c-6033-a178-4cd9-4a877d9ab8ac
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD23E:21AC3F:9984F1:C62EB7:6B00DDB4
html-safe-noncea62df055502a241c5e6d976f839dc91fdcc8e9365073fc6a0486fbcab62f4706
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMjNFOjIxQUMzRjo5OTg0RjE6QzYyRUI3OjZCMDBEREI0IiwidmlzaXRvcl9pZCI6IjE5OTcyMDQxNjU3NDIzNTM4NDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacc70674acbdf7a64ab0cd2cf971dabd4b0273944066ac33e2f083243604cd68b2
hovercard-subject-tagissue:90526297
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/3610/issue_layout
twitter:imagehttps://opengraph.githubassets.com/b166657554a72f6f291771d1e1241cfdb94302ea13e1d899636c5b065cd9d266/microsoft/TypeScript/issues/3610
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/b166657554a72f6f291771d1e1241cfdb94302ea13e1d899636c5b065cd9d266/microsoft/TypeScript/issues/3610
og:image:altI just confirmed in the TS Playground that the following TS: class Foo { get bar() { return true;} } Produces this JS: var Foo = (function () { function Foo() { } Object.defineProperty(Foo.prototyp...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamewardbell
hostnamegithub.com
expected-hostnamegithub.com
None043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf
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
release5425dc24e8bd8d6fca9641a12afc984825a43875
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/3610#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F3610
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%2F3610
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/3610
Reloadhttps://github.com/microsoft/TypeScript/issues/3610
Reloadhttps://github.com/microsoft/TypeScript/issues/3610
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests308 (308)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/3610
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/3610
#32264https://github.com/microsoft/TypeScript/pull/32264
Why are TS get/set definedProperties in a class transpiled as enumerable/writable?https://github.com/microsoft/TypeScript/issues/3610#top
#32264https://github.com/microsoft/TypeScript/pull/32264
Breaking ChangeWould introduce errors in existing codehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Breaking%20Change%22
CommittedThe team has roadmapped this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Committed%22
ES6Relates to the ES6 Spechttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22ES6%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
Backloghttps://github.com/microsoft/TypeScript/milestone/29
https://github.com/wardbell
Ward Bell (wardbell)https://github.com/wardbell
on Jun 24, 2015https://github.com/microsoft/TypeScript/issues/3610#issue-90526297
MDN linkhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
Nexthttps://github.com/microsoft/TypeScript/issues/3610?timeline_page=1
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Jun 24, 2015https://github.com/microsoft/TypeScript/issues/3610#issuecomment-114717158
14.5.14https://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-classdefinitionevaluation
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
Needs More InfoThe issue still hasn't been fully clarifiedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20More%20Info%22
on Jun 24, 2015https://github.com/microsoft/TypeScript/issues/3610#event-338517116
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Jun 26, 2015https://github.com/microsoft/TypeScript/issues/3610#issuecomment-115812535
Brian Terlson (@bterlson)https://github.com/bterlson
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
on Aug 11, 2015https://github.com/microsoft/TypeScript/issues/3610#event-378594795
https://github.com/gilamran
Gil Amran (gilamran)https://github.com/gilamran
on Aug 18, 2015https://github.com/microsoft/TypeScript/issues/3610#issuecomment-132200221
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Aug 18, 2015https://github.com/microsoft/TypeScript/issues/3610#issuecomment-132320685
Gil Amran (@gilamran)https://github.com/gilamran
https://github.com/gilamran
Gil Amran (gilamran)https://github.com/gilamran
on Aug 18, 2015https://github.com/microsoft/TypeScript/issues/3610#issuecomment-132341190
Mohamed Hegazy (@mhegazy)https://github.com/mhegazy
https://github.com/bterlson
Brian Terlson (bterlson)https://github.com/bterlson
on Aug 28, 2015https://github.com/microsoft/TypeScript/issues/3610#issuecomment-135854603
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Needs More InfoThe issue still hasn't been fully clarifiedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20More%20Info%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
on Aug 28, 2015https://github.com/microsoft/TypeScript/issues/3610#event-395516229
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Aug 28, 2015https://github.com/microsoft/TypeScript/issues/3610#issuecomment-135896606
Brian Terlson (@bterlson)https://github.com/bterlson
Ward Bell (@wardbell)https://github.com/wardbell
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
on Aug 28, 2015https://github.com/microsoft/TypeScript/issues/3610#event-395517501
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
TypeScript 2.1https://github.com/microsoft/TypeScript/milestone/20
on Sep 21, 2016https://github.com/microsoft/TypeScript/issues/3610#event-796547250
https://github.com/vvakame
Masahiro Wakame (vvakame)https://github.com/vvakame
on Nov 23, 2016https://github.com/microsoft/TypeScript/issues/3610#issuecomment-262473315
SkateJShttp://skate.js.org/
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 2.2https://github.com/microsoft/TypeScript/milestone/34
on Nov 23, 2016https://github.com/microsoft/TypeScript/issues/3610#event-870233119
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
TypeScript 2.2https://github.com/microsoft/TypeScript/milestone/34
on Jan 26, 2017https://github.com/microsoft/TypeScript/issues/3610#event-938582018
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
Yui (yuit)https://github.com/yuit
on Aug 3, 2017https://github.com/microsoft/TypeScript/issues/3610#event-1192341016
https://github.com/Arlen22
Arlen Beiler (Arlen22)https://github.com/Arlen22
on Sep 7, 2017https://github.com/microsoft/TypeScript/issues/3610#issuecomment-327785153
https://github.com/coldino
coldinohttps://github.com/coldino
on Mar 24, 2018https://github.com/microsoft/TypeScript/issues/3610#issuecomment-375916824
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Mar 26, 2018https://github.com/microsoft/TypeScript/issues/3610#issuecomment-376254685
https://user-images.githubusercontent.com/6685088/37923404-eaacd4d6-30e3-11e8-8336-628dca0ccf93.png
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#32264https://github.com/microsoft/TypeScript/pull/32264
on Feb 27, 2020https://github.com/microsoft/TypeScript/issues/3610#event-3079691772
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
on Feb 27, 2020https://github.com/microsoft/TypeScript/issues/3610#event-3079691887
Fix Get/Set being enumerable (#32264)https://github.com/microsoft/TypeScript/commit/5c85febb0ce9d6088cbe9b09cb42f73f9ee8ea05
#32264https://github.com/microsoft/TypeScript/pull/32264
https://docs.github.com/articles/closing-issues-via-commit-messages
5c85febhttps://github.com/microsoft/TypeScript/commit/5c85febb0ce9d6088cbe9b09cb42f73f9ee8ea05
https://github.com/michkot
michkothttps://github.com/michkot
on Feb 26, 2021https://github.com/microsoft/TypeScript/issues/3610#issuecomment-786711888
#32264https://github.com/microsoft/TypeScript/pull/32264
#3610 (comment)https://github.com/microsoft/TypeScript/issues/3610#issuecomment-135854603
https://262.ecma-international.org/5.1/#sec-11.1.5https://262.ecma-international.org/5.1/#sec-11.1.5
https://262.ecma-international.org/#sec-method-definitions-runtime-semantics-propertydefinitionevaluationhttps://262.ecma-international.org/#sec-method-definitions-runtime-semantics-propertydefinitionevaluation
https://www.ecma-international.org/wp-content/uploads/ECMA-262_5th_edition_december_2009.pdfhttps://www.ecma-international.org/wp-content/uploads/ECMA-262_5th_edition_december_2009.pdf
https://262.ecma-international.org/5.1/#sec-8.12.9https://262.ecma-international.org/5.1/#sec-8.12.9
http://javascript.xgqfrms.xyz/pdfs/TypeScript%20Language%20Specification.pdfhttp://javascript.xgqfrms.xyz/pdfs/TypeScript%20Language%20Specification.pdf
https://www.typescriptlang.org/docs/handbook/classes.html#accessorshttps://www.typescriptlang.org/docs/handbook/classes.html#accessors
https://www.typescriptlang.org/docs/handbook/decorators.htmlhttps://www.typescriptlang.org/docs/handbook/decorators.html
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifierhttps://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier
https://fettblog.eu/typescript-assertion-signatures/https://fettblog.eu/typescript-assertion-signatures/
https://fettblog.eu/typescript-assertion-signatures/https://fettblog.eu/typescript-assertion-signatures/
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/3610
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/3610
Breaking ChangeWould introduce errors in existing codehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Breaking%20Change%22
CommittedThe team has roadmapped this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Committed%22
ES6Relates to the ES6 Spechttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22ES6%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
BacklogNo due datehttps://github.com/microsoft/TypeScript/milestone/29
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.