title: Object Equality in Typescript
body: <p>I'm creating a lib on vectors in typescript. My very first test failed:).</p>
  
  <p>It's related to object equality in TypeScript/JavaScript but I can't find a way to make the test green. No object equality is mentioned in typescript's official doc <a href="http://www.typescriptlang.org/Handbook#classes" rel="noreferrer">http://www.typescriptlang.org/Handbook#classes</a>.</p>
  
  <p>Could someone please give me a hand ?</p>
  
  <p>This is the source code.</p>
  
  <pre><code>class Vector {
      x: number;
      y: number;
  
      constructor(x: number, y: number) {
          this.x = x;
          this.y = y;
      }
  
      add(that: Vector) {
          return new Vector(this.x + that.x, this.y + that.y);
      }
  }
  
  export = Vector;
  </code></pre>
  
  <p>Then I have a unit test on this class as follows </p>
  
  <pre><code> var Vector = require("../lib/vector")
  
   describe("vector", function () {
    it("should add another vector", function () {
      var v1 = new Vector(1, 1);
      var v2 = new Vector(2, 3);
      expect(v1.add(v2)).toEqual(new Vector(3, 4));
    });
  });
  </code></pre>
  
  <p>When executed obtains the following error</p>
  
  <pre><code>Failures: 
  1) vector should add another vector
  1.1) Expected Vector({ x: 3, y: 4 }) to be Vector({ x: 3, y: 4 }).
  </code></pre>