I checked the type of the duration variable and it is in fact Time.Duration.
If duration is null or a number, the function works as expected.
I have tested it only in the simulator on FR645 device.
using Toybox.ActivityMonitor;
using Toybox.Time;
var duration = new Time.Duration(60); // seconds
ActivityMonitor.getHeartRateHistory(duration, false);