I have the following code:
const a = {
Top: {
fun: () => {
return {
sub: {
variable: getResponse().then((response) => response)
}
};
}
}
};
getResponse() returns a Promise.resolve().
I then try to get the value of variable in another file by doing the following:
let test = importedFile.a.Top.fun().sub.variable.then((resp) => resp);
But when I print out the value of test, instead of getting the value of variable
, I get
Promise {
<pending>,
domain:
Domain {
domain: null,
_events: { error: [Function: handleException] },
_eventsCount: 1,
_maxListeners: undefined,
members: [] } }
I am sure that in the actual const, variable is getting set to the correct value. I'm just unsure of how to access this separately.
My question is unique as the solution to the other question does not solve this problem.