Reputation: 32758
I am using this function:
function httpGetQuestion(q) {
return $http({
url: '/api/Question/GetByUId/' + q.questionUId + '/fetch',
method: "GET"
})
}
and also this:
test.getQuestion = function (q) {
getQuestion(q);
}
the parameter q is of type IQuestion
How can I create an interface that represents these function? Note that the getQuestion function does not return anything but the httpGetQuestion returns a promise.
Upvotes: 1
Views: 967
Reputation: 123861
This could look like this:
module myModule
{
export interface IQuestion { ... }
export interface IMyService
{
httpGetQuestion(): ng.IHttpPromise<IQuestion>
getQuestion() : void
}
}
The ng.IHttpPromise<T>
is a return type representing the $http
promise
Upvotes: 1