Back to Blog Home
← all posts

Where did my Types go with 8.2?

March 28, 2022 — by Alex Ziskind

When upgrading to @nativescript/types 8.2, TypeScript declarations for platform API types, you might notice a few TypeScript compilation errors related to various iOS types. In this post I’ll show you the reasoning behind this as well as how to get those types working again.


If you are having this issue and just want the solution, jump down to the end. If you'd like an explanation please continue reading.

Note: You can use @nativescript/types, a single convenient package, which includes all NativeScript platform TypeScript declarations or you can use individual platform types packages via @nativescript/types-ios or @nativescript/types-android (both of which are included with @nativescript/types as a convenience).


iOS and Android platforms are both actively developed and growing constantly. As a result of this growth the public APIs offered by both are also increasing all the time. It's these public APIs that we also love to use directly in our NativeScript applications. If you're using TypeScript, NativeScript provides native platform API types for you to use right out of the box so you can leverage native APIs in application code or plugins.

The Problem

As the number of native APIs grow so does the number of TypeScript declarations available to use in NativeScript. While having more types declared doesn’t affect runtime performance at all, it can affect developer experience and build time since the TypeScript language service in your IDE will index these types as well as load them during compilation.

NativeScript's Solution

Are all native API’s necessary for every app development?

The answer to that is most unequivocally "no".

There are tons of less commonly used APIs that can safely be removed from type checking and have zero effect on the majority of developments.

How to get your Types back

A good example of that is one that I just ran into myself, and it’s the App Tracking Transparency API in iOS. The app I’m working on has references to classes like ATTrackingManager, and prior to upgrading to 8.2, my TypeScript code was compiling just fine. However, once I updated my typings package to "@nativescript/types": "~8.2.0",, those TypeScript types stopped working and my editor (VS Code) complained with big angry red underlines.


I also could no longer build my project because of TypeScript errors.

The solution to this problem is simple and should help educate you on other use cases you can empower yourself with this understanding.

Step One: Identify the Missing Types

You most likely already know what they are since you probably received a TypeScript build error. In my case I needed to find a few classes in the App Tracking Transparency API including ATTrackingManager.

Step Two: Find the Missing Typings

Search your node_modules/@nativescript/types-ios or node_modules/@nativescript/types-android folder.


In my case I found all the App Tracking Transparency types that I needed in one declaration file.


Step Three: Reference Typing File(s)

Add a new reference to that path to your projects references.d.ts file. Here’s what mine looked like after I was done:


Step Four: Clean and Build 😃

ns clean

You now know how to harness the power of NativeScript under all sorts of diverse TypeScript project needs.