Hello, I have a problem with the following javascript code:
/**
* Get the most recent date from the given array.
*
* @param { Date[] } dates
* @returns { Date }
*/
function getMostRecentDate(dates)
{
return dates.reduce(
(mostRecent, current) => mostRecent < current ? current : mostRecent,
new Date(1970, 1, 1, 0, 0, 0)
);
}
This triggers a javascript:S7766 on the ternary use, suggesting to replace it with Math.max
Unfortunately, there are no overloads for Math.max that accept a Date argument which in turns leads to type errors, preventing me from releasing this code.
This happens with Developer Edition v2026.1.2 (121356)
For now, I have “accepted” it as safe, but it would be nice if this was not coming up in the first place.