Próbuję stworzyć zegar w TS, jednak pojawia się błąd Expression expected.ts(1109)
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Time</title>
</head>
<body>
<script type="text/javascript" src="watch.ts"></script>
</body>
</html>
window.addEventListener("load", counting)
function counting() {
let dzis = new Date()
let dzien = dzis.getDate()
let miesiac = dzis.getMonth() + 1
let rok = dzis.getFullYear()
let godzina = dzis.getHours()
if (godzina < 10) = "0" + godzina
let minuta = dzis.getMinutes()
if (minuta < 10) = "0" + minuta
let sekunda = dzis.getSeconds()
if (sekunda < 10) = "0" + sekunda
document.title = dzien + "/" + miesiac + "/" + rok + " | " + godzina + ":" + minuta + ":" + sekunda
setTimeout("counting()", 1000)
}
Bazuje na tym
https://stackoverflow.com/questions/47897118/how-to-make-clock-in-typescript
https://www.spguides.com/typescript-date/