{"action":"created","issue":{"url":"https://api.github.com/repos/angular/sickle/issues/131","repository_url":"https://api.github.com/repos/angular/sickle","labels_url":"https://api.github.com/repos/angular/sickle/issues/131/labels{/name}","comments_url":"https://api.github.com/repos/angular/sickle/issues/131/comments","events_url":"https://api.github.com/repos/angular/sickle/issues/131/events","html_url":"https://github.com/angular/sickle/issues/131","id":149293657,"number":131,"title":"Produce \"annotation\" emit","user":{"login":"alexeagle","id":47395,"avatar_url":"https://avatars.githubusercontent.com/u/47395?v=3","gravatar_id":"","url":"https://api.github.com/users/alexeagle","html_url":"https://github.com/alexeagle","followers_url":"https://api.github.com/users/alexeagle/followers","following_url":"https://api.github.com/users/alexeagle/following{/other_user}","gists_url":"https://api.github.com/users/alexeagle/gists{/gist_id}","starred_url":"https://api.github.com/users/alexeagle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexeagle/subscriptions","organizations_url":"https://api.github.com/users/alexeagle/orgs","repos_url":"https://api.github.com/users/alexeagle/repos","events_url":"https://api.github.com/users/alexeagle/events{/privacy}","received_events_url":"https://api.github.com/users/alexeagle/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-18T22:49:20Z","updated_at":"2016-04-19T00:52:42Z","closed_at":null,"body":"The TS Decorator emit doesn't tree-shake with closure compiler.\r\n\r\nWith Sickle@head, a typical decorated class looks like\r\n```\r\nlet PercentPipe = class extends NumberPipe {\r\n    /**\r\n     * @param {?} value\r\n     * @param {?} args\r\n     * @return {?}\r\n     */\r\n    transform(value, args) {\r\n        var /** @type {?} */ digits = collection_1.ListWrapper.first(args);\r\n        return NumberPipe._format(value, intl_1.NumberFormatStyle.Percent, digits);\r\n    }\r\n};\r\nPercentPipe = __decorate([\r\n    lang_1.CONST(),\r\n    core_1.Pipe({ name: 'percent' }),\r\n    core_1.Injectable(),\r\n    __metadata('design:paramtypes', [])\r\n], PercentPipe);\r\nexports.PercentPipe = PercentPipe;\r\n```\r\n\r\nClosure cannot remove this class from the output, because\r\n- `__decorate` loses the type of the original declared class\r\n- Decorators can modify the declaration of the class in a way that allows runtime references to the class\r\n- decorator metadata (`--emitDecoratorMetadata`) is stored in a global variable and references all decorated classes.\r\n\r\nThis causes angular2 to be something like 40% larger than it should be.\r\n\r\n## Proposal\r\n\r\nMark some decorators as \"require annotation semantics\". In these semantics, the decorator cannot modify the class declaration or retain references, it can only patch additional properties on the function representing the type.\r\n\r\nWhen sickle encounters one of these decorators, it should do its own lowering to a syntax @tbosch  will describe..."},"comment":{"url":"https://api.github.com/repos/angular/sickle/issues/comments/211658853","html_url":"https://github.com/angular/sickle/issues/131#issuecomment-211658853","issue_url":"https://api.github.com/repos/angular/sickle/issues/131","id":211658853,"user":{"login":"tbosch","id":690815,"avatar_url":"https://avatars.githubusercontent.com/u/690815?v=3","gravatar_id":"","url":"https://api.github.com/users/tbosch","html_url":"https://github.com/tbosch","followers_url":"https://api.github.com/users/tbosch/followers","following_url":"https://api.github.com/users/tbosch/following{/other_user}","gists_url":"https://api.github.com/users/tbosch/gists{/gist_id}","starred_url":"https://api.github.com/users/tbosch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbosch/subscriptions","organizations_url":"https://api.github.com/users/tbosch/orgs","repos_url":"https://api.github.com/users/tbosch/repos","events_url":"https://api.github.com/users/tbosch/events{/privacy}","received_events_url":"https://api.github.com/users/tbosch/received_events","type":"User","site_admin":false},"created_at":"2016-04-19T00:52:42Z","updated_at":"2016-04-19T00:52:42Z","body":"The problem is that the spec for decorators prevents tree shaking in\ngeneral. I.e. this is a spec problem of decorators in general.\n\nOn Mon, Apr 18, 2016 at 4:09 PM Alex Eagle <notifications@github.com> wrote:\n\n> It's not only the angular framework, but also any third-party components\n> (like all of material2) that would need to de-sugar their decorators this\n> way.\n> It's a TS problem, insofar as we want to have an Annotations language\n> feature instead of Decorators, and other similar usages would want it too.\n> We could do the transformation somewhere else, but it would look almost\n> identical to sickle, just run under different circumstances?\n>\n> —\n> You are receiving this because you were mentioned.\n> Reply to this email directly or view it on GitHub\n> <https://github.com/angular/sickle/issues/131#issuecomment-211624738>\n>\n"}}