Reader small image

You're reading from  Getting Started with Angular - Second edition - Second Edition

Product typeBook
Published inFeb 2017
Reading LevelIntermediate
PublisherPackt
ISBN-139781787125278
Edition2nd Edition
Languages
Tools
Right arrow
Author (1)
Minko Gechev
Minko Gechev
author image
Minko Gechev

Minko Gechev is a software engineer who strongly believes in open source software. He has developed numerous such projects including codelyzer, the AngularJS style guide, aspect.js and many others, and is one of the coauthors of the official Angular style guide.
Read more about Minko Gechev

Right arrow

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 to create ambient type definitions for all JavaScript libraries and frameworks we use. The community and/or the authors of these libraries have already published such definitions online; the biggest repository resides at https://github.com/DefinitelyTyped...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Getting Started with Angular - Second edition - Second Edition
Published in: Feb 2017Publisher: PacktISBN-13: 9781787125278

Author (1)

author image
Minko Gechev

Minko Gechev is a software engineer who strongly believes in open source software. He has developed numerous such projects including codelyzer, the AngularJS style guide, aspect.js and many others, and is one of the coauthors of the official Angular style guide.
Read more about Minko Gechev