IMA SDK で TypeScript を使用する
TypeScript は、JavaScript にコンパイルされる厳密に型指定されたオブジェクト指向プログラミング言語です。TypeScript は JavaScript のスーパーセットであり、JavaScript のすべての機能と、オプションの静的型付けをサポートしています。TypeScript ツールを使用すると、単純な JavaScript では気付かないバグを検出して防止できます。
使ってみる
DefinitelyTyped は、IMA SDK ライブラリを含む多くのパッケージの型宣言ファイルのリポジトリを維持するオープンソース プロジェクトです。IMA タイプは、npm を使用して @types/google_interactive_media_ads_types パッケージからインストールできます。
npm install --save-dev @types/google_interactive_media_ads_types
インストールすると、独自のコード内で google.ima
オブジェクトによって公開されるすべてのタイプにアクセスできるようになります。Visual Studio Code などの、IMA メソッドとプロパティのコード補完とコンテンツ補助機能を備えたソースコード エディタを使用することもできます。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-03-07 UTC。
[null,null,["最終更新日 2025-03-07 UTC。"],[[["TypeScript is a strongly typed, object-oriented programming language that compiles to JavaScript and supports all of JavaScript's features plus optional static typing."],["TypeScript tooling helps in detecting and preventing bugs that might go unnoticed in plain JavaScript."],["DefinitelyTyped is an open-source project containing type declaration files for various packages, including the IMA SDK library."],["Installing the IMA types using npm from the @types/google-interactive-media-ads package gives you access to all types exposed by the google.ima object."],["After installation, source code editors with features like code completion and content assist can be used to take full advantage of IMA methods and properties."]]],[]]