Type-Checking JavaScript
/**
* @typedef {Object} Article
* @property {number} price
* @property {number} vat
* @property {string} string
* @property {boolean=} sold
*/
/**
* Now we can use Article as a proper type
* @param {[Article]} articles
*/
function totalAmount(articles) {
return articles.reduce((total, article) => {
return total + addVAT(article);
}, 0);
}