In JavaScript, functions are objects. In TypeScript, an interface can include a call signature and extra properties. This lets you create a callable object with fields.
You will build a function that returns a callable formatter with a label property.
interface ToText {
(n: number): string;
label: string;
}Build a factory that returns a callable formatter with a label.
interface Formatter { (n: number): string; label: string }.makeFormatter(prefix: string): Formatter."<prefix><n>" and also have label === prefix.