I can't believe I didn't know this. Whenever my team would need to save a spy in a unit test we would leave it untyped, sort of like this:

view plain print about
1const mySpy = spyOn(object, 'method');

We usually only need to do this when we are introspecting into the spy to look for arguments on a specific method call.

However, I just discovered that you can specify a formal type for the spy. Import it:

view plain print about
1import Spy = jasmine.Spy;

And then create it:

view plain print about
1const mySpy: Spy = spyOn(object, 'method');

Sometimes this can be helpful for IDE auto complete.

There is always something new to learn. What did you learn today?