Fix the build with a hack

This commit is contained in:
Moshe Kolodny
2019-03-13 21:57:19 -04:00
parent 18be7de7bd
commit 5befd67eab

View File

@@ -1,7 +1,17 @@
import when = require('saywhen');
when(jasmine.createSpy('test')); // $ExpectType CallHandler<Spy>
when(jasmine.createSpy('test')).isCalled; // $ExpectType Proxy<Spy>
// This interface is needed to get around the fact that the new jasmine
// `createSpy` method takes a generic type while the old typings don't.
// That means that in Typescript 3.0 the spy will be `Spy` and in 3.1 it
// will be `Spy<InferableFunction>`. This interface matches both and is
// what dtslint will expect the type to be.
interface JasmineSpy extends jasmine.Spy {
(...params: any[]): any;
}
const spy: JasmineSpy = jasmine.createSpy('test');
when(spy); // $ExpectType CallHandler<JasmineSpy>
when(spy).isCalled; // $ExpectType Proxy<JasmineSpy>
when.captor(); // $ExpectType MatcherProxy<{}>
when.captor(jasmine.any(Number)); // $ExpectType MatcherProxy<Any>