The implementation of large JavaScript code bases in modern, rich client web applications has always pushed more in the direction of preventing hard-to- find bugs, with exhaustive checking at compile time. TypeScript meets this requirement by transforming JavaScript into a strongly typed language; that is, into a language that requires declarations and type specifications for all variables and properties. In fact, strong typing allows compile-time type checking that prevents the misuse of variables and functions while variable declarations avoid the variable names misspelling that often causes these bugs in JavaScript.
This chapter explains the TypeScript manifest, how to install it and add it to your ASP.NET core projects, how to organize files and compile them to JavaScript, and the basics of TypeScript configuration. Then the chapter introduces the basics of types and variable declarations.
The following topics will be covered in this chapter:
- Installation on Windows and the TypeScript mission
- Adding TypeScript to ASP.NET core web projects and debugging it
- Basics of TypeScript configuration
- Simple types, enums, and basics of Union types
- Variable declarations, scoping, expressions, casting, and string interpolation