I am accessing a property of an object returned from a resolved promise.
return new Promise((resolve) => {
// Get result
resolve(result)
}).then(r => console.log(r.id))
Typescript compiles the code and the code works but my IDE is complaining about r.id
[ts] Property 'id' does not exist on type '{}'.
What is the 'TypeScript' method of dealing with this? This question seems to have the same issue but I cannot understand the given solutions. This answer talks about using interfaces but im not sure how I would apply that to the then()
function of a Promise