Intl.ListFormat

Chances are, if you've worked with currency or date/time in javascript, you've used Intl. But did you know about the ListFormat option? I was trying to format an array of names into a proper English list like "Apple, Banana, and Cake" but the number of names could range from 1 to 3 or more. My first gut reaction was make my own function that checks all the conditions.
There's a much easier way though with Intl.ListFormat. I can just call a simple format function and I don't need to worry about the commas or the number of elements in the array:
const authors = [
{ id: 'a', name: 'Apple'},
{ id: 'b', name: 'Banana'},
{ id: 'c', name: 'Cake'}
];
const names = authors.map((author) => author.name);
const lf = new Intl.ListFormat('en');
lf.format(names)
// Apple, Banana, and CakeI did get a typescript error in my IDE though and found that the type definitions were just added. Unfortunately, it looks like it hadn't made it into the latest stable release yet so I had to add my declare my own Intl namespace with the ListFormat interfaces.