Advanced Concepts
Generating TypeScript types
Generate types for iOS
ns typings iosThis will generate the following folder structure typings/ios/arm64
Generate types for Android
For Android run:
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):
ns typings android <package-name>For instance:
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:
ns typings linuxThis 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:
/// <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
- Reference the generated types in references.d.ts
- 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
- Android d.ts Generator, for advanced types generation for Android
- Previous
- Adding Linux Code


