This class hides the implementation details of inheriting from Function in the documentation. (By default, typedoc exposes all the inherited properties and members, which we don't want. By inheriting from it instead of from Function, we keep the documentation free of unimportant details.)

The way this works is that you subclass CallableObject and define a constructor that calls super(someClosure) where someClosure is a unique function object, which will then pick up any properties or methods defined by the subclass.

Type Parameters

  • T extends AnyFunction

    The call/return signature that instances of the class will implement.

Hierarchy (view full)

  • Function
  • T
    • CallableObject

Constructors

Constructors

  • Type Parameters

    Parameters

    • fn: T

      A unique function or closure, to be passed to super() in a subclass. The function object will gain a prototype from new.target, thereby picking up any properties or methods defined by the class, and becoming this for the calling constructor.

      (Note that calling the constructor by any means other than super() from a constructor will result in an error or some other unhelpful result.)

    Returns CallableObject<T>