René's URL Explorer Experiment


Title: Emitter: Static class property "name" causes TypeError due to Function.name being readonly · Issue #9778 · microsoft/TypeScript · GitHub

Open Graph Title: Emitter: Static class property "name" causes TypeError due to Function.name being readonly · Issue #9778 · microsoft/TypeScript

X Title: Emitter: Static class property "name" causes TypeError due to Function.name being readonly · Issue #9778 · microsoft/TypeScript

Description: TypeScript Version: 1.8.10 Consider the following class definition with a static property name: class Foo { static name() { return "Hello World"; } constructor() {} } The TS emitter output for this is: var Foo = (function () { function F...

Open Graph Description: TypeScript Version: 1.8.10 Consider the following class definition with a static property name: class Foo { static name() { return "Hello World"; } constructor() {} } The TS emitter output for this...

X Description: TypeScript Version: 1.8.10 Consider the following class definition with a static property name: class Foo { static name() { return "Hello World"; } constructor() {} } The TS emitter outpu...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Emitter: Static class property \"name\" causes TypeError due to Function.name being readonly","articleBody":"\u003c!-- BUGS: Please use this template. -->\n\n**TypeScript Version:**  1.8.10\n\nConsider the following class definition with a static property _name_:\n\n``` ts\nclass Foo {\n     static name() {\n         return \"Hello World\";\n     }\n     constructor() {}\n}\n```\n\nThe TS emitter output for this is:\n\n``` javascript\nvar Foo = (function () {\n    function Foo() {\n    }\n    Foo.name = function () {\n        return \"Hello World\";\n    };\n    return Foo;\n}());\n```\n\nHowever, at least in Chrome and Firefox a function's name property is **readonly** for ordinary functions causing the assignment of the static function _name_ to be ignored / causing a TypeError in strict mode.\n\nThe TS example above is also valid ES 2015 so I've tested it without transpilation in a current version of Chromium (v51.0.2704.79). Interestingly, while we can not change the _name_ property of ordinary functions in Chromium we can still do the following for the constructor function once a static _name_ property is present:\n\n``` javascript\nclass Foo {\n   static name() {\n        return \"Hello World\";\n   }\n   constructor {}\n}\nFoo.name = \"Hello World\"\nconsole.log(Foo.name); // logs \"Hello World\"\n```\n\nSo the name property of the constructor function is no longer read-only. Based on this I assume Chromium internally does something like\n\n**Expected behavior:**\n\n``` javascript\nvar Foo = (function () {\n    function Foo() {\n    }\n    Object.defineProperty(Foo, \"name\", { writable: true; });  // \u003c= required for static class property *name*\n    Foo.name = function () {\n        return \"Hello World\";\n    };\n    return Foo;\n}());\n```\n\nSo a static class property _name_ requires the _name_ property to be made `writable: true` first. Unfortunately, `Object.defineProperty` is only available since ES 5 so static properties could become problematic for a compiler target of `es3`.\n\nTherefore you might also want to note, that section 9.11.2 of ES2015 spec states that the ES interpreter must not set the _name_ property, if a function does have an OwnProperty _name_. So the spec does seem to take custom values for _Function.name_ into account which is why I consider a default configuration of `writable: false` for Function.name being problematic. It would certainly be better if browser vendors could agree here on making Function.name `writable: true` by default.\n","author":{"url":"https://github.com/about-code","@type":"Person","name":"about-code"},"datePublished":"2016-07-17T17:39:30Z","url":"https://github.com/microsoft/TypeScript/issues/9778"}

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:beb6b9d6-ebea-a86f-e404-0dc2e566aa99
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD580:3C21B:32D9CF7:40FE9B7:6B01CA50
html-safe-nonce32b14582bd813c0b6fa410c89afcfed403f89960614ab3e6e1d35b462cae1444
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENTgwOjNDMjFCOjMyRDlDRjc6NDBGRTlCNzo2QjAxQ0E1MCIsInZpc2l0b3JfaWQiOiI3NTE0ODI3NjA1ODUwMzExMjQ4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac91005d9ee84be6cdf957388b6a30d883850255ebe4527d9788d6411538c1982b
hovercard-subject-tagissue:165986934
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/9778/issue_layout
twitter:imagehttps://opengraph.githubassets.com/f1a36b29a94e733b02f5848c8f3f75a4bf554ba00d4363e1e42549ead7c00f4b/microsoft/TypeScript/issues/9778
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/f1a36b29a94e733b02f5848c8f3f75a4bf554ba00d4363e1e42549ead7c00f4b/microsoft/TypeScript/issues/9778
og:image:altTypeScript Version: 1.8.10 Consider the following class definition with a static property name: class Foo { static name() { return "Hello World"; } constructor() {} } The TS emitter output for this...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameabout-code
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
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
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/9778#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F9778
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%2F9778
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/9778
Reloadhttps://github.com/microsoft/TypeScript/issues/9778
Reloadhttps://github.com/microsoft/TypeScript/issues/9778
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests312 (312)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/9778
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/9778
Emitter: Static class property "name" causes TypeError due to Function.name being readonlyhttps://github.com/microsoft/TypeScript/issues/9778#top
DuplicateAn existing issue was already createdhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Duplicate%22
https://github.com/about-code
Andreas Martin (about-code)https://github.com/about-code
on Jul 17, 2016https://github.com/microsoft/TypeScript/issues/9778#issue-165986934
https://github.com/about-code
Andreas Martin (about-code)https://github.com/about-code
on Jul 17, 2016https://github.com/microsoft/TypeScript/issues/9778#issuecomment-233198332
commenthttps://github.com/Microsoft/TypeScript/issues/2836#issuecomment-94558916
Alex Eagle (@alexeagle)https://github.com/alexeagle
Ron Buckton (@rbuckton)https://github.com/rbuckton
#2836https://github.com/microsoft/TypeScript/issues/2836
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Jul 17, 2016https://github.com/microsoft/TypeScript/issues/9778#issuecomment-233200379
#442https://github.com/microsoft/TypeScript/issues/442
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
DuplicateAn existing issue was already createdhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Duplicate%22
on Jul 17, 2016https://github.com/microsoft/TypeScript/issues/9778#event-725519603
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Sep 20, 2016https://github.com/microsoft/TypeScript/issues/9778#event-796485081
microsofthttps://github.com/microsoft
on Jun 19, 2018https://github.com/microsoft/TypeScript/issues/9778#event-1689842829
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/9778
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/9778
DuplicateAn existing issue was already createdhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Duplicate%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.