What it is and why to use it
JavaScript functions are objects and can also carry properties. A call signature inside an interface describes how such an object is called, alongside its named metadata. This is useful for a configured formatter or callback that needs a readable label.
Common mistakes and limitations
A call signature uses a colon before its result type; it is not a method named call. Metadata is not automatically read-only, so mark it readonly if mutation should be rejected by checking. A type declaration alone does not attach properties.
Run this example
Use TypeScript 5.8 or later with strict checking and an ES2022 target. Save each complete example independently as example.ts, compile it, then run the generated JavaScript with a compatible Node.js installation. Compiler-only options below affect checking; they do not add runtime validation.
Terminal — compile and run
npx tsc example.ts --strict --target ES2022 --module commonjs
node example.jsSyntax
interface Formatter { (value: number): string; label: string }Examples
Callable Objects with Properties
Standalone TypeScript 5.8+ example; expected output is explained below.
interface Formatter { (value: number): string; label: string }
const format: Formatter = Object.assign(
(value: number) => value.toFixed(2), { label: "Price" }
);
console.log(format.label + ": " + format(3));- The call signature requires one number argument and a string result.
- Object.assign attaches label to the function object, satisfying the additional property.
- The same value is both called and inspected. The type describes that combined shape without creating a class.
- Expected output: Price: 3.00
Best practices
- A call signature uses a colon before its result type; it is not a method named call. Metadata is not automatically read-only, so mark it readonly if mutation should be rejected by checking. A type declaration alone does not attach properties.
- Keep external-input validation separate from compile-time type descriptions.
Runtime & versions
Compiled to JavaScript. Feature availability depends on the language and runtime version used by your project; consult the official reference below.
TypeScript Handbook