So I have the following code using axios
library:
const BTrustURLResponse: Response = await axios.get(`${process.env.BTRUST_URL}/flow/${process.env.BTRUST_FLOWID}/link?callback_url=${callback_url}`, {
headers: {
'Authorization': `Bearer ${process.env.BTRUST_API_KEY}`,
},
});
I know for sure (console.log(Object.keys(BTrustURLResponse))
) that the returned object has property data
. But as default Response
interface does not include data
property.
How can I fix it?
I've tried the following:
And this is the file itself:
declare global {
export interface Response {
data?: string,
}
}
- Then I did in
tsconfig.json
the following:"typeRoots": ["@types", "./node_modules/@types"]
But still I could not use .data
with the Response
.