I want a strongly typed code. When I apply solutions from a similar question - Min/Max of dates in an array? - I get error
TS2345: Argument of type 'Date' is not assignable to parameter of type 'number'.
my code
const min: Date = Math.min(begin as Date, (end || defaultDate) as Date);
const max: Date = Math.max(begin as Date, (end || defaultDate) as Date);
begin as Date
part is underlined.
What's the correct way of finding min/max dates in Typescript?