NativeScript 9.1 Released → V8 14.9, Vite 8 HMR, built for rapid agentic visual iteration
Dig in

Generate types for iOS ​

bash
ns typings ios

This will generate the following folder structure typings/ios/arm64

Generate types for Android ​

For Android run:

bash
ns typings android --jar <path to a jar>
# or
ns typings android --aar <path to an aar>

You can also generate typings for an Android package (Maven):

bash
ns typings android <package-name>

For instance:

bash
ns typings android "com.google.android.gms:play-services-tasks"

Generate types for Linux ​

Experimental

The Linux platform is experimental. See Developing for Linux.

On a Linux machine, run:

bash
ns typings linux

This writes the typings for the Linux SDK (GLib, GTK, Pango, Cairo, X11, ...) and for the app's and plugins' native code to typings/linux/. Once the folder exists, later builds keep the typings of the native code up to date. Reference them in references.d.ts:

ts
/// <reference path="./typings/linux/index.d.ts" />

index.d.ts includes the typings of GLib, GTK, Pango, Cairo, GdkPixbuf, Graphene, HarfBuzz, X11 and Fontconfig. The typings of the other SDK modules (libc, ICU, EGL, OpenGL ES, libxml2, zlib and libuuid) are in typings/linux/sdk/ too, but aren't included by default, because libc and ICU conflict with the typings of other platforms. Reference the ones you need separately, for example /// <reference path="./typings/linux/sdk/c!libc.d.ts" />.

Custom code ​

  1. Reference the generated types in references.d.ts
  2. You can now code against the platform native APIs (strongly typed). For various examples on how to interact with native APIs in JavaScript/TypeScript, visit the Subclassing, iOS Marshalling, Android Marshalling and Linux Marshalling pages.

Additional Resources ​