![](https://csdnimg.cn/release/download_crawler_static/10743317/bg13.jpg)
From the Visual Studio 2013 Spring Update (Update 2), TypeScript is a first-class language in Visual
Studio. Prior to this, an additional extension needed to be installed. Although the examples in this book are
shown in Visual Studio, you can use any of the development tools that were listed above. In particular, Visual
Studio Code is a free cross-platform editor with native TypeScript support - so you can write your TypeScript
code on any machine you have on hand, regardless of the operating system.
It is also worth downloading and installing Node (which is required to follow many of the examples) as
it will allow you to access the Node Package Manager and the thousands of modules and utilities available
through it. For example, you can use task runners such as Grunt and Gulp to watch your TypeScript files and
compile them automatically each time you change them if your development tools don't do this for you.
Node is free and can be downloaded for multiple platforms from the official Node website.
https://nodejs.org/
To avoid being greatly sidetracked, I have avoided using any task runners to perform additional
operations outside of Visual Studio, but once you have mastered TypeScript you will almost certainly want
to add a task runner, such as Gulp or Grunt, to your development workflow. I have referenced some web
dependencies from the node_modules folder in the examples in this book; but on a real-world project I
would use a task runner to lift and shift the website dependencies into a different folder that I would be
happy to deploy to a web server. The node_modules folder often contains a great deal of files that I would not
deploy to a web server.
TypeScript Alternatives
TypeScript is not the only alternative to writing to plain JavaScript.
The strongest TypeScript alternative is Babel, a compiler that exposes the latest ECMAScript features
with plugins for down-level compilation and polyfills to make your program work in current browsers. The
aim of the Babel project is to make the latest features available much sooner than they otherwise would be,
but Babel doesn't introduce compile-time type checking. Babel also features in many TypeScript workflows,
where Babel is executed after the TypeScript compiler, rather than using TypeScript to perform the down-
level compilation. You can read about Babel on the official website:
https://babeljs.io/
For a number of years, CoffeeScript was a popular alternative with a terse syntax that compiles to
sensible JavaScript code. CoffeeScript doesn't offer many of the additional features that TypeScript offers,
such as static type checking. It is also a very different language to JavaScript, which means you need to
translate snippets of code you find online into CoffeeScript to use them. In 2017, however, CoffeeScript
reached the top three "most dreaded languages" in the Stack Overflow developer survey (next to VBA, and
Visual Basic 6). In the same survey, TypeScript landed in the top three most loved languages. You can find
out more about CoffeeScript on the official website:
http://coffeescript.org/
Another alternative is Google's Dart language. Dart has much in common with TypeScript. It is class-
based, object oriented, and offers optional types that can be checked by a static checker. Dart was originally
conceived as a replacement for JavaScript, and was only intended to be compiled to JavaScript to provide
wide support in the short term while native support for Dart was added to browsers.
It seems unlikely at this stage that Dart will get the kind of browser support that JavaScript has won,
so the compile-to-JavaScript mechanism will likely remain core to Dart's future in the web browser. The
decision by Google to adopt TypeScript for the Angular project may be indicative of their commitment to
Dart, although it is still described as a long-term project. You can read about Dart on the official website for
the language:
https://www.dartlang.org/