3
votes

This great article NativeScript: iOS Tip - See the Metadata & .d.ts files generated for your Cocoapod Plugin explains how to generate Typescript .d.ts files for Cocoapods.

I quite frequently use tns-core-modules/android17.d.ts as a reference when developing plugins for Android.

I've read all the docs on the android-runtime and could not find anything in regards to generating Typescript .d.ts for imported Android libraries.

Is there a way to run TNS_TYPESCRIPT_DECLARATIONS_PATH="$(pwd)/tsc" tns build android for Android which will generate Typescript .d.ts files?

Or maybe a way to generate another massive android17.d.ts file which would include the imported libraries through gradle?

1

1 Answers

1
votes

The answer is to download and use: https://github.com/NativeScript/android-dts-generator

The android-dts-generator will generate the TS metadata for any .jar file you have.
Command line would be: java -jar build/libs/dts-generator.jar -input <jar1> <jar2> ...

If you have an .aar then you will need to extract the classes.jar from inside the .aar out, and then run the dts generator on the jar file you extracted.