I encountered this code snippet:
import * as Promise from 'bluebird';
import {Response} from '../commonInterfaces/httpService';
getCall(url: string, accessToken: string, extraHeaders: object): Promise<Response> {
let headers = this.getHeaders(accessToken, extraHeaders);
return new Promise((resolve, reject) => {
request({
url: url,
method: "GET",
withCredentials: false,
json: true,
headers: headers
}, (err: Error, response: Response) => {
if (err) {
reject(err)
} else {
resolve(response)
}
});
});
}
and Response is defined as an interface:
interface Response {statusCode: number, body: object}
This leads to the error message:
[ts]
Type 'Bluebird<{}>' is not assignable to type 'Bluebird<Response>'.
Type '{}' is not assignable to type 'Response'.
Property 'statusCode' is missing in type '{}'.
What could possibly be causing this issue?