mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +08:00

Adding android typings for API levels from 17 to 27 BREAKING CHANGES: There is no longer added `I` prefix in the names of the interfaces. For example `android.view.IMenuItem` is now `android.view.MenuItem`. This matches the original name of the interface in the android framework.
This plugin contains type information about the native platforms as exposed by the NativeScript framework.
Offically supported entry points:
android.d.ts
- For android SDK and runtime types.ios.d.ts
- For iOS SDK and runtime types.
Using the declarations may conflict with DOM typings,
consider using TypeScript 2.x.x and the following settings in your tsconfig.json
:
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"experimentalDecorators": true,
"lib": [
"es6",
"dom"
]
}
}
Create reference.d.ts
and add the following content:
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />
d.ts files require a lot of memory and CPU. Consider adding skipLibCheck option to tsconfig file.
Generate android .d.ts files
- To generate android dependencies use android-dts-generator with the appropriate android version and android support jars
- To regenerate android-*.d.ts file use the android-dts-generator passing the corresponding android jar (described here)
- Run the android-dts-generator for every support jar if needed. You can check here where you can find that jar files. Rename the ouput .d.ts file with the library name and replace the existing android-support-* files in android folder.