Installation
npm install --save @types/saywhen
Summary
This package contains type definitions for saywhen (https://github.com/pushtechnology/saywhen).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/saywhen.
index.d.ts
/// <reference types="jasmine" />
type Func = (...args: any[]) => any;
declare function when<T extends Func>(spy: T & jasmine.Spy): CallHandler<T>;
declare namespace when {
function captor<T>(val?: T): MatcherProxy<T>;
function noConflict(): void;
function is<T>(val: T): boolean;
}
interface CallHandler<T extends Func> {
readonly isCalled: Proxy<T>;
isCalledWith(...args: any[]): Proxy<T>;
}
interface Proxy<T extends Func> {
then(fn: T): Proxy<T>;
thenReturn(val: any): Proxy<T>;
thenThrow(err: Error): Proxy<T>;
}
interface MatcherProxy<T> {
(arg: T): boolean;
readonly latest: T;
values(): T[];
}
export = when;
Additional Details
- Last updated: Tue, 07 Nov 2023 15:11:36 GMT
- Dependencies: @types/jasmine
Credits
These definitions were written by Sean Sobey.