I have a function f that returns a Promise. The returned Promise either resolve({name: String, data: Object}) or reject(Error).
I've tried the following syntax(as mentioned in an issue in JSDoc) in VSCode, but it doesn't work:
/**
* @promise fPromise
* @reject {Error}
* @fulfill {Object} project
* @fulfill {Object} project.data
* @fulfill {String} project.name
* @returns fPromise
*/
I think your best bet is to wrap your fulfill response into a custom object:
/**
* @promise fPromise
* @reject {Error}
* @fulfill {Project}
* @returns {Promise.<Project>}
*/
function renderResults(data) {
return new Promise((resolve, reject) => {
resolve(new Project())
})
}
renderResults()
function Project() {
this.data = "data";
this.name = "project phoenix"
this.location = {
city: 'seattle',
state: 'wa'
}
}
This will show in VS Code like this:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With