title: Angular 7 Add an extension method to primitives
body: <p>I would like to add few methods to primitives.
  I have the following file:</p>
  
  <p><strong>string-extension.ts:</strong></p>
  
  <pre><code>interface String {
      isNullOrEmpty(this: string): boolean;
  }
  
  String.prototype.isNullOrEmpty = function (this: string): boolean {
      return !this;
  };
  </code></pre>
  
  <p>I have a component which has the following code:</p>
  
  <pre><code>constructor () {
      let a = "asd";
      alert(a.isNullOrEmpty());
  }
  </code></pre>
  
  <p>no import is added at the top.
  When I run the client, it crashes on that line.</p>
  
  <pre><code>a.isNullOrEmpty is not a function
  </code></pre>
  
  <p>When I inspect the code, i see that my string-extension.ts file wasn't included there.
  I am very familiar with the concept in C# but im not quite familiar with it in TypeScript, so if you need more info, ill provide.</p>
  
  <p>Thanks.</p>