concept type definition file in category angular

This is an excerpt from Manning's book Angular Development with Typescript, Second Edition.
Angular Router offers you observable properties in various classes. Is there an easy way to find them? The fastest way is to open the type definition file (see appendix B) for the class you’re interested in. Usually, IDEs offer you an option on the context (right-click) menu to go to the declaration of the selected class. Let’s use the ActivatedRoute class as an example and take a look at its declaration. It’s located in the router_state.d.ts file (we removed some content for brevity), as shown in the following listing.
The purpose of type definition files is to describe an API of a JavaScript library (or a script) providing types offered by this API. Say you want to use the popular JavaScript library Lodash in your Typescript code. If you have a Lodash type definition file in your project, the TypeScript static analyzer will know what types are expected by Lodash functions, and if you provide wrong types, you’ll get a compile-time error. Also, an IDE will offer autocomplete for the Lodash API.
By reading this definition, you (and the tsc compiler) know that this function can be invoked with one mandatory module parameter of type Type<M> and an optional array of compiler options. If application_ref.d.ts wasn’t a part of your project, TypeScript’s compiler would let you invoke the bootstrapModule function with a wrong parameter type, or without any parameters at all, which would result in a runtime error. But application_ref.d.ts is present, so TypeScript would generate a compile-time error reading “Supplied parameters do not match any signature of call target.” Type definition files also allow IDEs to show context-sensitive help when you’re writing code that invokes Angular functions or assigns values to object properties.
Specifying type definition files explicitly
To explicitly specify the type definition files located in the node_modules/@types directory, add the required files to the types section of tsconfig.json. Here’s an example:
"compilerOptions": { ... "types": ["es6-shim", "jasmine"], }In the past, we used special type definition managers tsd and Typings to install type definition files, but these managers are no longer needed. If your application uses other third-party JavaScript libraries, install their type definition files with npm to get compiler help and autocomplete in your IDE.