title: TypeScript pass by ref parameter
body: <p>In C# it is possible to pass parameters by reference. For instance:</p>
  
  <pre><code>    private void Add(ref Node node)
      {
          if (node == null)
          {
              node = new Node();
          }
      }
      Add(ref this.Root);
  </code></pre>
  
  <p><code>this.Root</code> would not be null after doing <code>Add(ref this.Root)</code></p>
  
  <p>From what I've seen from TypeScript, it is not possible to pass parameters by reference. This code:</p>
  
  <pre><code>    private addAux(node: Node): void {
          if (node === undefined) {
              node = new Node();
          }
      }
      addAux(this._root);
  </code></pre>
  
  <p>After doing <code>addAux(this._root)</code>, <code>this._root</code> will still be undefined because a copy of it will be passed into <code>addAux</code>.</p>
  
  <p>Is there a workaround to have the same feature as the <code>ref</code> keyword from C# in TypeScript?</p>