VSCode JSDoc of Promise

An instance of installing type definitions for the bcrypt library is @types/bcrypt. Avoiding incorrect types is necessary. In our JS example, we provided two arguments for the getdiff function. If you’re unfamiliar with JsDoc and VSCode, JsDoc is a JavaScript API documentation generator, and VSCode is Microsoft’s lightweight version of its renowned IDE, Visual Studio.


const promise = new Promise((resolve) => {

promise” variable
is currently categorized under


instead of


. Is there a way to make the resolve() function automatically recognize the input without manually specifying the type in the docblock? The object being passed into resolve() is complex, so it would be easier if the documentation was generated automatically.


If you are lacking assistance with the promise, I believe it is not necessary to discover the contents of resolve automatically.

One can generate custom types and provide them to Promise as follows :D.

 * @typedef {{name: "John", lastName: "Doe", age: "infinite"}} MyComplicatedObject
 * @type {Promise}
const promise = new Promise(resolve => {
    resolve({ name: 'John', lastName: 'Doe', age: 'infinite' });

Avoid retyping


by importing it from other files using jsdoc annotations, just as you would import any other file in js.

To identify the resolution that a helper for the promise will provide, you can use automatic detection.

 * @template resT
 * @param {resT} whatToResolve
 * @returns {Promise}
const myPromise = whatToResolve => {
    return new Promise(resolve => {

Frequently Asked Questions