Evaluation of null values and type checks - why is this an error?

Why is this an error:

if (workoutStartTime != null && workoutStartDistance != null) {
var elapsedTime = info.timerTime != null ? (info.timerTime - workoutStartTime)/1000.0 : 0.0;
[...]
}

I get the following error message:
Attempting to perform operation 'sub' with invalid types 'Null' and '$.Toybox.Lang.Number'.

workoutStartTime is not null when the minus operation is executed

info.timerTime is not null as per the initial test in this expression, otherwise we would not execute the minus operation.

I have more examples where the operation x != null ? true-statement : false-statement does not seem to understand that x is not null if the true-statement is executed.

I am using project.typecheck = 2