What are the advantages of creating an interface for a angular service vs exporting the service class and using that for type information instead?
Example:
class Dashboard {
constructor(ui: IUiService){}
}
vs
class Dashboard {
constructor(ui: UiService){}
}
Is there a performance benefit? What happens if I just use the service class for type information?
It seems to be additional work with no benefit unless you have different implementations of a service that can be used but have a common base. Or when you want to mock services in unit tests instead of using them directly.
Edit: I'm interested to know what the typescript compiler will do for imports that are just used for type info. Will it invoke a constructor or add to the require statement (ES6)? Would it new up an instance of the class?