{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4460","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4460/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4460/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4460/events","html_url":"https://github.com/Microsoft/TypeScript/issues/4460","id":103161207,"number":4460,"title":"Proposal. Internal class declaration.","user":{"login":"xLama","id":8139881,"avatar_url":"https://avatars.githubusercontent.com/u/8139881?v=3","gravatar_id":"","url":"https://api.github.com/users/xLama","html_url":"https://github.com/xLama","followers_url":"https://api.github.com/users/xLama/followers","following_url":"https://api.github.com/users/xLama/following{/other_user}","gists_url":"https://api.github.com/users/xLama/gists{/gist_id}","starred_url":"https://api.github.com/users/xLama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xLama/subscriptions","organizations_url":"https://api.github.com/users/xLama/orgs","repos_url":"https://api.github.com/users/xLama/repos","events_url":"https://api.github.com/users/xLama/events{/privacy}","received_events_url":"https://api.github.com/users/xLama/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-26T03:04:14Z","updated_at":"2015-08-26T07:03:25Z","closed_at":null,"body":"I think it´s a good idea to let an internal class declaration:\r\n\r\n```\r\nclass A{\r\n   class B{}\r\n}\r\n\r\n```\r\n\r\nEmit proposal:\r\n\r\n```\r\nvar A = (function () {\r\n\r\n     var B = (function () {\r\n    function B() {\r\n    }\r\n    return B;\r\n})();\r\n\r\n\r\n    function A() {\r\n    }\r\n    return A;\r\n})();\r\n\r\n```\r\n\r\nWe can use it to make Singleton very easy.\r\n\r\n```\r\nclass Singleton{\r\n\t\r\n\tclass B{\r\n\t\tprivate enforcer:string;\r\n\t}\r\n\r\n\tprivate static _instance:Singleton;\r\n\t\r\n\tconstructor(enforcer: B){}\r\n\t\r\n\tpublic static get instance():Singleton{\r\n\t\tif (Singleton._instance === undefined){\r\n\t\t\tSingleton._instance = new Singleton(new B())\r\n\t\t}\r\n\t\treturn Singleton._instance;\r\n\t}\r\n}\r\n\r\n```\r\n\r\nRelated: #3266"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/134871030","html_url":"https://github.com/Microsoft/TypeScript/issues/4460#issuecomment-134871030","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4460","id":134871030,"user":{"login":"kitsonk","id":1282577,"avatar_url":"https://avatars.githubusercontent.com/u/1282577?v=3","gravatar_id":"","url":"https://api.github.com/users/kitsonk","html_url":"https://github.com/kitsonk","followers_url":"https://api.github.com/users/kitsonk/followers","following_url":"https://api.github.com/users/kitsonk/following{/other_user}","gists_url":"https://api.github.com/users/kitsonk/gists{/gist_id}","starred_url":"https://api.github.com/users/kitsonk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitsonk/subscriptions","organizations_url":"https://api.github.com/users/kitsonk/orgs","repos_url":"https://api.github.com/users/kitsonk/repos","events_url":"https://api.github.com/users/kitsonk/events{/privacy}","received_events_url":"https://api.github.com/users/kitsonk/received_events","type":"User","site_admin":false},"created_at":"2015-08-26T07:03:25Z","updated_at":"2015-08-26T07:03:25Z","body":"How would you propose emitting this when targeting ES6, since that isn't valid ES6?"}}