Today we're happy to announce the release of official TypeScript type definitions for Google Publisher Tags (GPT)!

Why TypeScript?

According to a recent State of JS developer survey, nearly 70% of developers regularly use TypeScript in some capacity, up from 60% the year before. As this segment of the community continues to grow, we are committed to providing the best experience possible for those working with TypeScript and GPT. We believe this is important not just because TypeScript is popular, but because it helps developers validate the correctness of their code and provides a number of quality of life improvements that make working with GPT more delightful.

How we got here

Until now, a number of community-led projects such as @types/doubleclick-gpt and @types/googletag have provided unofficial GPT type definitions. While these projects have done a great job of making our API more accessible to TypeScript developers, manually curated type definitions inevitably lag behind changes made to GPT, leading to those definitions sometimes being out of date. To address this, we've updated our release process to automatically generate type definitions from internal source code and sync changes to our own GitHub repository and the DefinitelyTyped project. This ensures that our official definitions are always up to date with the most recently released versions of GPT.

Try it and let us know what you think

For users new to TypeScript, we've published a TypeScript and Google Publisher Tags guide that covers the basics and provides a demo of the new type definitions in action. For those already familiar who want to try the new definitions right away, they can be installed via NPM by running:

npm install --save-dev @types/google-publisher-tag


If you'd like to make a suggestion, report a bug, or leave any other feedback about this new offering, feel free to open an issue on our GitHub issue tracker.

How does the change apply to existing versions?

Effective today, Android v19 and iOS v7 versions are considered deprecated. In accordance with the schedule above, we plan to sunset Android v19 and iOS v7 versions in Q2 2023 following the releases of Android v22 and iOS v9 planned for Q1 2023. We will provide more specific sunset dates following the releases of Android v22 and iOS v9.

The graphic below helps visualize the state of existing Google Mobile Ads SDK versions for Android and iOS with today’s announcement.

Note: Versions 6.x.x and below for both Android and iOS have been sunset since 2018.

Exceptions

The deprecation schedule provides a framework for predictable lifetimes for an SDK version. However, there may be exceptions in the future. This schedule does not preclude us from sunsetting an SDK version at an earlier date, but we are committed to providing proactive communication with ample lead time for any future changes.

Next Steps

  1. Refer to the deprecation developer pages (Android | iOS) for the latest updates to the deprecation schedule. If you are on a deprecated version, see the Android migration guide or iOS migration guide for more information on how to update.
  2. Stay tuned for future updates to this blog, where more specific sunset dates will be communicated once new major Google Mobile Ads SDK versions are released.

If you have any questions about this announcement, please reach out to us on the Google Mobile Ads SDK Developer Forum.