Solved! Go to Solution.
Dynamic typing is one of the core concepts of JavaScript, which is powerful. Which one is better is arguable. But since JavaScript has dynamic typing nature, I'm not sure if adding a typescript upon it makes a lot of sense. I haven't compared the performance of typescript. But JavaScript normally has the reputation of "SLOW", you may not want to sacrifice more just for type safe. Once you get used to dynamic typing, you will find it's a very flexible and interesting feature.
// JavaScript: var thing = "a b c"; thing = 5; // Totally fine! var pieces = thing.split(" "); // Run time error: thing.split is not function
// TypeScript: var thing = "a b c"; thing = 5; // Compile time error: Type of "thing" is string, not number! var pieces = thing.split(" ");
TypeScript also supports what are known as "definition files". These are a lot like C headers. They define objects and types and method signatures, often belonging to libraries outside of your control. We use them when coding against dojo, the ArcGIS JavaScript API, and jQuery. They are simply code contracts. They tell us what's available, and how to create objects and call methods upon them without making mistakes and wasting time.