2023-09-09 12:22:26 +01:00
|
|
|
<script src="runtime-checker.js"></script>
|
2023-09-09 13:20:03 +01:00
|
|
|
|
2023-09-09 12:22:26 +01:00
|
|
|
<script>
|
2023-09-09 12:46:41 +01:00
|
|
|
const sum = typedFunction((a_number, b_number) => {
|
2023-09-09 12:22:26 +01:00
|
|
|
return a + b;
|
2023-09-09 12:46:41 +01:00
|
|
|
});
|
2023-09-09 12:22:26 +01:00
|
|
|
|
2023-09-09 12:46:41 +01:00
|
|
|
const result = sum(1, 2);
|
2023-09-09 12:22:26 +01:00
|
|
|
console.log(result); // 3
|
|
|
|
|
|
|
|
sum("1", 2); // Error
|
2023-09-09 13:20:03 +01:00
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
typedVar("test", 5);
|
|
|
|
|
|
|
|
test = 6;
|
|
|
|
|
|
|
|
test = "a string"; // Error
|
2023-09-09 12:22:26 +01:00
|
|
|
</script>
|
|
|
|
|