Create custom jasmine matcher using Typescript : <p>I'm using jasmine on an angular2 project and having some trouble writing a custom matcher for a test. I want to be able to compare two relatively complex objects. I found <a href="http://www.tomdoescode.co.uk/2016/06/jasmine-custom-matchers-with-typescript.html" rel="noreferrer">this article</a> which claims to solve the issue but it simply results in a typescript error stating that it doesn't recognize the new method on jasmine's <code>Matchers</code> object. The relevant code is this:</p>

<pre><code>declare module jasmine {
    interface Matchers {
        toBeNumeric(): void;
    }
}
</code></pre>

<p><a href="https://medium.com/@cwmrowe/making-jasmine-and-typescript-play-nicely-c2f4bef1830a#.72pdxywdl" rel="noreferrer">Another article</a> gives a similar, but slightly different solution that gives the same error.</p>

<pre><code>declare namespace jasmine {
    interface Matchers {
        toHaveText(expected: string): boolean;
    }
}
</code></pre>

<p>I tried this</p>

<pre><code>let m: jasmine.Matchers = expect(someSpy.someMethod).toHaveBeenCalled();
</code></pre>

<p>and got this error:</p>

<blockquote>
  <p>Type 'jasmine.Matchers' is not assignable to type 'jasmine.Matchers'.
  Two different types with this name exist, but they are unrelated.</p>
</blockquote>

<p>That seems to indicate that the <code>declare namespace jasmine</code> statement is creating a new <code>jasmine</code> namespace rather than extending the existing one.</p>

<p>So how can I create my own matcher that typescript will be happy with?</p>
