Why Use TypeScript?
In this lesson, we will see why one should consider using TypeScript in the first place. Let's begin!
We'll cover the following...
TypeScript provides many advantages for client-side developers. In this section, we will see many reasons you should use TypeScript.
TypeScript is not a completely new language. It is easier to pick up than some other alternatives since you can jump in with a JavaScript background and learn how to use the enhancement that TypeScript offers.
TypeScript is fast
Even if it has a compilation phase called “transpile,” it scales well with large codebases. You do not need to transpile every TypeScript file, since you can transpile a subset, like a file that has changed, or a directory. Being fast is crucial to the development flow. JavaScript has the advantage of being a runtime language and having a middle ground which is not a burden; it reduces the friction for people who want fast results in their browser. Similarly, automatic build on files change by a third party is available. The combination of TypeScript and other tools transform the experience into a quasi-seamless flow.
Transpiling allows you to generate ECMAScript…
…and TypeScript lets you specify which version is desired. The degree of detail means that you can generate JavaScript compatible with a very old browser or a new one, or with a feature that is planned to be available but not yet there. The output is a different JavaScript, depending on which target. This feature allows you to use modern TypeScript syntax; for example, async
is not fully supported by all browsers today, but TypeScript can target a version of ECMAScript that ...