I am currently learning JavaScript. I used to work with statically typed languages, so, naturally, I decided to start with TypeScript instead of JS. TypeScript is nice and it solves a lot of problems JS has, but this "weak typing" really triggers me.
It doesn't feel right that I can get away with this:
let int: number = 42
let str: string = "69"
console.log(int + str)
Is there a way to prevent this type of conversion from happening even in the TypeScript? I want to get an error when add string to an integer.
"the answer is "+42+"!"is perfectly valid and normal code, TypeScript won't complain about it.