mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 07:40:10 +00:00
Fix the build with a hack
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user