title: Customize Typescript compiler output
body: <p>I need some help getting started in customizing the compiler output of typescript, or to be more precise if it is even possible.</p>
  
  <p>I have the openui5 framework, which syntax, for example extending classes, varies strongly from ES5+ standards. Also AMD works differently.</p>
  
  <p>Here is an example:</p>
  
  <p>I would like to import a module. In typescript it should be:</p>
  
  <pre><code>import { Button } from "sap/m/Button";
  </code></pre>
  
  <p>which puts out something like this in javascript:</p>
  
  <pre><code>var Button = require("sap/m/Button");
  </code></pre>
  
  <p>But what I need here is:</p>
  
  <pre><code>var Button = sap.ui.require("sap/m/Button");
  </code></pre>
  
  <p>Another example:</p>
  
  <p>Properties are resolved with getter and setter functions. So when you extend a class you can give it a json object with properties:</p>
  
  <pre><code>properties: {
     "title" : "string",                         // a simple string property, default value is undefined
     "buttonText" : {defaultValue: "Search"},    // when no type is given, the type is string
     "showLogoutButton" : {type : "boolean", defaultValue : true},   // a boolean property where a default value is given
     "width" : {type : "sap.ui.core.CSSSize", defaultValue : "50px"} // a CSS size property where a default value is given
  }
  </code></pre>
  
  <p>now openui5 will take the given property and generate the setters. For example for the "title" property the two functions will be generated:</p>
  
  <pre><code>getTitle();
  setTitle(value);
  </code></pre>
  
  <p>But no ES 5 property.</p>
  
  <p>So in typescript you cannot access your property like this:</p>
  
  <p>let myclass = new MyClass();
  myclass.title = "Hello World";</p>
  
  <p>but you will have to use the getter and setter methods:</p>
  
  <p>let myclass = new MyClass();
  myclass.setTitle("Hello World");</p>
  
  <p>What I would like to do here is to write this typescript code:</p>
  
  <pre><code>let myclass = new MyClass();
  myclass.title = "Hello World";
  </code></pre>
  
  <p>which transpiles to this javascript code:</p>
  
  <pre><code>let myclass = new MyClass();
  myclass.setTitle("Hello World");
  </code></pre>
  
  <p>I think I can do this on my classes using decorators, but you cannot use decorators in declaration files (d.ts). So I cannot use the base classes this way.</p>
  
  <p>So here is my question:</p>
  
  <p><strong>Is it possible to extend the typescript transpiler and tell it to compile this stuff differently?</strong></p>
  
  <p>A push in the right direction would be much appreciated.</p>