TypeScript — Is a programming language developed by Microsoft.

TypeScript — Is a typed superset of JavaScript, and includes its own compiler.

Type Definitions

  • There are two main ways to get declarations for a library: Bundled and DefinitelyTyped.
  • To be able to show errors and hints from other packages, the compiler relies on declaration files. A declaration file provides all the type information about a library. This enables us to use javascript libraries like those on npm in our project.
  • Bundled - The library bundles its own declaration file. To check if a library has bundled types, look for an index.d.ts file in the project. Some libraries will have it specified in their package.json under the typings or types field.
  • DefinitelyTyped is a huge repository of declarations for libraries that don’t bundle a declaration file. To get declaration file from DefinitelyTyped run: 'yarn add --dev @types/react' or 'npm i --save-dev @types/react'.

TypeScript — Structure map

Clickable & Draggable!

TypeScript — Related pages: