It is important to follow basarat's advice and utilize a regular function when implementing the IHttpService
interface.
For future guidance, here is an example of how to implement the interface and incorporate it in Angular:
interface IRequestConfig {}
interface IHttpPromise<T> {
then: (resolve?: (value: T) => any, reject?) => IHttpPromise<T>;
}
interface IHttpService {
<T>(config: IRequestConfig): IHttpPromise<T>;
}
function MyHttpService<T>(config: IRequestConfig): IHttpPromise<T>{
// Define the service's behavior in this function.
}
angular.module('MyModule')
.service('MyHttpService', MyHttpService)
.controller('MyController', function(MyHttpService: IHttpService){
MyHttpService<MyType>({
// Implement your `IRequestConfig` details here.
}).then(function(value){
// Access the properties of 'value' here.
});
});