TypeScript Allows You To Define Interfaces For Functions
[!INFO]-
topic: π¦ TypeScript
links:source: TypeScript course by the native web
tags: #permanent-noteΒ #published
Last Modified:
=dateformat(this.file.mtime, "MMM. dd, yyyy - HH:mm")
In TypeScript you can define interfaces for more than just objects. You can also define interfaces for functions. You can even add properties to those functions.
interface Add {
(left: number, right: number): number;
description: string;
}
const add: Add = function (left: number, right: number): number {
return left + right;
};
add.description = 'Calculates the sum of two numbers.';