I am trying to spy on a generic method in TypeScript, but Jasmine is not recognizing it.
Here is the code snippet:
http: HttpClient <- Not actual code, just showing type.
...
this.http.get<Customer[]>(url);
In this code, I am trying to mock the get<...>
method.
const httpMock = {} as HttpClient;
spyOn(httpMock, 'get')
.and.returnValue(of({} as Customer[]));
However, when I execute the test, I encounter the following error:
Error: : get() method does not exist
Usage: spyOn(, )