O'Reilly logo

Getting Started with Angular - Second Edition by Minko Gechev

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using ambient type definitions

Although static typing is amazing, most of the frontend libraries we use are built with JavaScript, which is dynamically typed. Since we'd want to use TypeScript in Angular, not having type definitions in the code that uses external JavaScript libraries is a big issue; it prevents us from taking advantage of the compile-time type checking.

TypeScript was built keeping these points in mind. In order to allow the TypeScript compiler to take care of what it does best, we can use the so-called ambient type definitions. They allow us to provide external type definitions of the existing JavaScript libraries. This way, they provide hints to the compiler.

Using predefined ambient type definitions

Fortunately, we don't have ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required