Advanced Concepts
Generating TypeScript types
Generate types for iOS β
bash
nstypingsios
This will generate the following folder structure typings/ios/arm64
Generate types for Android β
For Android run:
bash
nstypingsandroid--jar<pathtoajar>
# or
nstypingsandroid--aar<pathtoanaar>
You can also generate typings for an Android package (Maven):
bash
nstypingsandroid<package-name>
For instance:
bash
nstypingsandroid"com.google.android.gms:play-services-tasks"
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 and Android Marshalling pages.
Additional Resources β
- Android d.ts Generator, for advanced types generation for Android
- Previous
- Adding ObjectiveC/Swift Code