Using nrlint 1.0.2 the following code shows the error that the left hand side of an arithmetic operation must of type 'any', 'Number' ...
The function does run ok (it subtracts the millisecond values).
const d1 = new Date()
const d2 = new Date(d1.getTime() + 1000)
msg.payload = d2 - d1
return msg;