ReviseAlgo Logo

Objects & Interfaces

Hybrid Types (Callable Interfaces)

Master hybrid types in TypeScript, callable interfaces, construct signatures, function properties, and typing complex JavaScript legacy utilities like jQuery or Express.

Last Updated: July 29, 2026 10 min read

Because JavaScript is dynamic, an object can simultaneously act as both a callable function AND an object with attached properties. In TypeScript, an interface that describes a callable object with properties is called a Hybrid Type or Callable Interface.

1. Syntax for Hybrid Types

A hybrid type combines a Call Signature ((param: Type): ReturnType) with standard object property declarations inside an interface definition.

2. Real-World Use Case: Express Middleware & Axios Instance

Popular JavaScript libraries rely heavily on hybrid types:

  • Axios: axios('/api/user') is a callable function, but also has methods like axios.get(), axios.post(), and property axios.defaults.
  • Express: app(req, res) is a request listener function, but also has methods like app.use() and app.listen().
  • Example: Typing an Axios-like Fetch Utility

    3. Construct Signatures (new Operator)

    Interfaces can also define Construct Signatures using the new keyword to type functions that act as constructor functions instantiated via new:

    4. Interactive Code Playground

    Test hybrid types below:

    5. Common Pitfalls & Edge Cases

  • Manual Type Assertion Requirement: Because JavaScript object instantiation cannot create a function and attach properties in a single literal, implementing a hybrid function usually requires a type assertion (as Counter).
  • 6. Summary Table

    Signature TypeSyntax in InterfacePurpose
    Call Signature(args): ReturnType;Types object invocation as a function fn()
    Construct Signaturenew (args): InstanceType;Types object instantiation as constructor new Fn()
    | Property Signature | propName: Type; | Types object property access fn.propName |