René's URL Explorer Experiment


Title: Decorators · Issue #2249 · microsoft/TypeScript · GitHub

Open Graph Title: Decorators · Issue #2249 · microsoft/TypeScript

X Title: Decorators · Issue #2249 · microsoft/TypeScript

Description: ES7 proposal The ES7 proposal for decorators can be found here: https://github.com/wycats/javascript-decorators The ES7 proposal serves as the base of this proposal. Below are notes about how the type system Decorator targets: Class cons...

Open Graph Description: ES7 proposal The ES7 proposal for decorators can be found here: https://github.com/wycats/javascript-decorators The ES7 proposal serves as the base of this proposal. Below are notes about how the t...

X Description: ES7 proposal The ES7 proposal for decorators can be found here: https://github.com/wycats/javascript-decorators The ES7 proposal serves as the base of this proposal. Below are notes about how the t...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Decorators","articleBody":"\u003e ## ES7 proposal\n\u003e \n\u003e The ES7 proposal for decorators can be found here: https://github.com/wycats/javascript-decorators\n\u003e The ES7 proposal serves as the base of this proposal. Below are notes about how the type system \n## Decorator targets:\n### Class constructor\n\n``` ts\n@F(\"color\")\n@G\nclass Foo {\n}\n```\n\ndesugars to:\n\n``` js\nvar Foo = (function () {\n    function Foo() {\n    }\n    Foo = __decorate([F(\"color\"), G], Foo);\n    return Foo;\n})();\n```\n### Methods\n\n``` ts\nclass Foo {\n  @F(color)\n  @G\n  bar() { }\n}\n```\n\ndesugars to:\n\n``` js\nvar Foo = (function () {\n    function Foo() {\n    }\n    Foo.prototype.bar = function () {\n    };\n    Object.defineProperty(Foo.prototype, \"bar\", __decorate([F(color), G], Foo.prototype, \"bar\", Object.getOwnPropertyDescriptor(Foo.prototype, \"bar\")));\n    return Foo;\n})();\n```\n## Static method\n\n``` ts\nclass Foo {\n    @F(\"color\")\n    @G\n    static sMethod() {}\n}\n```\n\ndesugars to:\n\n``` js\nvar Foo = (function () {\n    function Foo() {\n    }\n    Foo.sMethod = function () {\n    };\n    Object.defineProperty(Foo, \"sMethod\", __decorate([F(\"color\"), G], Foo, \"sMethod\", Object.getOwnPropertyDescriptor(Foo, \"sMethod\")));\n    return Foo;\n})();\n```\n### Properties\n\n``` ts\nclass Foo {\n    @F(\"color\")\n    @G\n    prop: number;\n}\n```\n\ndesugars to:\n\n``` js\nvar Foo = (function () {\n    function Foo() {\n    }\n    __decorate([F(\"color\"), G], Foo.prototype, \"prop\");\n    return Foo;\n})();\n```\n### Method/Accessor formal parameter\n\n``` ts\nclass Foo {\n    method(@G a, @F(\"color\") b) {}\n}\n```\n\ndesugars to:\n\n``` js\nvar Foo = (function () {\n    function Foo() {\n    }\n    Foo.prototype.method = function (a, b) {\n    };\n    __decorate([G], Foo.prototype, \"method\", 0);\n    __decorate([F(\"color\")], Foo.prototype, \"method\", 1);\n    return Foo;\n})();\n```\n\nWhere the __decorate is defined as:\n\n``` js\nvar __decorate = this.__decorate || function (decorators, target, key, value) {\n    var kind = typeof (arguments.length == 2 ? value = target : value);\n    for (var i = decorators.length - 1; i \u003e= 0; --i) {\n        var decorator = decorators[i];\n        switch (kind) {\n            case \"function\": value = decorator(value) || value; break;\n            case \"number\": decorator(target, key, value); break;\n            case \"undefined\": decorator(target, key); break;\n            case \"object\": value = decorator(target, key, value) || value; break;\n        }\n    }\n    return value;\n};\n```\n## Decorator signatures:\n\nA valid decorator should be:\n1. Assignable to one of the Decorator types (ClassDecorator | PropertyDecorator | MethodDecorator | ParameterDecorator) as described below.\n2. Return a value (in the case of class decorators and method decorator) that is assignable to the decorated value.\n\n``` ts\ndeclare type ClassDecorator = \u003cTFunction extends Function\u003e(target: TFunction) =\u003e TFunction | void;\ndeclare type PropertyDecorator = (target: Object, propertyKey: string | symbol) =\u003e void;\ndeclare type MethodDecorator = \u003cT\u003e(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor\u003cT\u003e) =\u003e TypedPropertyDescriptor\u003cT\u003e | void;\ndeclare type ParameterDecorator = (target: Function, propertyKey: string | symbol, parameterIndex: number) =\u003e void;\n```\n### Notes:\n- Decorating a function declaration is not allowed as it will block hoisting the function to the top of the scope, which is a significant change in semantics. \n- Decorating function expressions and arrow functions are not supported. The same effect can be achived by applying the decorator function as `var x = dec(function () { });` \n- Decorating function formal parameters is currently not part of the ES7 proposal.\n- Decorators are not allowed when targeting ES3\n","author":{"url":"https://github.com/rbuckton","@type":"Person","name":"rbuckton"},"datePublished":"2015-03-07T03:14:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":139},"url":"https://github.com/2249/TypeScript/issues/2249"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:61616ad7-07c0-4544-2adb-00a7c42e6650
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDB6C:1BE754:2DBD53:3FDFDF:6A62F33B
html-safe-nonce711f02e6e1be7cfd890ede2574c28075812d421735fbc5cc15e3c7f3aa97794a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQjZDOjFCRTc1NDoyREJENTM6M0ZERkRGOjZBNjJGMzNCIiwidmlzaXRvcl9pZCI6IjE2MDc0MTUxODE4Nzc2Mzc5NDciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacf21f0b80eedabc87fb1a2474e7dfc587c3aa16c2246642c51721c5dbb35b1d4c
hovercard-subject-tagissue:60187635
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/2249/issue_layout
twitter:imagehttps://opengraph.githubassets.com/02c1ddad5e12108591d64e0e0f9429e6a24d85dc7dd76955211d106f2220a2a9/microsoft/TypeScript/issues/2249
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/02c1ddad5e12108591d64e0e0f9429e6a24d85dc7dd76955211d106f2220a2a9/microsoft/TypeScript/issues/2249
og:image:altES7 proposal The ES7 proposal for decorators can be found here: https://github.com/wycats/javascript-decorators The ES7 proposal serves as the base of this proposal. Below are notes about how the t...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamerbuckton
hostnamegithub.com
expected-hostnamegithub.com
Noneb415018e190e73858133ddcaa36acce7b3f3572fe54dda84bd3b21a6ec714c30
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
release22f98521e99f504294ab0812b66104d50eb75a70
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/2249#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F2249
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F2249
Sign up https://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/2249
Reloadhttps://github.com/microsoft/TypeScript/issues/2249
Reloadhttps://github.com/microsoft/TypeScript/issues/2249
Please reload this pagehttps://github.com/microsoft/TypeScript/issues/2249
microsoft https://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Notifications https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Fork 13.6k https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Star 110k https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Code https://github.com/microsoft/TypeScript
Issues 5k+ https://github.com/microsoft/TypeScript/issues
Pull requests 21 https://github.com/microsoft/TypeScript/pulls
Actions https://github.com/microsoft/TypeScript/actions
Projects https://github.com/microsoft/TypeScript/projects
Models https://github.com/microsoft/TypeScript/models
Wiki https://github.com/microsoft/TypeScript/wiki
Security and quality 0 https://github.com/microsoft/TypeScript/security
Insights https://github.com/microsoft/TypeScript/pulse
Code https://github.com/microsoft/TypeScript
Issues https://github.com/microsoft/TypeScript/issues
Pull requests https://github.com/microsoft/TypeScript/pulls
Actions https://github.com/microsoft/TypeScript/actions
Projects https://github.com/microsoft/TypeScript/projects
Models https://github.com/microsoft/TypeScript/models
Wiki https://github.com/microsoft/TypeScript/wiki
Security and quality https://github.com/microsoft/TypeScript/security
Insights https://github.com/microsoft/TypeScript/pulse
Decoratorshttps://github.com/microsoft/TypeScript/issues/2249#top
https://github.com/rbuckton
CommittedThe team has roadmapped this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Committed%22
ES NextNew featurers for ECMAScript (a.k.a. ESNext)https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22ES%20Next%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
https://github.com/rbuckton
rbucktonhttps://github.com/rbuckton
on Mar 7, 2015https://github.com/microsoft/TypeScript/issues/2249#issue-60187635
https://github.com/wycats/javascript-decoratorshttps://github.com/wycats/javascript-decorators
rbucktonhttps://github.com/rbuckton
CommittedThe team has roadmapped this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Committed%22
ES NextNew featurers for ECMAScript (a.k.a. ESNext)https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22ES%20Next%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
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.