How to mock objects with custom methods in Angular 2?
<p>I want to add custom methods to my class definitions in Angular 2. But I get errors like the following when I try to then create mock objects (see the Angular 2 <a href="https://angular.io/docs/ts/latest/tutorial/toh-pt2.html" rel="nofollow">Tour of Heroes</a> tutorial).</p>

<pre><code>public/app/mock-searches.ts(3,14): error TS2322: Type '{ box: { x: number; y: number; width: number; height: number; }; dateCreated: Date; eventIdStr: s...' is not assignable to type 'Search[]'.
  Type '{ box: { x: number; y: number; width: number; height: number; }; dateCreated: Date; eventIdStr: s...' is not assignable to type 'Search'.
    Property 'refreshProducts' is missing in type '{ box: { x: number; y: number; width: number; height: number; }; dateCreated: Date; eventIdStr: s...'.
public/app/search.service.ts(33,40): error TS2304: Cannot find name 'err'.
</code></pre>

<p><code>refreshProducts(): void</code> is a method declared for the <code>Search</code> class I'm trying to mock. How can I best resolve this error? Or am I trying to do something backwards, that may handled in a more conventional way in Angular 2?</p>

<h3>search.ts (sample)</h3>

<pre><code>import { Rect } from './rect';

export class Search {
  box: Rect;
  dateCreated: Date;
  products: Product[];

  refreshProducts(): void {
    // Do something useful
  }
}
</code></pre>

<h3>mock-searches.js (sample)</h3>

<pre><code>import { Search } from './search';

export const SEARCHES: Search[] = [
  { 
    box: { x: 4, y: 4, width: 20, height: 20 },
    dateCreated: new Date(),
    products: []
  }
];
</code></pre>