Course contentsShow
← TypeScript
Lesson 241 of 1,7966. FunctionsFree lesson

Call Signatures

Understand call signatures in object types for typing functions with properties attached.

Call Signatures in TypeScript

What You'll Learn

You'll learn how to describe functions that carry their own properties using call signatures — a way to type functions that aren't just callable, but also have attached data.

The Core Idea

In JavaScript, functions are objects. That means they can have properties attached to them, just like any other object. For example:

function greet(name: string): string {
  return `Hello, ${name}`;
}

greet.version = "1.0.0";
greet.author = "Alice";

A call signature lets you describe this pattern in TypeScript: an object that is both callable and has properties. You write them inside an object type using a special syntax that looks like a function declaration, but without the function keyword.

Call Signature Syntax

Here's how you define a type for a callable object:

type GreetFunction = {
  (name: string): string;  // This is the call signature
  version: string;
  author: string;
};

Notice the call signature (name: string): string; — it describes what happens when you call the object. The other properties describe what the function object carries.

Now you can use it:

const greet: GreetFunction = function(name: string): string {
  return `Hello, ${name}`;
};

greet.version = "1.0.0";
greet.author = "Alice";

console.log(greet("Bob"));     // "Hello, Bob"
console.log(greet.version);    // "1.0.0"

When This Matters

This pattern appears in libraries where functions need configuration or metadata — think logging functions with a .level property, or API clients where the function itself makes a request but also exposes .defaults.

Key Takeaway: Call signatures let you type functions that have properties, describing both their callable behavior and their attached data in a single object type.