Using Jsdoc to get type checking
To increase the power of javascript without having to add yet another layer of abstraction, WinnetouJs adopted jsdoc. Jsdoc in addition to adding useful comments in the code, can also provide rich IntelliSense.
To lean more about Visual Studio Code, see this.
To lean JsDoc, see this.
createCard.js
/**
*
* @param {string} name User name of client
* @param {string} phone The phone number
* @param {string} addr The current address
* @param {Number} age The age of client
*/
export function createCard(name, phone, addr, age) {
let color = age >= 18 ? "blue" : "red";
card({
color_class: color,
profileName: name,
age,
phone,
addr,
}).create("#app");
}