In general, I write on Angular 1.x using Typescript .
The essence of the question is where and how to properly describe the data type (classes).
There is a valid typescript @types , there they describe types in d.ts files.
You can also describe the interfaces next to the class and export.
How would it all be reasonable to combine so as not to pile up a garbage.
Maybe I still do not understand something.

Example 1, use the interface like this

 interface ICommentController { add: (...args) => any; vote: (...args) => any; } class CommentController implements ICommentController { vote: (...args) => any; add: (...args) => any; } 

Example 2, render interface in d.ts

 declare module application { namespace comment { interface ICommentController { add: (...args) => any; vote: (...args) => any; } } } 

and use like this

 class CommentController implements application.comment.ICommentController {} 

I understand that in d.ts describe types, but the essence is almost the same? the same interface, only in 1 cases if you use the interface you need to import it, and in 2 you don’t need it

    1 answer 1

    Declaration files are created in order to deliver them along with the compiled .js files for use in another project from TypeScript code. If you plan to use these types only within your project, there is no need to declare them in separate d.ts files.