npm.io
1.1.5 • Published 2 years ago

@types/saywhen

Licence
MIT
Version
1.1.5
Deps
1
Size
4 kB
Vulns
0
Weekly
0
Stars
51.4K

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 1536 GMT
  • Dependencies: @types/jasmine

Credits

These definitions were written by Sean Sobey.