How it works...

The TypeScript compiler is a JavaScript cross-compiler that will convert TypeScript files with *.ts to a normal *.js version. This allows us to take advantage of new language features, such as strict type checking, variable scoping, and many other enhancements, while still reliably ending up with code that will run in any Node.js environment.

Since the TypeScript language is a superset language of ES6 JavaScript, we can mix the two freely in our project as necessary. While it would be optimal to convert our entire Node.js project using TypeScript, sometimes large project code bases or time limitations make it more convenient to convert portions of a project to TypeScript over time. This works wonderfully in TypeScript through the use of the allowJs flag in the TypeScript compiler. It allows us to import and use normal JavaScript files in conjunction with our new TypeScript files without any issues. This way, we can convert files to TypeScript, as we have the opportunity and, now, a prerequisite to use TypeScript in our project.

The tsconfig.json file is a configuration file that tells TypeScript where the root of a TypeScript project is and how to interact with its contents. This includes how to find and load files--where types definitions are stored, how to compile files, and where to put the generated result. There are quite a few ways to customize and configure your TypeScript environment, including enabling special language features and optimizations to your liking.

If you are interested in learning more about the available configuration options, you can check out the following official documentation:
http://www.typescriptlang.org/docs/handbook/tsconfig-json.html
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.46.58