{"action":"opened","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/11171","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/11171/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/11171/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/11171/events","html_url":"https://github.com/Microsoft/TypeScript/issues/11171","id":179415116,"number":11171,"title":"Why generate extra closure wrapper for class?","user":{"login":"zengfenfei","id":773310,"avatar_url":"https://avatars.githubusercontent.com/u/773310?v=3","gravatar_id":"","url":"https://api.github.com/users/zengfenfei","html_url":"https://github.com/zengfenfei","followers_url":"https://api.github.com/users/zengfenfei/followers","following_url":"https://api.github.com/users/zengfenfei/following{/other_user}","gists_url":"https://api.github.com/users/zengfenfei/gists{/gist_id}","starred_url":"https://api.github.com/users/zengfenfei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zengfenfei/subscriptions","organizations_url":"https://api.github.com/users/zengfenfei/orgs","repos_url":"https://api.github.com/users/zengfenfei/repos","events_url":"https://api.github.com/users/zengfenfei/events{/privacy}","received_events_url":"https://api.github.com/users/zengfenfei/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-27T07:20:13Z","updated_at":"2016-09-27T07:20:13Z","closed_at":null,"body":"TS code:\r\n```typescript\r\nclass Client {\r\n    prop: string;\r\n\r\n    constructor() {\r\n        this.prop = \"a\";\r\n    }\r\n\r\n    method() {\r\n        console.log(\"A method\");\r\n    }\r\n\r\n    static stProp: string = \"val\";\r\n}\r\n```\r\n\r\nGenerated es5 code:\r\n```javascript\r\nvar Client = (function () {\r\n    function Client() {\r\n        this.prop = \"a\";\r\n    }\r\n    Client.prototype.method = function () {\r\n        console.log(\"A method\");\r\n    };\r\n    Client.stProp = \"val\";\r\n    return Client;\r\n}());\r\n```\r\n\r\nI am just wondering why not just generate a function without wrapper:\r\n```javascript\r\nfunction Client() {\r\n    this.prop = \"a\";\r\n}\r\nClient.prototype.method = function () {\r\n    console.log(\"A method\");\r\n};\r\nClient.stProp = \"val\";\r\n```\r\nIsn't this simpler and smaller?"}}
{"actor":{"display_login":"zengfenfei"}}