I have an Angular 6 application, using Visual Studio Code as my IDE, and I installed and imported a JavaScript library I made so I can use it in my angular app. My JS library has functions and classes, all with standard JavaScript comments, such as:
/**
* Send a custom greeting to a person.
* @param {string} name - Name of person to greet
* @return {string} Return a custom greeting
*/
export function greetings(name) {
return 'Hello, ' + name;
}
When I attempt to use this function in my Angular app, VSCode's intellisense says this:
greetings(name: string): string
I expected it to show the actual comment for the function, but that wasn't the case. Is there a way, through some setting in a JSON file, through the library, through VSCode, etc that I can display to the user the comment I have for the functions of my library?
NOTE: for this particular case, my library is exporting functions, and when I use them in my angular project, I import them directly like:
import { greetings } from 'my-library';
Thanks
Automatic Type Acquisition (ATA) pulls down the npm Type Declaration files (*.d.ts) for the npm modules referenced in the package.json.
As you hover your mouse over text in the file, you'll see that VS Code gives you information about key items in your source code. Items such as variables, classes and Angular decorators are a few examples where you'll be presented with this information.
Check this link: https://code.visualstudio.com/docs/nodejs/angular-tutorial