title: Argument of type '""' is not assignable to parameter of type '"prototype"' jasmine
body: <p><strong>Update:</strong></p>
  
  <p>Seems the following works:</p>
  
  <pre><code>let gaService = TestBed.get(GAService);
  </code></pre>
  
  <p>and spy on gaService.</p>
  
  <p>I am really blank on what I am missing exactly here. The service sends data to google analytics so i have to mock it during my tests. The service itself is:</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { CoreService} from "./core.service";
  
  @Injectable()
  export class GAService {
    constructor(
      public coreService: CoreService
    ) { }
  
    public sendException (
      description: string,
      isFatal: boolean
    ) : Promise&lt;any&gt; {
  
      let promise = new Promise((resolve, reject) =&gt; {
  
        (&lt;any&gt;window).ga('send', 'exception', {
          'exDescription': description,
          'exFatal': isFatal
        });
      });
  
      return promise;
    }
  
  }
  </code></pre>
  
  <p>and it is mocked like this:</p>
  
  <pre><code>import { Injectable } from "@angular/core";
  @Injectable()
  export class MockGAService {
    constructor() {}
  
    sendException(
      description: string,
      isFatal: boolean
    ): Promise&lt;any&gt; {
      return Promise.resolve(true);
    }
  
  }
  </code></pre>
  
  <p>now during my tests, I have an event that will raise an exception and I want to make sure the sendException is indeed called, so I spied on the event like this:</p>
  
  <pre><code>let preventDefaultSpy = spyOn(
    GAService,
    "sendException"
  );
  </code></pre>
  
  <p>but it doesn't compile at all with the message:</p>
  
  <pre><code>Argument of type '"sendException"' is not assignable to parameter of type '"prototype"'
  </code></pre>
  
  <p>The only way I get it to compile is if i do:</p>
  
  <pre><code>let preventDefaultSpy = spyOn(
    GAService.prototype,
    "sendException"
  );
  </code></pre>
  
  <p>but then it is never called when I do:</p>
  
  <pre><code>expect(preventDefaultSpy).toHaveBeenCalled();
  </code></pre>
  
  <p>just for check, I did a console output on sendException() of the mock and it shows output, hinting it was indeed called.</p>
  
  <p>What am I doing wrong?</p>