With TypeScript, we can avoid these kinds of errors by introducing static types. This mechanism will save us a lot of time in debugging since any type error will prevent you from running your code. And also note that usage of types is completely optional; you will be able to use it discretely whenever you think it’s necessary in your code.
With TypeScript, you will also able to use the most recent ES6 and ES7 features with no need to worry about browser support. The compiler will automatically convert them to ES5, leaving you space to focus on more important parts of your project and saving time spent testing browser compatibility.