{"action":"closed","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4876","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4876/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4876/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4876/events","html_url":"https://github.com/Microsoft/TypeScript/issues/4876","id":107359743,"number":4876,"title":" Typescript Extensibility / Plugins","user":{"login":"nbellowe","id":6980698,"avatar_url":"https://avatars.githubusercontent.com/u/6980698?v=3","gravatar_id":"","url":"https://api.github.com/users/nbellowe","html_url":"https://github.com/nbellowe","followers_url":"https://api.github.com/users/nbellowe/followers","following_url":"https://api.github.com/users/nbellowe/following{/other_user}","gists_url":"https://api.github.com/users/nbellowe/gists{/gist_id}","starred_url":"https://api.github.com/users/nbellowe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbellowe/subscriptions","organizations_url":"https://api.github.com/users/nbellowe/orgs","repos_url":"https://api.github.com/users/nbellowe/repos","events_url":"https://api.github.com/users/nbellowe/events{/privacy}","received_events_url":"https://api.github.com/users/nbellowe/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-09-19T22:49:57Z","updated_at":"2015-09-21T21:44:18Z","closed_at":"2015-09-21T21:44:18Z","body":"I think typescript could benefit from some sort of plugin/extensibility system. This would allow for people to design language features that are helpful to their particular needs, without requiring a change in Typescript.\r\n\r\nHere are a few examples of possible extensions:\r\n\r\n  1. Add language support for defining properties with getters and setters.\r\n     - Too big of a change, possibly not useful enough to warrant a change in Typescript, but it would be super cool if I could make a seperate npm package called typescript-properties, and anyone could pull that, and utilize it in there apps. This could maybe be an example that decorators could take care of, not sure.\r\n            \r\n   ```\r\nproperty hello:T\r\n            compiles to\r\n_hello:T\r\nget hello():T { return this._hello }\r\nset hello(v:T){ this._hello = v }\r\n```           \r\n \r\n  2. Add preprocessing to the code that doesn't break source mapping.\r\n    ```\r\n            #IF(DEBUG)\r\n               expr;\r\n            #ENDIF\r\n```\r\n    While this can be accomplished with external tools, it breaks source mapping. With a complex build, like:\r\n    1. Original TS\r\n    2. Post-pre-processed TS\r\n    3. Compiled TS (Javascript) and sourcemaps to PPP-TS\r\n    4. Single-file JS (may need to be ordered in optimal way) & source map to PPP-TS if the tool supports input source mapping.\r\n    5. Minified Javascript & source map & source map to PPP-TS if the tool supports it.\r\n\r\n    -- note(UglifyJS can optimize out constants, so defining a `const DEBUG=true|false` can optimize out debug code as well.  `if(DEBUG) expr;`)\r\n"}}