This chapter covers:
- How to enjoy the TypeScript benefits when working with a JavaScript library
- The role of type definition files
- How to upgrade an existing JavaScript app to TypeScript
In this chapter, we’ll show how you can benefit from such TypeScript features as getting compilation errors and auto-complete even while using third-party libraries written in JavaScript. We’ll start by explaining the role of type definition files, and then will discuss a concrete use case where an app written in TypeScript uses a JavaScript library. Finally, we’ll go over the things to consider for implementing the gradual upgrade of your app from JavaScript to TypeScript.
The JavaScript language was created in 1995, and gazillions lines of code were written in this language since then. Developers from around the globe have released thousands of libraries written in JavaScript, and the chances are that your TypeScript app could also benefit from using one of these libraries.