Skip to content

[Enhancement] Support isFunction<T>() #502

@jtenner

Description

@jtenner

I'm developing an assertion library, and it would be helpful to be able to assert if a type is a function.

A simple use case is the toThrow() expectation function.

  @inline
  public toThrow(message: string = ""): void {
    // assert(isFunction<T>(), "toThrow expectation must be called on a function type.");
    var throws: bool = !tryCall(this.actual!);
    reportActualString<string>(throws ? "throws" : "not throws");
    reportExpectedString("throws", this._not);
    assert(this._not ^ throws, message);
    clearExpected();
  }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions