Use TypeScript with the IMA SDK

TypeScript is a strongly typed, object-oriented programming language that compiles to JavaScript. TypeScript is a superset of JavaScript, and supports all of JavaScript's features plus optional static typing. TypeScript tooling can help detect and prevent bugs that you might not notice in plain JavaScript.

Get started

DefinitelyTyped is an open source project that maintains a repository of type declaration files for many packages, including the IMA SDK library. You can install the IMA types with npm from the @types/google-interactive-media-ads package.

npm install --save-dev @types/google-interactive-media-ads

After installation, you have access to all of the types exposed by the google.ima object in your own code. You can also take advantage of code completion and content assist for IMA methods and properties in source code editors that have those features, for example, Visual Studio Code.