alsatian-test/alsatian

View on GitHub
packages/alsatian/core/spying/any-argument.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { TypeMatcher } from "../spying";
import { InterfaceMatcher } from "./interface-matcher";
import { MatcherOrType } from "./matcher-or-type";
import { Constructor } from "../_interfaces";

export function Any<ExpectedType extends object>(): InterfaceMatcher<ExpectedType>;
export function Any<ExpectedType extends object>(type: Constructor<ExpectedType>): MatcherOrType<ExpectedType>;
export function Any<ExpectedType extends object>(
    type?: new (...args: Array<any>) => ExpectedType
): MatcherOrType<ExpectedType> | InterfaceMatcher<ExpectedType> {
    if (type) {
        return new TypeMatcher<ExpectedType>(type) as MatcherOrType<ExpectedType>;
    }

    return new InterfaceMatcher<ExpectedType>();
}