diff --git a/highcharts/highcharts-tests.ts b/highcharts/highcharts-tests.ts
index fd36d746e..8534bc837 100644
--- a/highcharts/highcharts-tests.ts
+++ b/highcharts/highcharts-tests.ts
@@ -111,3 +111,7 @@ var highChartSettings: HighchartsOptions = {
};
var chart = $("#container").highcharts(highChartSettings);
+
+var options = Highcharts.getOptions();
+
+var options2 = Highcharts.setOptions(options);
diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts
index 8f151683f..fc14b91f7 100644
--- a/highcharts/highcharts.d.ts
+++ b/highcharts/highcharts.d.ts
@@ -1051,7 +1051,8 @@ interface HighchartsStatic {
dateFormat(format: string, time?: number, capitalize?: boolean): string;
numberFormat(value: number, decimals?: number, decimalPoint?: string, thousandsSep?: string): string;
- setOptions(options: HighchartsOptions): any;
+ setOptions(options: HighchartsOptions): HighchartsOptions;
+ getOptions(): HighchartsOptions;
}
declare var Highcharts: HighchartsStatic;
diff --git a/history/history-tests.ts b/history/history-tests.ts
index 5b46307ed..7c136d94f 100644
--- a/history/history-tests.ts
+++ b/history/history-tests.ts
@@ -1,5 +1,11 @@
///
+// Since History is defined in lib.d.ts as well
+// the name for our interfaces was chosen to be Historyjs
+// However at runtime you would need to do
+// https://github.com/borisyankov/DefinitelyTyped/issues/277
+var Historyjs: Historyjs = History;
+
function tests() {
if (!Historyjs.enabled) {
return false;
diff --git a/history/history.d.ts b/history/history.d.ts
index d526576e3..a8a3c4004 100644
--- a/history/history.d.ts
+++ b/history/history.d.ts
@@ -10,6 +10,12 @@ interface HistoryAdapter {
onDomLoad(callback);
}
+// Since History is defined in lib.d.ts as well
+// the name for our interfaces was chosen to be Historyjs
+// However at runtime you would need to do
+// https://github.com/borisyankov/DefinitelyTyped/issues/277
+// var Historyjs: Historyjs = History;
+
interface Historyjs {
enabled: boolean;
pushState(data, title, url);
@@ -23,5 +29,3 @@ interface Historyjs {
log(...messages: any[]);
debug(...messages: any[]);
}
-
-declare var Historyjs: Historyjs;
\ No newline at end of file
diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts
index 7a3d4f844..03cf993e5 100644
--- a/jquery/jquery.d.ts
+++ b/jquery/jquery.d.ts
@@ -807,6 +807,8 @@ interface JQuery {
queue(queueName: string, newQueueOrCallback: any): JQuery;
queue(newQueueOrCallback: any): JQuery;
}
-
+declare module "jquery" {
+ export = $;
+}
declare var jQuery: JQueryStatic;
declare var $: JQueryStatic;
diff --git a/sammyjs/sammyjs-tests.ts b/sammyjs/sammyjs-tests.ts
index 7ad95f6c0..da0da616e 100644
--- a/sammyjs/sammyjs-tests.ts
+++ b/sammyjs/sammyjs-tests.ts
@@ -1,8 +1,9 @@
///
function test_general() {
+ // Example from homepage
var app = Sammy('#main', function () {
- var _this: Sammy.Application;
+ var _this: Sammy.Application = this;
_this.use('Mustache');
_this.get('#/', function () {
var _this: Sammy.RenderContext;
@@ -64,7 +65,7 @@ function test_app() {
});
var app = $.sammy(),
- context = { verb: 'get', path: '#/mypath' };
+ context = { verb: 'get', path: '#/mypath' };
app.contextMatchesOptions(context, '#/mypath');
app.contextMatchesOptions(context, '#/otherpath');
@@ -98,15 +99,13 @@ function test_app() {
var app = $.sammy(function () {
var _this: Sammy.Application;
- _this.helpers({
+ var better = _this.helpers({
upcase: function (text) {
return text.toString().toUpperCase();
}
});
- _this.get('#/', function () {
- with (_this) {
- $('#main').html(upcase($('#main').text()));
- }
+ better.get('#/', function () {
+ $('#main').html(better.upcase($('#main').text()));
});
});
@@ -137,7 +136,7 @@ function test_app() {
context.$element().html(content);
context.$element().fadeIn('slow', function () {
if (callback) {
- callback.apply();
+ callback.apply(this);
}
});
});
@@ -179,146 +178,156 @@ function test_misc() {
$.sammy(function () {
var _this: Sammy.Application;
_this.get('#/:name', function () {
- if (_this.params['name'] == 'sammy') {
- _this.partial('name.html.erb', { name: 'Sammy' });
+ var _evt: Sammy.EventContext = this;
+ if (_evt.params['name'] == 'sammy') {
+ _evt.partial('name.html.erb', { name: 'Sammy' });
} else {
- _this.redirect('#/somewhere-else')
+ _evt.redirect('#/somewhere-else')
}
});
});
- var _this: Sammy.Application;
- _this.redirect('#/other/route');
- _this.redirect('#', 'other', 'route');
- _this.render('mytemplate.mustache', { name: 'quirkey' })
- .appendTo('ul');
- _this.renderEach('mytemplate.mustache', [{ name: 'quirkey' }, { name: 'endor' }]);
+ function evtContextTests() {
+ var _this: Sammy.EventContext;
+ _this.redirect('#/other/route');
+ _this.redirect('#', 'other', 'route');
+ _this.render('mytemplate.mustache', { name: 'quirkey' })
+ .appendTo('ul');
+ _this.renderEach('mytemplate.mustache', [{ name: 'quirkey' }, { name: 'endor' }]);
- var item = {
- name: 'My Item',
- price: '$25.50',
- meta: {
- id: '123'
- }
- };
- var form = new Sammy.FormBuilder('item', item);
- form.text('name');
+ var item = {
+ name: 'My Item',
+ price: '$25.50',
+ meta: {
+ id: '123'
+ }
+ };
+ var form = new Sammy.FormBuilder('item', item);
+ form.text('name');
- var options = [
- ['Small', 's'],
- ['Medium', 'm'],
- ['Large', 'l']
- ];
- form.select('size', options);
+ var options = [
+ ['Small', 's'],
+ ['Medium', 'm'],
+ ['Large', 'l']
+ ];
+ form.select('size', options);
- $.sammy(function () {
- var _this: Sammy.Application;
- _this.use('GoogleAnalytics')
+ $.sammy(function () {
+ var _this: Sammy.Application;
+ _this.use('GoogleAnalytics')
_this.get('#/dont/track/me', function () {
- _this.noTrack();
+ var evt: Sammy.GoogleAnalytics = this;
+ evt.noTrack();
+ });
});
- });
+
+ var app = $.sammy(function () {
+ var _this: Sammy.Application;
+ _this.use(Sammy.Haml);
+ _this.get('#/hello/:name', function () {
+ var evt: Sammy.Haml = this;
+ evt.title = 'Hello!';
+ evt.name = evt.params.name;
+ evt.partial('mytemplate.haml');
+ });
+ });
+ app.run()
var app = $.sammy(function () {
- var _this: Sammy.Application;
- _this.use(Sammy.Haml);
- _this.get('#/hello/:name', function () {
- _this.title = 'Hello!'
- _this.name = _this.params.name;
- _this.partial('mytemplate.haml');
+ var _this: Sammy.Application;
+ _this.use('Handlebars', 'hb');
+ _this.get('#/hello/:name', function () {
+ var evt: Sammy.Handlebars = this;
+ evt.title = 'Hello!'
+ evt.name = evt.params.name;
+ evt.partial('mytemplate.hb');
+ });
});
- });
- app.run()
+
+ var app = $.sammy(function () {
+ var _this: Sammy.Application;
+ _this.use('Handlebars', 'hb');
+ _this.get('#/hello/:name/to/:friend', function (context: Sammy.Handlebars) {
+ context.load('mypartial.hb')
+ .then(function (partial) {
+ context.partials = { hello_friend: partial };
+ context.name = context.params.name;
+ // dynamically add a property to the context
+ (context).friend = context.params.friend;
+ context.partial('mytemplate.hb');
+ });
+ });
+ });
+
+ var app = $.sammy(function () {
+ var _this: Sammy.Application;
+ _this.use('Hogan', 'hg');
+ _this.get('#/hello/:name', function () {
+ var evt: Sammy.Hogan = this;
+ evt.title = 'Hello!'
+ evt.name = evt.params.name;
+ evt.partial('mytemplate.hg');
+ });
+ });
+
+ var app = $.sammy(function () {
+ var _this: Sammy.Application;
+ _this.use('Hogan', 'hg');
+ _this.get('#/hello/:name/to/:friend', function (context) {
+ context.load('mypartial.hg')
+ .then(function (partial) {
+ context.partials = { hello_friend: partial };
+ context.name = context.params.name;
+ context.friend = context.params.friend;
+ context.partial('mytemplate.hg');
+ });
+ });
+ });
+
+ var app = $.sammy(function () {
+ var _this: Sammy.Application;
+ _this.use(Sammy.JSON);
+ _this.get('#/', function () {
+ var evt: Sammy.JSON = this;
+ evt.json({ user_id: 123 });
+ evt.json("{\"user_id\":\"123\"}");
+ evt.json("{\"user_id\":\"123\"}").user_id;
+ });
+ })
var app = $.sammy(function () {
- var _this: Sammy.Application;
- _this.use('Handlebars', 'hb');
- _this.get('#/hello/:name', function () {
- _this.title = 'Hello!'
- _this.name = _this.params.name;
- _this.partial('mytemplate.hb');
+ var _this: Sammy.Application;
+ _this.use('Mustache', 'ms');
+ _this.get('#/hello/:name', function () {
+ var evt: Sammy.Mustache = this;
+ evt.title = 'Hello!'
+ evt.name = evt.params.name;
+ evt.partial('mytemplate.ms');
+ });
});
- });
- var app = $.sammy(function () {
- var _this: Sammy.Application;
- _this.use('Handlebars', 'hb');
- _this.get('#/hello/:name/to/:friend', function (context) {
- _this.load('mypartial.hb')
- .then(function (partial) {
- context.partials = { hello_friend: partial };
- context.name = context.params.name;
- context.friend = context.params.friend;
- context.partial('mytemplate.hb');
- });
+ var app = $.sammy(function () {
+ var _this: Sammy.Application;
+ _this.use('Mustache', 'ms');
+ _this.get('#/hello/:name/to/:friend', function (context: Sammy.Mustache) {
+ context.load('mypartial.ms')
+ .then(function (partial) {
+ context.partials = { hello_friend: partial };
+ context.name = context.params.name;
+ (context).friend = context.params.friend;
+ context.partial('mytemplate.ms');
+ });
+ });
});
- });
- var app = $.sammy(function () {
- var _this: Sammy.Application;
- _this.use('Hogan', 'hg');
- _this.get('#/hello/:name', function () {
- _this.title = 'Hello!'
- _this.name = _this.params.name;
- _this.partial('mytemplate.hg');
+ var app = $.sammy(function (app) {
+ var _this: Sammy.Application;
+ _this.use(Sammy.NestedParams);
+ _this.post('#/parse_me', function (context) {
+ $.log(context.params);
+ });
});
- });
-
- var app = $.sammy(function () {
- var _this: Sammy.Application;
- _this.use('Hogan', 'hg');
- _this.get('#/hello/:name/to/:friend', function (context) {
- _this.load('mypartial.hg')
- .then(function (partial) {
- context.partials = { hello_friend: partial };
- context.name = context.params.name;
- context.friend = context.params.friend;
- context.partial('mytemplate.hg');
- });
- });
- });
-
- var app = $.sammy(function () {
- var _this: Sammy.Application;
- _this.use(Sammy.JSON);
- _this.get('#/', function () {
- _this.json({ user_id: 123 });
- _this.json("{\"user_id\":\"123\"}");
- _this.json("{\"user_id\":\"123\"}").user_id;
- });
- })
-
- var app = $.sammy(function () {
- var _this: Sammy.Application;
- _this.use('Mustache', 'ms');
- _this.get('#/hello/:name', function () {
- _this.title = 'Hello!'
- _this.name = _this.params.name;
- _this.partial('mytemplate.ms');
- });
- });
-
- var app = $.sammy(function () {
- var _this: Sammy.Application;
- _this.use('Mustache', 'ms');
- _this.get('#/hello/:name/to/:friend', function (context) {
- _this.load('mypartial.ms')
- .then(function (partial) {
- context.partials = { hello_friend: partial };
- context.name = context.params.name;
- context.friend = context.params.friend;
- context.partial('mytemplate.ms');
- });
- });
- });
-
- var app = $.sammy(function (app) {
- var _this: Sammy.Application;
- _this.use(Sammy.NestedParams);
- _this.post('#/parse_me', function (context) {
- $.log(_this.params);
- });
- });
+ };
var _this: Sammy.Application;
_this.use('Storage');
@@ -333,7 +342,7 @@ function test_misc() {
_this.bind("oauth.connected", function () { $("#signin").hide() });
_this.bind("oauth.disconnected", function () { $("#signin").show() });
_this.bind("oauth.denied", function (evt, error) {
- _this.partial("admin/views/no_access.tmpl", { error: error.message });
+ evt.partial("admin/views/no_access.tmpl", { error: error.message });
});
_this.get("#/signout", function (context) {
context.loseAccessToken();
@@ -341,27 +350,29 @@ function test_misc() {
});
_this.get('#/', function () {
- _this.render('mytemplate.template', { name: 'test' });
+ this.render('mytemplate.template', { name: 'test' });
});
_this.send($.getJSON, '/app.json')
.then(function (json) {
$('#message').text(json['message']);
}
- );
+ );
_this.get('#/', function () {
- _this.load('myfile.txt')
+ var evt: Sammy.EventContext = this;
+ evt.load('myfile.txt')
.then(function (content) {
$('#main').html(content);
});
});
_this.get('#/', function () {
- _this.load('mytext.json')
+ var evt: Sammy.EventContext = this;
+ evt.load('mytext.json')
.then(function (content) {
- var context = _this,
- data = JSON.parse(content);
+ var context = this,
+ data = JSON.parse(content);
context.wait();
$.post(data.url, {}, function (response) {
context.next(JSON.parse(response));
@@ -386,7 +397,8 @@ function test_misc() {
store.each(function (key, value) {
Sammy.log('key', key, 'value', value);
});
- var store = new Sammy.Store;
+
+ store = new Sammy.Store();
store.exists('foo');
store.fetch('foo', function () {
return 'bar!';
@@ -396,7 +408,7 @@ function test_misc() {
return 'baz!';
});
- var store = new Sammy.Store;
+ store = new Sammy.Store();
store.set('one', 'two');
store.set('two', 'three');
store.set('1', 'two');
@@ -404,12 +416,12 @@ function test_misc() {
return value === 'two';
});
- var store = new Sammy.Store;
+ var store = new Sammy.Store();
store.load('mytemplate', '/mytemplate.tpl', function () {
- s.get('mytemplate')
+ store.get('mytemplate')
});
- var store = new Sammy.Store({ name: 'kvo' });
+ store = new Sammy.Store({ name: 'kvo' });
$('body').bind('set-kvo-foo', function (e, data) {
Sammy.log(data.key + ' changed to ' + data.value);
});
@@ -418,17 +430,19 @@ function test_misc() {
$.sammy(function () {
_this.use('Template');
_this.get('#/', function () {
- _this.user = { name: 'Aaron Quint' };
- _this.partial('user.template');
+ var evt: Sammy.EventContext = this;
+ // Adding a dynamic property
+ (evt).user = { name: 'Aaron Quint' };
+ evt.partial('user.template');
})
});
_this.use(Sammy.Template, 'tpl');
_this.get('#/', function () {
- _this.partial('myfile.tpl');
+ this.partial('myfile.tpl');
});
_this.get('#/', function () {
- _this.template('myform.tpl', { form: "" }, { escape_html: false });
+ this.template('myform.tpl', { form: "" }, { escape_html: false });
});
}
@@ -440,21 +454,21 @@ function test_routes() {
_this.put('#/post/form', function () {
return false;
});
- _thisget('/test/123', function () {
+ _this.get('/test/123', function () {
});
- _thisget('#/by_name/:name', function () {
- alert(_this.params['name']);
+ _this.get('#/by_name/:name', function () {
+ alert(this.params['name']);
});
- _thisget(/\#\/by_name\/(.*)/, function () {
- alert(_this.params['splat']);
+ _this.get(/\#\/by_name\/(.*)/, function () {
+ alert(this.params['splat']);
});
- _thisget('#/by_name/:name', function () {
- _this.redirect('#', _this.params['name']);
+ _this.get('#/by_name/:name', function () {
+ this.redirect('#', this.params['name']);
});
- _thisget('#/by_name/:name', function (context) {
- context.redirect('#', _this.params['name']);
+ _this.get('#/by_name/:name', function (context) {
+ context.redirect('#', this.params['name']);
});
}
@@ -466,16 +480,16 @@ function test_events() {
_this.redirect('#/');
});
- var app = $.sammy(function () {
+ var app1 = $.sammy(function () {
var _this: Sammy.Application;
_this.bind('test', function () {
var _this: Sammy.EventContext;
_this.trigger('other-event');
});
});
- app.trigger('other-event');
+ app1.trigger('other-event');
- var app = $.sammy(function () {
+ var app2 = $.sammy(function () {
var _this: Sammy.Application;
_this.bind('test', function (e, data) {
alert(data['my_data']);
@@ -495,12 +509,12 @@ function test_plugins() {
}
});
};
- var app = $.sammy(function () {
+ var app1 = $.sammy(function () {
var _this: Sammy.Application;
_this.use(MyPlugin);
_this.get('#/', function () {
var _this: Sammy.EventContext;
- _this.alert("I'm home");
+ alert("I'm home");
});
});
var MyAdvancedPlugin = function (app, prefix, suffix) {
@@ -516,25 +530,25 @@ function test_plugins() {
var _this: Sammy.Application;
_this.use(MyAdvancedPlugin, 'BEFORE!', 'AFTER!');
_this.get('#/', function () {
- _this.alert("I'm home");
+ alert("I'm home");
});
});
var dbLoadAndDisplay = function (app) {
var _this: Sammy.Application;
_this.get('#/', function () {
- _this.record = _this.app.db[_this.app.element_selector];
- _this.app.swap(_this.record.toHTML());
+ this.record = this.app.db[this.app.element_selector];
+ this.app.swap(this.record.toHTML());
});
_this.bind('run', function () {
});
};
var app1 = Sammy('#div_1', function () {
- _this.use(dbLoadAndDisplay);
+ this.use(dbLoadAndDisplay);
});
var app2 = Sammy('#div_2', function () {
- _this.use(dbLoadAndDisplay);
+ this.use(dbLoadAndDisplay);
});
}
\ No newline at end of file
diff --git a/sammyjs/sammyjs.d.ts b/sammyjs/sammyjs.d.ts
index 40fdab667..1c9ca4877 100644
--- a/sammyjs/sammyjs.d.ts
+++ b/sammyjs/sammyjs.d.ts
@@ -20,18 +20,20 @@ declare function Sammy(selector: string, handler: Function): Sammy.Application;
interface JQueryStatic {
sammy: SammyFunc;
+ log: Function;
}
declare module Sammy {
export function Cache(app, options);
export function DataCacheProxy(initial, $element);
- export function DataLocationProxy(app, data_name, href_attribute);
+ export var DataLocationProxy:DataLocationProxy;
export function DefaultLocationProxy(app, run_interval_every);
export function EJS(app, method_alias);
export function Exceptional(app, errorReporter);
export function Flash(app);
+ export var FormBuilder: FormBuilder;
export function Form(app); // formFor ( name, object, content_callback )
export function Haml(app, method_alias);
@@ -49,15 +51,17 @@ declare module Sammy {
export function PushLocationProxy(app);
export function Session(app, options);
export function Storage(app);
+ export var Store: Store;
export function Title();
+ export function Template(app, method_alias);
export function Tmpl(app, method_alias);
export function addLogger(logger);
- export function log();
+ export function log(...args:any[]);
- export interface Object {
+ export class Object {
- new (obj: any);
+ constructor(obj: any);
escapeHTML(s: string): string;
h(s: string): string;
@@ -82,6 +86,7 @@ declare module Sammy {
after(callback: Function): Application;
any(verb: string, path: string, callback: Function): void;
around(callback: Function): Application;
+ before(callback: Function): Application;
before(options: any, callback: Function): Application;
bind(name: string, callback: Function): Application;
bind(name: string, data: any, callback: Function): Application;
@@ -96,8 +101,8 @@ declare module Sammy {
get(path: string, callback: Function): Application;
get(path: RegExp, callback: Function): Application;
getLocation(): string;
- helper(name: string, method: Function): Application;
- helpers(extensions: any): Application;
+ helper(name: string, method: Function): any; // Behaviour similar to _.extend
+ helpers(extensions: any): any; // Behaviour similar to _.extend
isRunning(): boolean;
log(...params: any[]): void;
lookupRoute(verb: string, path: string): any;
@@ -113,19 +118,27 @@ declare module Sammy {
route(verb: string, path: RegExp, callback: Function): Application;
run(start_url?: string): Application;
runRoute(verb: string, path?: string, params?: any, target?: any): any;
+ send(...params: any[]);
setLocation(new_location: string): string;
setLocationProxy(new_proxy: DataLocationProxy): void;
- swap(content: any, callback: Function): string;
+ swap(content: any, callback: Function): any;
templateCache(key: string, value: any): any;
toString(): string;
trigger(name: string, data?: any): Application;
unload(): Application;
use(...params: any[]): void;
+
+ // Features provided by oauth2 plugin
+ oauthorize: string;
+ requireOAuth();
+ requireOAuth(path?:string);
+ requireOAuth(callback?: Function);
}
export interface DataLocationProxy {
- new (app, run_interval_every): DataLocationProxy;
+ new (app, run_interval_every?): DataLocationProxy;
+ new (app, data_name, href_attribute): DataLocationProxy;
fullPath(location_obj): string;
bind(): void;
@@ -142,19 +155,25 @@ declare module Sammy {
engineFor(engine: any): any;
eventNamespace(): string;
interpolate(content: any, data: any, engine: any, partials): EventContext;
+ json(str: any): any;
json(str: string): any;
load(location: any, options?: any, callback?: Function): any;
loadPartials(partials);
notFound(): any;
- partial(location: string, data: any, callback: Function, partials): RenderContext;
- params: Object;
+ partial(location: string, data?: any, callback?: Function, partials?): RenderContext;
+ partials: any;
+ params: any;
redirect(...params: any[]): void;
- render(location: string, data: any, callback: Function, partials): RenderContext;
- renderEach(location: any, name?: string, data?: any, callback?: Function): RenderContext;
+ render(location: string, data?: any, callback?: Function, partials?): RenderContext;
+ renderEach(location: any, data?: { name: string;data?:any}[],callback?: Function): RenderContext;
send(...params: any[]): RenderContext;
swap(contents: any, callback: Function): string;
toString(): string;
trigger(name: string, data?: any): EventContext;
+
+ // Provided by common sammy modules:
+ name: any;
+ title: any;
}
export interface FormBuilder {
@@ -186,6 +205,16 @@ declare module Sammy {
track(path);
}
+ export interface Haml extends EventContext { }
+
+ export interface Handlebars extends EventContext { }
+
+ export interface Hogan extends EventContext { }
+
+ export interface JSON extends EventContext { }
+
+ export interface Mustache extends EventContext { }
+
export interface RenderContext extends Object {
new (event_context);
@@ -204,10 +233,10 @@ declare module Sammy {
render(location: string, callback: Function, partials?: any): RenderContext;
render(location: string, data: any, callback: Function): RenderContext;
render(location: string, data: any, callback: Function, partials: any): RenderContext;
- renderEach(location: string, name: string, data: any, callback: Function): RenderContext;
+ renderEach(location: string, name?: string, data?: any, callback?: Function): RenderContext;
replace(selector: string): RenderContext;
send(...params: any[]): RenderContext;
- swap(callback: Function): RenderContext;
+ swap(callback?: Function): RenderContext;
then(callback: Function): RenderContext;
trigger(name, data);
wait(): void;
@@ -228,7 +257,7 @@ declare module Sammy {
stores: any;
- new (options);
+ new (options?:any);
clear(key: string): any;
clearAll(): void;
diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts
index debd080d2..a76a81dbe 100644
--- a/winjs/winjs.d.ts
+++ b/winjs/winjs.d.ts
@@ -62,6 +62,9 @@ declare module WinJS {
function start(): void;
function stop(): void;
}
+ class ErrorFromName {
+ constructor(name: string, message?: string);
+ }
class Promise {
constructor(init: (c: any, e: any, p: any) => void);
then(success?: (value: T) => Promise, error?: (error: any) => Promise, progress?: (progress: any) => void ): Promise;