In my application I calculate the duration as follows:

doo.model.duration.value = (doo.model.end.value - doo.model.start.value)/3600000;

When I switch to the New TypeScript editor, the entire expression is underlined with a red wavy line. And the message "The left-hand side of an arithmetic operation must be of type ‘any’. ‘number’. …

The calculation in the form works correctly, but NaN is printed on the console.

If I create Duration as calculated field: end - start, the result is always 0001-01-01, for Formula output Date and -1 for Formula output Number.

Can you please advise me how to fix the calculation. Thank you