Interface:
interface Digit { constructor(number: number, scale: number): void; }
Announcement:
declare class Digit { public constructor(number: number, scale: number): void; }
You can choose from. But the interface can be said to be a simplified type of object, but it can be inherited.
The difference between the interface and declare on the English-language SO is also perfectly described.
UPD. For example, you can declare a class type (it does not cause fatal errors for me if the name of the interface or declare is the same as for some class)
my.d.ts
declare class Digit { public constructor (number: number, scale: number); public testFunc (a: string): number; }
fullfile.ts
/// <reference path="../typings/my.d.ts" /> class Digit implements Digit { constructor (number: number, scale: number) { console.log(`CONSTRUCTOR ${number} ${scale}`); } testFunc (a: string): number { return 54; } } const hello = new Digit(2, 4).testFunc("5");
Those. You declare what methods you will use, so first always make the narrative part of a class / object / function.
Those. here it will swear if you do not declare the testFunc method in your class, and it will be in the declaration.
Or, if you declare something, for example, you can say that the variable will be of this type, then you need to write:
const myValue: Digit = ...