About #2
Wasn't so sure about typescript so I tested it to confirm that it worked.
But in Python3, the default arguments are evaluated at module time loading if I am not mistaken. The following will display roughly the same timestamp
from datetime import datetime
import time
print(datetime.utcnow())
def show_ts(d=datetime.utcnow()):
print(d)
time.sleep(5)
show_ts()
where as in TS, the 2nd one will be roughly 5s older: const now = Date.now();
console.log(now);
function logTs(d=Date.now()) {
console.log(d);
}
setTimeout(()=> {
logTs();
}, 5000);