ใช้ TypeScript กับ IMA SDK
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
ในโค้ดของคุณเอง นอกจากนี้ คุณยังใช้ประโยชน์จากการเติมโค้ดอัตโนมัติและความช่วยเหลือด้านเนื้อหาสําหรับเมธอดและพร็อพเพอร์ตี้ IMA ในเครื่องมือแก้ไขซอร์สโค้ดที่มีฟีเจอร์ดังกล่าว เช่น Visual Studio Code
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 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."]]],[]]