Ambient declarations for the Appcelerator Titanium SDK v5.0.0 and Appcelerator Alloy 1.7.x.
Run the following commands from inside the source folder.
Install Microsoft TypeScript
npm install -g typescript
npm install
tsc -m commonjs -t ES5 -sourcemap References.ts
Download the api.json
and alloy_api.json
files for the target Appcelerator Titanium and Alloy versions from here and place them in the same directory as the Generator.js file.
node Generator.js api.json > titanium.d.ts
node Generator.js alloy_api.json > alloy.d.ts
- In
Titanium.Map.View
there is a conflict with the propertyanimate
and two methods with the same id. The propertyanimate
has been taken out from the definition. - In
Database.ResultSet
the propertyfieldCount
has been removed. Instead you can use the methodgetFieldCount()
. - Methods that accept an arbitrary number arguments are not detected as such because Appcelerator's
api.json
does not appear to contain this information. - All callbacks are
(...args : any[]) => any
- Methods that
...extraPaths: string[]
should be appended to their argument signature: Titanium.Filesystem.getFile, Titanium.Filesystem.openStream - Find
export enum R {
and replace withexport interface R {
- Find
show (animated: boolean, view: any) : void;
and replace withshow () : void;
- Find
declare enum FailureResponse {
and replace withdeclare class FailureResponse {code: Number; error: string; success: boolean;
For future work, it would be interesting to implement interface inheritance in order to avoid repeated inherited methods or properties in subclasses.