From 83c228755fe21c6da6aa2fecde019b3fec42172e Mon Sep 17 00:00:00 2001 From: Justin Filip Date: Mon, 27 Oct 2014 15:34:46 -0400 Subject: [PATCH 01/42] Add type description for cookie.js --- CONTRIBUTORS.md | 1 + cookiejs/cookiejs-tests.ts | 30 ++++++++++++++++++++++++++++++ cookiejs/cookiejs.d.ts | 24 ++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 cookiejs/cookiejs-tests.ts create mode 100644 cookiejs/cookiejs.d.ts diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 083204e8fa..9152d04b1c 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -64,6 +64,7 @@ All definitions files include a header with the author and editors, so at some p * [CodeMirror](http://codemirror.net) (by [François de Campredon](https://github.com/fdecampredon)) * [Commander](http://github.com/visionmedia/commander.js) (by [Marcelo Dezem](https://github.com/mdezem) and [vvakame](https://github.com/vvakame)) * [configstore](http://github.com/yeoman/configstore) (by [Bart van der Schoor](https://github.com/Bartvds)) +* [cookie.js](https://github.com/js-coder/cookie.js) (by [Boltmade](https://github.com/Boltmade)) * [Cordova](http://cordova.apache.org) (by [Microsoft Open Technologies, Inc.](http://msopentech.com/)) * [Cordovarduino](https://github.com/stereolux/cordovarduino) (by [Hendrik Maus](https://github.com/hendrikmaus)) * [Couchbase / Couchnode](https://github.com/couchbase/couchnode) (by [Basarat Ali Syed](https://github.com/basarat)) diff --git a/cookiejs/cookiejs-tests.ts b/cookiejs/cookiejs-tests.ts new file mode 100644 index 0000000000..b4dd6927b6 --- /dev/null +++ b/cookiejs/cookiejs-tests.ts @@ -0,0 +1,30 @@ +/// + +// Based on https://github.com/js-coder/cookie.js/blob/gh-pages/tests/spec.js + +cookie.set({a: '1', b: '2', c: '3'}); + +cookie; +cookie.enabled(); + +cookie.set('n', '5'); + +cookie.get('a'); +cookie.get('__undef__'); +cookie.get('__undef__', 'fallback'); +cookie.get(['a', 'b']); +cookie.get(['a', '__undef__'], 'fallback'); + +cookie('a'); +cookie('__undef__'); +cookie('__undef__', 'fallback'); +cookie(['a', 'b']); +cookie(['a', '__undef__'], 'fallback'); + +cookie.remove('a'); +cookie.remove('a', 'b'); +cookie.remove(['a', 'b']); + +cookie.empty(); + +cookie.all(); diff --git a/cookiejs/cookiejs.d.ts b/cookiejs/cookiejs.d.ts new file mode 100644 index 0000000000..bdd71f0219 --- /dev/null +++ b/cookiejs/cookiejs.d.ts @@ -0,0 +1,24 @@ +// Type definitions for cookie.js v1.0.0 +// Project: https://github.com/js-coder/cookie.js +// Definitions by: Boltmade +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare function cookie(key : string, fallback?: string) : string; +declare function cookie(keys : string[], fallback?: string) : string; + +declare module cookie { + export function set(key : string, value : string, options? : any) : void; + export function set(obj : any, options? : any) : void; + export function remove(key : string) : void; + export function remove(keys : string[]) : void; + export function remove(...args : string[]) : void; + export function empty() : void; + export function get(key : string, fallback?: string) : string; + export function get(keys : string[], fallback?: string) : string; + export function all() : any; + export function enabled() : boolean; +} + +declare module "cookiejs" { + export = cookie; +} From 0573a8bf5d76b261f71ef4f6576d036ca0e3de59 Mon Sep 17 00:00:00 2001 From: Yang Guan Date: Fri, 31 Oct 2014 00:25:51 -0700 Subject: [PATCH 02/42] Add type definitions for heatmap.js --- heatmap.js/heatmap-tests.ts | 42 +++++++++++ heatmap.js/heatmap.d.ts | 134 ++++++++++++++++++++++++++++++++++++ 2 files changed, 176 insertions(+) create mode 100644 heatmap.js/heatmap-tests.ts create mode 100644 heatmap.js/heatmap.d.ts diff --git a/heatmap.js/heatmap-tests.ts b/heatmap.js/heatmap-tests.ts new file mode 100644 index 0000000000..c61458faec --- /dev/null +++ b/heatmap.js/heatmap-tests.ts @@ -0,0 +1,42 @@ +/// + +var baseLayer = L.tileLayer( + 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © CloudMade', + maxZoom: 18 + }); + +var testData: HeatmapDataObject = { + max: 8, + data: [ + { + lat: 24.6408, + lng:46.7728, + count: 3 + }, { + lat: 50.75, + lng: -1.55, + count: 1 + } + ] +}; + +var config : HeatmapConfiguration = { + radius: 2, + maxOpacity: .8, + scaleRadius: true, + useLocalExtrema: true, + latField: 'lat', + lngField: 'lng', + valueField: 'count' +}; + +var heatmapLayer = new HeatmapOverlay(config); + +var map = new L.Map('map-canvas', { + center: new L.LatLng(25.6586, -80.3568), + zoom: 4, + layers: [baseLayer, heatmapLayer] +}); + +heatmapLayer.setData(testData); diff --git a/heatmap.js/heatmap.d.ts b/heatmap.js/heatmap.d.ts new file mode 100644 index 0000000000..bff76db98f --- /dev/null +++ b/heatmap.js/heatmap.d.ts @@ -0,0 +1,134 @@ +// Type definitions for heatmap.js v2.0 +// Project: https://github.com/pa7/heatmap.js/ +// Definitions by: Yang Guan +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +/* + * Configuration object of a heatmap + */ +interface HeatmapConfiguration { + + /* + * A background color string in form of hexcode, color name, or rgb(a) + */ + backgroundColor?: string; + + /* + * An object that represents the gradient + */ + gradient?: any; + + /* + * The radius each datapoint will have (if not specified on the datapoint + * itself) + */ + radius?: number; + + /* + * The radius each datapoint will have (if not specified on the datapoint + * itself) + */ + useLocalExtrema?: boolean; + + /* + * A global opacity for the whole heatmap. This overrides maxOpacity and + * minOpacity if set + */ + opacity?: number; + + /* + * The maximal opacity the highest value in the heatmap will have. (will be + * overridden if opacity set) + * Default value: 0.6 + */ + maxOpacity?: number; + + /* + * The minimum opacity the lowest value in the heatmap will have (will be + * overridden if opacity set) + */ + minOpacity?: number; + + /* + * The blur factor that will be applied to all datapoints. The higher the + * blur factor is, the smoother the gradients will be + * Default value: 0.85 + */ + blur?: number; + + /* + * The property name of your latitude coordinate in a datapoint + * Default value: 'x' + */ + latField?: string; + + /* + * The property name of your longitude coordinate in a datapoint + * Default value: 'y' + */ + lngField?: string; + + /* + * The property name of your y coordinate in a datapoint + */ + valueField: string; +} + +/* + * A single data point on a heatmap. The keys are specified by + * HeatmapConfig.latField, HeatmapConfig.lngField and HeatmapConfig.valueField + */ +interface HeatmapDataPoint { + [index: string] : number; +} + +/* + * An object representing the set of data points on a heatmap. + */ +interface HeatmapDataObject { + + /* + * Max value of of the valueField + */ + max?: number; + + /* + * Min value of of the valueField + */ + min?: number; + + /* + * An array of HeatmapDataPoints + */ + data: HeatmapDataPoint[]; +} + +/* + * The overlay layer to be added onto leaflet map + */ +declare class HeatmapOverlay { + + /* + * Initialization function + */ + constructor(configuration: HeatmapConfiguration) + + /* + * Create DOM elements for othe overlay, adding them to map panes and + * puts listeners on relevant map events + */ + onAdd(map: L.Map): void; + + /* + * Remove the overlay's elements from the DOM and remove listeners + * previously added by onAdd() + */ + onRemove(map: L.Map): void; + + /* + * Initialize a heatmap instance with the given dataset + */ + setData(data: {}): void; +} From 05896329891138898edee72177aefa1e3482453d Mon Sep 17 00:00:00 2001 From: Yang Guan Date: Fri, 31 Oct 2014 12:20:52 -0700 Subject: [PATCH 03/42] Update contributor list --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 234fdad560..197492f8b8 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -140,6 +140,7 @@ All definitions files include a header with the author and editors, so at some p * [HashMap](https://github.com/flesler/hashmap) (by [Rafał Wrzeszcz](https://wrzasq.pl)) * [HashSet](http://www.timdown.co.uk/jshashtable/jshashset.html) (by [Sergey Gerasimov](https://github.com/gerich-home)) * [Hashtable](http://www.timdown.co.uk/jshashtable/) (by [Sergey Gerasimov](https://github.com/gerich-home)) +* [heatmap.js](https://github.com/pa7/heatmap.js/) (by [Yang Guan](https://github.com/lookuptable)) * [HelloJS](http://adodson.com/hello.js) (by [Pavel Zika](https://github.com/PavelPZ)) * [Highcharts](http://www.highcharts.com/) (by [damianog](https://github.com/damianog)) * [Highland](http://highlandjs.org/) (by [Bart van der Schoor](https://github.com/Bartvds/)) From 5eba93f5813418f10da92861def0ed1bdc6b9815 Mon Sep 17 00:00:00 2001 From: progre Date: Mon, 3 Nov 2014 12:11:41 +0900 Subject: [PATCH 04/42] move to legacy --- .../socket.io-0.9-tests.ts} | 46 +++--- .../socket.io-0.9-tests.ts.tscparams} | 2 +- .../socket.io-0.9.d.ts} | 140 +++++++++--------- 3 files changed, 94 insertions(+), 94 deletions(-) rename socket.io/{socket.io-tests.ts => legacy/socket.io-0.9-tests.ts} (96%) rename socket.io/{socket.io-tests.ts.tscparams => legacy/socket.io-0.9-tests.ts.tscparams} (50%) rename socket.io/{socket.io.d.ts => legacy/socket.io-0.9.d.ts} (96%) diff --git a/socket.io/socket.io-tests.ts b/socket.io/legacy/socket.io-0.9-tests.ts similarity index 96% rename from socket.io/socket.io-tests.ts rename to socket.io/legacy/socket.io-0.9-tests.ts index 0b29890ca1..40f0c6b897 100644 --- a/socket.io/socket.io-tests.ts +++ b/socket.io/legacy/socket.io-0.9-tests.ts @@ -1,24 +1,24 @@ -import io = require('socket.io'); - -var socketManager = io.listen(80); - -socketManager.sockets.on('connection', socket => { - socket.emit('news', { hello: 'world' }); - socket.on('my other event', data => { - console.log(data); - }); -}); - -// Storing data Associated to a client. -// Server side sample -io.listen(80).sockets.on('connection', function (socket) { - socket.on('set nickname', function (name) { - socket.set('nickname', name, function () { socket.emit('ready'); }); - }); - - socket.on('msg', function () { - socket.get('nickname', function (err, name) { - console.log('Chat message by ', name); - }); - }); +import io = require('socket.io'); + +var socketManager = io.listen(80); + +socketManager.sockets.on('connection', socket => { + socket.emit('news', { hello: 'world' }); + socket.on('my other event', data => { + console.log(data); + }); +}); + +// Storing data Associated to a client. +// Server side sample +io.listen(80).sockets.on('connection', function (socket) { + socket.on('set nickname', function (name) { + socket.set('nickname', name, function () { socket.emit('ready'); }); + }); + + socket.on('msg', function () { + socket.get('nickname', function (err, name) { + console.log('Chat message by ', name); + }); + }); }); \ No newline at end of file diff --git a/socket.io/socket.io-tests.ts.tscparams b/socket.io/legacy/socket.io-0.9-tests.ts.tscparams similarity index 50% rename from socket.io/socket.io-tests.ts.tscparams rename to socket.io/legacy/socket.io-0.9-tests.ts.tscparams index d3f5a12faa..8b13789179 100644 --- a/socket.io/socket.io-tests.ts.tscparams +++ b/socket.io/legacy/socket.io-0.9-tests.ts.tscparams @@ -1 +1 @@ - + diff --git a/socket.io/socket.io.d.ts b/socket.io/legacy/socket.io-0.9.d.ts similarity index 96% rename from socket.io/socket.io.d.ts rename to socket.io/legacy/socket.io-0.9.d.ts index 184468b127..44edbb1745 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/legacy/socket.io-0.9.d.ts @@ -1,70 +1,70 @@ -// Type definitions for socket.io -// Project: http://socket.io/ -// Definitions by: William Orr -// Definitions: https://github.com/borisyankov/DefinitelyTyped - - -/// - -declare module "socket.io" { - import http = require('http'); - - export function listen(server: http.Server, options: any, fn: Function): SocketManager; - export function listen(server: http.Server, fn?: Function): SocketManager; - export function listen(port: Number): SocketManager; - - - interface Socket { - id: string; - json:any; - log: any; - volatile: any; - broadcast: any; - handshake: any; - in(room: string): Socket; - to(room: string): Socket; - join(name: string, fn: Function): Socket; - leave(name: string, fn: Function): Socket; - set(key: string, value: any, fn: Function): Socket; - get(key: string, fn: Function): Socket; - has(key: string, fn: Function): Socket; - del(key: string, fn: Function): Socket; - disconnect(): Socket; - send(data: any, fn: Function): Socket; - emit(ev: any, ...data:any[]): Socket; - on(ns: string, fn: Function): Socket; - } - - interface SocketNamespace { - clients(room: string): Socket[]; - log: any; - store: any; - json: any; - volatile: any; - in(room: string): SocketNamespace; - on(evt: string, fn: (socket: Socket) => void): SocketNamespace; - to(room: string): SocketNamespace; - except(id: any): SocketNamespace; - send(data: any): any; - emit(ev: any, ...data:any[]): Socket; - socket(sid: any, readable: boolean): Socket; - authorization(fn: Function): SocketNamespace; - } - - interface SocketManager { - get(key: any): any; - set(key: any, value: any): SocketManager; - enable(key: any): SocketManager; - disable(key: any): SocketManager; - enabled(key: any): boolean; - disabled(key: any): boolean; - configure(env: string, fn: Function): SocketManager; - configure(fn: Function): SocketManager; - of(nsp: string): SocketNamespace; - on(ns: string, fn: Function): SocketManager; - sockets: SocketNamespace; - } - - -} - +// Type definitions for socket.io +// Project: http://socket.io/ +// Definitions by: William Orr +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +declare module "socket.io" { + import http = require('http'); + + export function listen(server: http.Server, options: any, fn: Function): SocketManager; + export function listen(server: http.Server, fn?: Function): SocketManager; + export function listen(port: Number): SocketManager; + + + interface Socket { + id: string; + json:any; + log: any; + volatile: any; + broadcast: any; + handshake: any; + in(room: string): Socket; + to(room: string): Socket; + join(name: string, fn: Function): Socket; + leave(name: string, fn: Function): Socket; + set(key: string, value: any, fn: Function): Socket; + get(key: string, fn: Function): Socket; + has(key: string, fn: Function): Socket; + del(key: string, fn: Function): Socket; + disconnect(): Socket; + send(data: any, fn: Function): Socket; + emit(ev: any, ...data:any[]): Socket; + on(ns: string, fn: Function): Socket; + } + + interface SocketNamespace { + clients(room: string): Socket[]; + log: any; + store: any; + json: any; + volatile: any; + in(room: string): SocketNamespace; + on(evt: string, fn: (socket: Socket) => void): SocketNamespace; + to(room: string): SocketNamespace; + except(id: any): SocketNamespace; + send(data: any): any; + emit(ev: any, ...data:any[]): Socket; + socket(sid: any, readable: boolean): Socket; + authorization(fn: Function): SocketNamespace; + } + + interface SocketManager { + get(key: any): any; + set(key: any, value: any): SocketManager; + enable(key: any): SocketManager; + disable(key: any): SocketManager; + enabled(key: any): boolean; + disabled(key: any): boolean; + configure(env: string, fn: Function): SocketManager; + configure(fn: Function): SocketManager; + of(nsp: string): SocketNamespace; + on(ns: string, fn: Function): SocketManager; + sockets: SocketNamespace; + } + + +} + From bafa39895f5294f75357a5fa649d92fb4231226a Mon Sep 17 00:00:00 2001 From: vingarg Date: Mon, 3 Nov 2014 19:50:00 +0530 Subject: [PATCH 05/42] Added interface for rowGrid.js --- jquery.rowGrid/jquery.rowGrid.d.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 jquery.rowGrid/jquery.rowGrid.d.ts diff --git a/jquery.rowGrid/jquery.rowGrid.d.ts b/jquery.rowGrid/jquery.rowGrid.d.ts new file mode 100644 index 0000000000..4b136d2bac --- /dev/null +++ b/jquery.rowGrid/jquery.rowGrid.d.ts @@ -0,0 +1,17 @@ +// Type definitions for jQuery rowGrid.js plugin (v1.0.2) +// Project: https://github.com/brunjo/rowGrid.js +// Definitions by: Vinayak Garg +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface JQueryRowGridJSOptions { + minMargin?: number; + maxMargin?: number; + itemSelector: string; +} + +interface JQuery { + rowGrid(options?: JQueryRowGridJSOptions): JQuery; + rowGrid(appended: string): JQuery; +} \ No newline at end of file From 3a8f59bc933292f1cb89438e8c3b7a1b722b4ce3 Mon Sep 17 00:00:00 2001 From: vingarg Date: Mon, 3 Nov 2014 20:02:55 +0530 Subject: [PATCH 06/42] Added name in CONTRIBUTORS.md --- CONTRIBUTORS.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 9d27a0d1d4..639abfb7aa 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -63,7 +63,7 @@ All definitions files include a header with the author and editors, so at some p * [Clone](https://github.com/pvorb/node-clone) (by [Kieran Simpson](https://github.com/kierans)) * [CodeMirror](http://codemirror.net) (by [François de Campredon](https://github.com/fdecampredon)) * [Commander](http://github.com/visionmedia/commander.js) (by [Marcelo Dezem](https://github.com/mdezem) and [vvakame](https://github.com/vvakame)) -* [configstore](http://github.com/yeoman/configstore) (by [Bart van der Schoor](https://github.com/Bartvds)) +* [configstore](http://github.com/yeoman/configstore) (by [Bart van der Schoor](https://github.com/Bartvds)) * [cookie](https://github.com/jshttp/cookie) (by [Pine Mizune](https://github.com/jshttp/cookie)) * [Cordova](http://cordova.apache.org) (by [Microsoft Open Technologies, Inc.](http://msopentech.com/)) * [Cordovarduino](https://github.com/stereolux/cordovarduino) (by [Hendrik Maus](https://github.com/hendrikmaus)) @@ -207,6 +207,7 @@ All definitions files include a header with the author and editors, so at some p * [jQuery.pnotify](http://sciactive.github.io/pnotify/) (by [David Sichau](https://github.com/DavidSichau/)) * [jQuery.postMessage](http://benalman.com/projects/jquery-postmessage-plugin/) (by [Junle Li](https://github.com/lijunle)) * [jQuery.prettyphoto](https://github.com/scaron/prettyphoto) (by [Paul Gaske](https://github.com/pgaske)) +* [jQuery.rowGrid](https://github.com/brunjo/rowGrid.js) (by [Vinayak Garg](https://github.com/vinayak-garg)) * [jQuery.scrollTo](https://github.com/flesler/jquery.scrollTo) (by [Neil Stalker](https://github.com/nestalk/)) * [jQuery.simplePagination](https://github.com/flaviusmatis/simplePagination.js) (by [Natan Vivo](https://github.com/nvivo/)) * [jquery.superLink](http://james.padolsey.com/demos/plugins/jQuery/superLink/superlink.jquery.js) (by [Blake Niemyjski](https://github.com/niemyjski)) @@ -248,7 +249,7 @@ All definitions files include a header with the author and editors, so at some p * [Knockout.Mapper](https://github.com/LucasLorentz/knockout.mapper) (by [Brandon Meyer](https://github.com/BMeyerKC)) * [Knockout.Mapping](https://github.com/SteveSanderson/knockout.mapping) (by [Boris Yankov](https://github.com/borisyankov)) * [Knockout.Postbox](https://github.com/rniemeyer/knockout-postbox) (by [Judah Gabriel Himango](https://github.com/JudahGabriel)) -* [Knockout.Rx](https://github.com/Igorbek/knockout.rx) (by [Igor Oleinikov](https://github.com/Igorbek)) +* [Knockout.Rx](https://github.com/Igorbek/knockout.rx) (by [Igor Oleinikov](https://github.com/Igorbek)) * [Knockout Secure Binding](https://github.com/brianmhunt/knockout-secure-binding) (by [Pine Mizune](https://github.com/pine613)) * [Knockout.Validation](https://github.com/ericmbarnard/Knockout-Validation) (by [Dan Ludwig](https://github.com/danludwig)) * [Knockout.Viewmodel](http://coderenaissance.github.com/knockout.viewmodel/) (by [Oisin Grehan](https://github.com/oising)) @@ -326,9 +327,9 @@ All definitions files include a header with the author and editors, so at some p * [PDF.js](https://github.com/mozilla/pdf.js) (by [Josh Baldwin](https://github.com/jbaldwin)) * [PeerJS](http://peerjs.com/) (by [Toshiya Nakakura](https://github.com/nakakura)) * [PEG.js](http://pegjs.majda.cz/) (by [vvakame](https://github.com/vvakame)) -* [Persona](http://www.mozilla.org/en-US/persona) (by [James Frasca](https://github.com/Nycto)) -* [PgwModal](http://pgwjs.com/pgwmodal/) (by [Pine Mizune](https://github.com/pine613)) -* [PhantomJS](http://phantomjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker)) +* [Persona](http://www.mozilla.org/en-US/persona) (by [James Frasca](https://github.com/Nycto)) +* [PgwModal](http://pgwjs.com/pgwmodal/) (by [Pine Mizune](https://github.com/pine613)) +* [PhantomJS](http://phantomjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker)) * [PhoneGap](http://phonegap.com) (by [Boris Yankov](https://github.com/borisyankov)) * [Physijs](http://chandlerprall.github.io/Physijs/) (by [gyoh_k](https://github.com/gyohk)) * [Pickadate.js](https://github.com/amsul/pickadate.js) (by [Adi Dahiya](https://github.com/adidahiya)) From d68d470bbd9053908f1b72ffa2c2b13b43d491ad Mon Sep 17 00:00:00 2001 From: progre Date: Mon, 3 Nov 2014 17:11:03 +0900 Subject: [PATCH 07/42] add socket.io 1.2.0 --- socket.io/legacy/socket.io-0.9-tests.ts | 2 +- socket.io/legacy/socket.io-0.9.d.ts | 4 +- socket.io/socket.io-tests.ts | 145 ++++++++++++++++++++++++ socket.io/socket.io.d.ts | 76 +++++++++++++ 4 files changed, 224 insertions(+), 3 deletions(-) create mode 100644 socket.io/socket.io-tests.ts create mode 100644 socket.io/socket.io.d.ts diff --git a/socket.io/legacy/socket.io-0.9-tests.ts b/socket.io/legacy/socket.io-0.9-tests.ts index 40f0c6b897..0d7e12bb6d 100644 --- a/socket.io/legacy/socket.io-0.9-tests.ts +++ b/socket.io/legacy/socket.io-0.9-tests.ts @@ -1,4 +1,4 @@ -import io = require('socket.io'); +import io = require('socket.io-0.9'); var socketManager = io.listen(80); diff --git a/socket.io/legacy/socket.io-0.9.d.ts b/socket.io/legacy/socket.io-0.9.d.ts index 44edbb1745..5ead4abde5 100644 --- a/socket.io/legacy/socket.io-0.9.d.ts +++ b/socket.io/legacy/socket.io-0.9.d.ts @@ -4,9 +4,9 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// -declare module "socket.io" { +declare module "socket.io-0.9" { import http = require('http'); export function listen(server: http.Server, options: any, fn: Function): SocketManager; diff --git a/socket.io/socket.io-tests.ts b/socket.io/socket.io-tests.ts new file mode 100644 index 0000000000..442e677751 --- /dev/null +++ b/socket.io/socket.io-tests.ts @@ -0,0 +1,145 @@ +import socketIO = require('socket.io'); + +function testUsingWithNodeHTTPServer() { + var app = require('http').createServer(handler); + var io = socketIO(app); + var fs = require('fs'); + + app.listen(80); + + function handler(req: any, res: any) { + fs.readFile(__dirname + '/index.html', + function (err: any, data: any) { + if (err) { + res.writeHead(500); + return res.end('Error loading index.html'); + } + + res.writeHead(200); + res.end(data); + }); + } + + io.on('connection', function (socket) { + socket.emit('news', { hello: 'world' }); + socket.on('my other event', function (data: any) { + console.log(data); + }); + }); +} + +function testUsingWithExpress() { + var app = require('express')(); + var server = require('http').Server(app); + var io = socketIO(server); + + server.listen(80); + + app.get('/', function (req: any, res: any) { + res.sendfile(__dirname + '/index.html'); + }); + + io.on('connection', function (socket) { + socket.emit('news', { hello: 'world' }); + socket.on('my other event', function (data: any) { + console.log(data); + }); + }); +} + +function testUsingWithTheExpressFramework() { + var app = require('express').createServer(); + var io = socketIO(app); + + app.listen(80); + + app.get('/', function (req: any, res: any) { + res.sendfile(__dirname + '/index.html'); + }); + + io.on('connection', function (socket) { + socket.emit('news', { hello: 'world' }); + socket.on('my other event', function (data: any) { + console.log(data); + }); + }); +} + +function testSendingAndReceivingEvents() { + var io = socketIO(80); + + io.on('connection', function (socket) { + io.emit('this', { will: 'be received by everyone' }); + + socket.on('private message', function (from: any, msg: any) { + console.log('I received a private message by ', from, ' saying ', msg); + }); + + socket.on('disconnect', function () { + io.sockets.emit('user disconnected'); + }); + }); +} + +function testRestrictingYourselfToANamespace() { + var io = socketIO.listen(80); + var chat = io + .of('/chat') + .on('connection', function (socket) { + socket.emit('a message', { + that: 'only' + , '/chat': 'will get' + }); + chat.emit('a message', { + everyone: 'in' + , '/chat': 'will get' + }); + }); + + var news = io + .of('/news') + .on('connection', function (socket) { + socket.emit('item', { news: 'item' }); + }); +} + +function testSendingVolatileMessages() { + var io = socketIO.listen(80); + + io.sockets.on('connection', function (socket) { + var tweets = setInterval(function () { + socket.volatile.emit('bieber tweet', {}); + }, 100); + + socket.on('disconnect', function () { + clearInterval(tweets); + }); + }); +} + +function testSendingAndGettingData() { + var io = socketIO.listen(80); + + io.sockets.on('connection', function (socket) { + socket.on('ferret', function (name: any, fn: any) { + fn('woot'); + }); + }); +} + +function testBroadcastingMessages() { + var io = socketIO.listen(80); + + io.sockets.on('connection', function (socket) { + socket.broadcast.emit('user connected'); + }); +} + +function testUsingItJustAsACrossBrowserWebSocket() { + var io = socketIO.listen(80); + + io.sockets.on('connection', function (socket) { + socket.on('message', function () { }); + socket.on('disconnect', function () { }); + }); +} diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts new file mode 100644 index 0000000000..ddf7ff11bb --- /dev/null +++ b/socket.io/socket.io.d.ts @@ -0,0 +1,76 @@ +// Type definitions for socket.io 1.2.0 +// Project: http://socket.io/ +// Definitions by: PROGRE +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'socket.io' { + var server: SocketIOStatic; + + export = server; +} + +interface SocketIOStatic { + (): SocketIO.Server; + (srv: any, opts?: any): SocketIO.Server; + (port: number, opts?: any): SocketIO.Server; + (opts: any): SocketIO.Server; + + listen: SocketIOStatic; +} + +declare module SocketIO { + interface Server { + serveClient(v: boolean): Server; + path(v: string): Server; + adapter(v: any): Server; + origins(v: string): Server; + sockets: Namespace; + attach(srv: any, opts: any): Server; + attach(port: number, opts: any): Server; + listen(srv: any, opts: any): Server; + listen(port: number, opts: any): Server; + bind(srv: any): Server; + onconnection(socket: any): Server; + of(nsp: String): Namespace; + emit(name: string, ...args: any[]): Socket; + use(fn: Function): Namespace; + + on(event: 'connection', listener: (socket: Socket) => void): any; + on(event: 'connect', listener: (socket: Socket) => void): any; + on(event: string, listener: Function): any; + } + + interface Namespace extends NodeJS.EventEmitter { + name: String; + connected: { [id: number]: Socket }; + use(fn: Function): Namespace + + on(event: 'connection', listener: (socket: Socket) => void): any; + on(event: 'connect', listener: (socket: Socket) => void): any; + on(event: string, listener: Function): any; + } + + interface Socket { + rooms: string[]; + client: Client; + conn: Socket; + request: any; + id: string; + emit(name: string, ...args: any[]): Socket; + join(name: string, fn?: Function): Socket; + leave(name: string, fn?: Function): Socket; + to(room: string): Socket; + in(room: string): Socket; + + on(event: string, listener: Function): any; + broadcast: Socket; + volatile: Socket; + } + + interface Client { + conn: any; + request: any; + } +} From bff52380d69b6736575bc933730c777d5a93ec9e Mon Sep 17 00:00:00 2001 From: progre Date: Tue, 4 Nov 2014 00:11:09 +0900 Subject: [PATCH 08/42] add socket.io-client 1.2.0 --- .../socket.io-client-0.9-commonjs-tests.ts} | 20 +++--- .../legacy/socket.io-client-0.9-tests.ts | 10 +++ .../legacy/socket.io-client-0.9.d.ts | 40 ++++++++++++ socket.io-client/socket.io-client-tests.ts | 61 ++++++++++++++++--- socket.io-client/socket.io-client.d.ts | 56 +++++++++-------- 5 files changed, 145 insertions(+), 42 deletions(-) rename socket.io-client/{socket.io-client-commonjs-tests.ts => legacy/socket.io-client-0.9-commonjs-tests.ts} (81%) create mode 100644 socket.io-client/legacy/socket.io-client-0.9-tests.ts create mode 100644 socket.io-client/legacy/socket.io-client-0.9.d.ts diff --git a/socket.io-client/socket.io-client-commonjs-tests.ts b/socket.io-client/legacy/socket.io-client-0.9-commonjs-tests.ts similarity index 81% rename from socket.io-client/socket.io-client-commonjs-tests.ts rename to socket.io-client/legacy/socket.io-client-0.9-commonjs-tests.ts index 7b5f967473..beb8f0fad5 100644 --- a/socket.io-client/socket.io-client-commonjs-tests.ts +++ b/socket.io-client/legacy/socket.io-client-0.9-commonjs-tests.ts @@ -1,10 +1,10 @@ -import io = require('socket.io-client'); - -var socket = io.connect('http://localhost:80'); - -socket.on('connect', function () { - console.log('Connected!'); - socket.emit('event', 'some test data', function () { - console.log('Sent some data.'); - }); -}); +import io = require('socket.io-client-0.9'); + +var socket = io.connect('http://localhost:80'); + +socket.on('connect', function () { + console.log('Connected!'); + socket.emit('event', 'some test data', function () { + console.log('Sent some data.'); + }); +}); diff --git a/socket.io-client/legacy/socket.io-client-0.9-tests.ts b/socket.io-client/legacy/socket.io-client-0.9-tests.ts new file mode 100644 index 0000000000..7178306281 --- /dev/null +++ b/socket.io-client/legacy/socket.io-client-0.9-tests.ts @@ -0,0 +1,10 @@ +/// + +var socket = io.connect('http://localhost:80'); + +socket.on('connect', function () { + console.log('Connected!'); + socket.emit('event', 'some test data', function () { + console.log('Sent some data.'); + }); +}); diff --git a/socket.io-client/legacy/socket.io-client-0.9.d.ts b/socket.io-client/legacy/socket.io-client-0.9.d.ts new file mode 100644 index 0000000000..0b3626e420 --- /dev/null +++ b/socket.io-client/legacy/socket.io-client-0.9.d.ts @@ -0,0 +1,40 @@ +// Type definitions for socket.io nodejs client +// Project: http://socket.io/ +// Definitions by: Maido Kaara +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "socket.io-client-0.9" { + export = io; +} + +declare var io: SocketIOStatic; + +interface SocketIOStatic { + connect(host: string, details?: any): SocketIOClient.Socket; +} + +declare module SocketIOClient { + interface EventEmitter { + emit(name: string, ...data: any[]): any; + on(ns: string, fn: Function): EventEmitter; + addListener(ns: string, fn: Function): EventEmitter; + removeListener(ns: string, fn: Function): EventEmitter; + removeAllListeners(ns: string): EventEmitter; + once(ns: string, fn: Function): EventEmitter; + listeners(ns: string): Function[]; + } + + interface SocketNamespace extends EventEmitter { + of(name: string): SocketNamespace; + send(data: any, fn: Function): SocketNamespace; + emit(name: string): SocketNamespace; + } + + interface Socket extends EventEmitter { + of(name: string): SocketNamespace; + connect(fn: Function): Socket; + packet(data: any): Socket; + flushBuffer(): void; + disconnect(): Socket; + } +} diff --git a/socket.io-client/socket.io-client-tests.ts b/socket.io-client/socket.io-client-tests.ts index e1022c61af..215932c460 100644 --- a/socket.io-client/socket.io-client-tests.ts +++ b/socket.io-client/socket.io-client-tests.ts @@ -1,10 +1,57 @@ /// -var socket = io.connect('http://localhost:80'); - -socket.on('connect', function () { - console.log('Connected!'); - socket.emit('event', 'some test data', function () { - console.log('Sent some data.'); +function testUsingWithNodeHTTPServer() { + var socket = io('http://localhost'); + socket.on('news', function (data: any) { + console.log(data); + socket.emit('my other event', { my: 'data' }); }); -}); +} + +function testUsingWithExpress() { + var socket = io.connect('http://localhost'); + socket.on('news', function (data: any) { + console.log(data); + socket.emit('my other event', { my: 'data' }); + }); +} + +function testUsingWithTheExpressFramework() { + var socket = io.connect('http://localhost'); + socket.on('news', function (data: any) { + console.log(data); + socket.emit('my other event', { my: 'data' }); + }); +} + +function testRestrictingYourselfToANamespace() { + var chat = io.connect('http://localhost/chat') + , news = io.connect('http://localhost/news'); + + chat.on('connect', function () { + chat.emit('hi!'); + }); + + news.on('news', function () { + news.emit('woot'); + }); +} + +function testSendingAndGettingData() { + var socket = io(); + socket.on('connect', function () { + socket.emit('ferret', 'tobi', function (data: any) { + console.log(data); + }); + }); +} + +function testUsingItJustAsACrossBrowserWebSocket() { + var socket = io('http://localhost/'); + socket.on('connect', function () { + socket.emit('hi'); + + socket.on('message', function (msg: any) { + }); + }); +} diff --git a/socket.io-client/socket.io-client.d.ts b/socket.io-client/socket.io-client.d.ts index 079ca7cbb8..b03cc830bc 100644 --- a/socket.io-client/socket.io-client.d.ts +++ b/socket.io-client/socket.io-client.d.ts @@ -1,40 +1,46 @@ -// Type definitions for socket.io nodejs client +// Type definitions for socket.io-client 1.2.0 // Project: http://socket.io/ -// Definitions by: Maido Kaara +// Definitions by: PROGRE // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module "socket.io-client" { - export = io; +/// + +declare var io: SocketIOClientStatic; + +declare module 'socket.io-client' { + export = io; } -declare var io: SocketIOStatic; - -interface SocketIOStatic { +interface SocketIOClientStatic { + (host: string, details?: any): SocketIOClient.Socket; + (details?: any): SocketIOClient.Socket; connect(host: string, details?: any): SocketIOClient.Socket; + connect(details?: any): SocketIOClient.Socket; + protocol: number; + Socket: { new (...args: any[]): SocketIOClient.Socket }; + Manager: SocketIOClient.ManagerStatic; } declare module SocketIOClient { - interface EventEmitter { - emit(name: string, ...data: any[]): any; - on(ns: string, fn: Function): EventEmitter; - addListener(ns: string, fn: Function): EventEmitter; - removeListener(ns: string, fn: Function): EventEmitter; - removeAllListeners(ns: string): EventEmitter; - once(ns: string, fn: Function): EventEmitter; - listeners(ns: string): Function[]; + interface Socket { + on(event: string, fn: Function): Socket; + once(event: string, fn: Function): Socket; + off(event: string, fn: Function): Socket; + emit(event: string, ...args: any[]): Socket; + listeners(event: string): Function[]; + hasListeners(event: string): boolean; } - interface SocketNamespace extends EventEmitter { - of(name: string): SocketNamespace; - send(data: any, fn: Function): SocketNamespace; - emit(name: string): SocketNamespace; + interface ManagerStatic { + (url: string, opts: any): SocketIOClient.Manager; + new (url: string, opts: any): SocketIOClient.Manager; } - interface Socket extends EventEmitter { - of(name: string): SocketNamespace; - connect(fn: Function): Socket; - packet(data: any): Socket; - flushBuffer(): void; - disconnect(): Socket; + interface Manager { + reconnection(v: boolean): Manager; + reconnectionAttempts(v: boolean): Manager; + reconnectionDelay(v: boolean): Manager; + reconnectionDelayMax(v: boolean): Manager; + timeout(v: boolean): Manager; } } From 17df17872947da251560c3ba61f8a4cbf051bc5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20De=20Saint=20Florent?= Date: Mon, 3 Nov 2014 17:08:23 -0500 Subject: [PATCH 09/42] Update Q.d.ts with optional onRejected parameter Spread method does not require onRejected param. From Q documentation: function eventualAdd(a, b) { return Q.spread([a, b], function (a, b) { return a + b; }) } --- q/Q.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/q/Q.d.ts b/q/Q.d.ts index 3e7371ead2..59e891c527 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -248,43 +248,43 @@ declare module Q { * Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason. * This is especially useful in conjunction with all. */ - export function spread(promises: any[], onFulfilled: (...args: any[]) => IPromise, onRejected: (reason: any) => IPromise): Promise; + export function spread(promises: any[], onFulfilled: (...args: any[]) => IPromise, onRejected?: (reason: any) => IPromise): Promise; /** * Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason. * This is especially useful in conjunction with all. */ - export function spread(promises: any[], onFulfilled: (...args: any[]) => IPromise, onRejected: (reason: any) => U): Promise; + export function spread(promises: any[], onFulfilled: (...args: any[]) => IPromise, onRejected?: (reason: any) => U): Promise; /** * Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason. * This is especially useful in conjunction with all. */ - export function spread(promises: any[], onFulfilled: (...args: any[]) => U, onRejected: (reason: any) => IPromise): Promise; + export function spread(promises: any[], onFulfilled: (...args: any[]) => U, onRejected?: (reason: any) => IPromise): Promise; /** * Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason. * This is especially useful in conjunction with all. */ - export function spread(promises: any[], onFulfilled: (...args: any[]) => U, onRejected: (reason: any) => U): Promise; + export function spread(promises: any[], onFulfilled: (...args: any[]) => U, onRejected?: (reason: any) => U): Promise; /** * Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason. * This is especially useful in conjunction with all. */ - export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => IPromise, onRejected: (reason: any) => IPromise): Promise; + export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => IPromise, onRejected?: (reason: any) => IPromise): Promise; /** * Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason. * This is especially useful in conjunction with all. */ - export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => IPromise, onRejected: (reason: any) => U): Promise; + export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => IPromise, onRejected?: (reason: any) => U): Promise; /** * Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason. * This is especially useful in conjunction with all. */ - export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => U, onRejected: (reason: any) => IPromise): Promise; + export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => U, onRejected?: (reason: any) => IPromise): Promise; /** * Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason. * This is especially useful in conjunction with all. */ - export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => U, onRejected: (reason: any) => U): Promise; + export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => U, onRejected?: (reason: any) => U): Promise; /** * Returns a promise that will have the same result as promise, except that if promise is not fulfilled or rejected before ms milliseconds, the returned promise will be rejected with an Error with the given message. If message is not supplied, the message will be "Timed out after " + ms + " ms". From 5559466c5484bec46643fa9ff980f5aa0552d370 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Tue, 4 Nov 2014 19:08:20 +0900 Subject: [PATCH 10/42] update typefiles --- superagent/superagent.d.ts | 2 ++ supertest/supertest-tests.ts | 29 +++++++++++++++++++++- supertest/supertest.d.ts | 47 +++++++++++++++++++++++++++++------- 3 files changed, 68 insertions(+), 10 deletions(-) diff --git a/superagent/superagent.d.ts b/superagent/superagent.d.ts index 9e6f9c4b5b..0abed74380 100644 --- a/superagent/superagent.d.ts +++ b/superagent/superagent.d.ts @@ -79,6 +79,8 @@ declare module "superagent" { subscribe(url: string, callback?: (err: Error, res: Response) => void): Request; unsubscribe(url: string, callback?: (err: Error, res: Response) => void): Request; patch(url: string, callback?: (err: Error, res: Response) => void): Request; + search(url: string, callback?: (err: Error, res: Response) => void): Request; + connect(url: string, callback?: (err: Error, res: Response) => void): Request; parse(fn: Function): Request; saveCookies(res: Response): void; attachCookies(req: Request): void; diff --git a/supertest/supertest-tests.ts b/supertest/supertest-tests.ts index c4bdfb2711..120cb43c00 100644 --- a/supertest/supertest-tests.ts +++ b/supertest/supertest-tests.ts @@ -29,4 +29,31 @@ request req.expect(200, (err, res) => { if (err) throw err; }); - }); \ No newline at end of file + }); + +// cookie scenario, new version +var client = supertest.agent(app); +client + .post('/login') + .end((err, res) => { + if (err) throw err; + + client.get('/admin') + .expect(200, (err, res) => { + if (err) throw err; + }); + }); + +// functional expect +supertest(app) + .get('/') + .expect(hasPreviousAndNextKeys) + .end((err, res) => { + if (err) throw err; + }); + +function hasPreviousAndNextKeys(res: supertest.Response) { + if (!('next' in res.body)) return "missing next key"; + if (!('prev' in res.body)) throw new Error("missing prev key"); +} + diff --git a/supertest/supertest.d.ts b/supertest/supertest.d.ts index 9b60431f06..075102a53f 100644 --- a/supertest/supertest.d.ts +++ b/supertest/supertest.d.ts @@ -1,4 +1,4 @@ -// Type definitions for SuperTest 0.8.0 +// Type definitions for SuperTest 0.14.0 // Project: https://github.com/visionmedia/supertest // Definitions by: Alex Varju // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -12,19 +12,21 @@ declare module "supertest" { interface Test extends superagent.Request { url: string; serverAddress(app: any, path: string): string; - expect(status: number, callback?: (err: Error, res: superagent.Response) => void): Test; - expect(status: number, body: string, callback?: (err: Error, res: superagent.Response) => void): Test; - expect(body: string, callback?: (err: Error, res: superagent.Response) => void): Test; - expect(body: RegExp, callback?: (err: Error, res: superagent.Response) => void): Test; - expect(body: Object, callback?: (err: Error, res: superagent.Response) => void): Test; - expect(field: string, val: string, callback?: (err: Error, res: superagent.Response) => void): Test; - expect(field: string, val: RegExp, callback?: (err: Error, res: superagent.Response) => void): Test; + expect(status: number, callback?: (err: Error, res: Response) => void): Test; + expect(status: number, body: string, callback?: (err: Error, res: Response) => void): Test; + expect(body: string, callback?: (err: Error, res: Response) => void): Test; + expect(body: RegExp, callback?: (err: Error, res: Response) => void): Test; + expect(body: Object, callback?: (err: Error, res: Response) => void): Test; + expect(field: string, val: string, callback?: (err: Error, res: Response) => void): Test; + expect(field: string, val: RegExp, callback?: (err: Error, res: Response) => void): Test; + expect(checker: (res: Response) => any): Test; set(field: string, val: string): Test; set(field: Object): Test; query(val: Object): Test; send(data: string): Test; send(data: Object): Test; } + interface Response extends superagent.Response {} interface SuperTest { get(url: string): Test; @@ -52,7 +54,34 @@ declare module "supertest" { patch(url: string): Test; } - function agent(): superagent.Agent; + interface TestAgent extends superagent.Agent { + get(url: string, callback?: (err: Error, res: Response) => void): Test; + post(url: string, callback?: (err: Error, res: Response) => void): Test; + put(url: string, callback?: (err: Error, res: Response) => void): Test; + head(url: string, callback?: (err: Error, res: Response) => void): Test; + del(url: string, callback?: (err: Error, res: Response) => void): Test; + options(url: string, callback?: (err: Error, res: Response) => void): Test; + trace(url: string, callback?: (err: Error, res: Response) => void): Test; + copy(url: string, callback?: (err: Error, res: Response) => void): Test; + lock(url: string, callback?: (err: Error, res: Response) => void): Test; + mkcol(url: string, callback?: (err: Error, res: Response) => void): Test; + move(url: string, callback?: (err: Error, res: Response) => void): Test; + propfind(url: string, callback?: (err: Error, res: Response) => void): Test; + proppatch(url: string, callback?: (err: Error, res: Response) => void): Test; + unlock(url: string, callback?: (err: Error, res: Response) => void): Test; + report(url: string, callback?: (err: Error, res: Response) => void): Test; + mkactivity(url: string, callback?: (err: Error, res: Response) => void): Test; + checkout(url: string, callback?: (err: Error, res: Response) => void): Test; + merge(url: string, callback?: (err: Error, res: Response) => void): Test; + //m-search(url: string, callback?: (err: Error, res: Response) => void): Test; + notify(url: string, callback?: (err: Error, res: Response) => void): Test; + subscribe(url: string, callback?: (err: Error, res: Response) => void): Test; + unsubscribe(url: string, callback?: (err: Error, res: Response) => void): Test; + patch(url: string, callback?: (err: Error, res: Response) => void): Test; + search(url: string, callback?: (err: Error, res: Response) => void): Test; + connect(url: string, callback?: (err: Error, res: Response) => void): Test; + } + function agent(app?: any): supertest.TestAgent; } function supertest(app: any): supertest.SuperTest; From 56bdc23f7832bd2563a58d08f41f102e49d294c8 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Tue, 4 Nov 2014 21:15:58 +0900 Subject: [PATCH 11/42] add agent methods --- supertest/supertest.d.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/supertest/supertest.d.ts b/supertest/supertest.d.ts index 075102a53f..cb2bb78b30 100644 --- a/supertest/supertest.d.ts +++ b/supertest/supertest.d.ts @@ -20,11 +20,22 @@ declare module "supertest" { expect(field: string, val: string, callback?: (err: Error, res: Response) => void): Test; expect(field: string, val: RegExp, callback?: (err: Error, res: Response) => void): Test; expect(checker: (res: Response) => any): Test; + + attach(field: string, file: string, filename: string): Test; + redirects(n: number): Test; + part(): Test; set(field: string, val: string): Test; set(field: Object): Test; + type(val: string): Test; query(val: Object): Test; send(data: string): Test; send(data: Object): Test; + buffer(val: boolean): Test; + timeout(ms: number): Test; + clearTimeout(): Test; + auth(user: string, name: string): Test; + field(name: string, val: string): Test; + end(callback?: (err: Error, res: Response) => void): Test; } interface Response extends superagent.Response {} From bf24c30aaa7d87e683ef781abd18702b441b6e54 Mon Sep 17 00:00:00 2001 From: Josh Smith Date: Tue, 4 Nov 2014 12:21:55 -0800 Subject: [PATCH 12/42] Update TestUtils.findRenderedComponentWithType This function gets that actual React component rather than the element. This allows the tester to call functions like setState on the component as shown in the new test. --- react-addons/react-addons-tests.ts | 20 +++++++++++++------- react-addons/react-addons.d.ts | 5 +++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/react-addons/react-addons-tests.ts b/react-addons/react-addons-tests.ts index 4834d6e23d..7a835dfebe 100644 --- a/react-addons/react-addons-tests.ts +++ b/react-addons/react-addons-tests.ts @@ -113,21 +113,27 @@ React.addons.TestUtils.Simulate.click(node); React.addons.TestUtils.Simulate.change(node); React.addons.TestUtils.Simulate.keyDown(node, {key: "Enter"}); -var GoodbyeMessage = React.createClass({displayName: 'GoodbyeMessage', +var Greeting = React.createClass({displayName: 'Greeting', + getInitialState: function() { + return {morning: true}; + }, render: function() { - return React.DOM.div(null, "Goodbye ", (>this).props.name); + var me = >this; + return React.DOM.div(null, (me.state.morning ? "Hello" : "Goodbye "), me.props.name); } }); -React.addons.TestUtils.renderIntoDocument(GoodbyeMessage({name: "John"})); + +var root = React.addons.TestUtils.renderIntoDocument(Greeting({name: "John"})); +var greeting = React.addons.TestUtils.findRenderedComponentWithType(root, Greeting); +greeting.setState({ + morning: false +}); var isImportant: boolean; var isRead: boolean; var cx = React.addons.classSet; -var classes = cx({ +var classes: string = cx({ 'message': true, 'message-important': isImportant, 'message-read': isRead }); - - - diff --git a/react-addons/react-addons.d.ts b/react-addons/react-addons.d.ts index 35fc5f1fb9..686dd05632 100644 --- a/react-addons/react-addons.d.ts +++ b/react-addons/react-addons.d.ts @@ -93,8 +93,9 @@ declare module React { findRenderedDOMComponentWithClass(tree: ReactElement, className: string): ReactElement; scryRenderedDOMComponentsWithTag(tree: ReactElement, className: string): ReactElement[]; findRenderedDOMComponentWithTag(tree: ReactElement, tagName: string): ReactElement; - scryFindRenderedComponentsWithTag(tree: ReactElement, componentClass: Function): ReactElement[]; - findRenderedComponentWithType(tree: ReactElement, componentClass: Function): ReactElement; + scryRenderedComponentsWithTag(tree: ReactElement, componentClass: Function): ReactElement[]; + findRenderedComponentWithType

(tree: ReactElement, componentClass: ReactComponentFactory

): Component; + scryRenderedComponentsWithType

(tree: ReactElement, componentClass: ReactComponentFactory

): Component[]; } export interface SyntheticEventData { From 5c44d00ca60516e637e93283eb0ca02bc0781a78 Mon Sep 17 00:00:00 2001 From: Yang Guan Date: Tue, 4 Nov 2014 15:18:20 -0800 Subject: [PATCH 13/42] Correct a comment --- heatmap.js/heatmap.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heatmap.js/heatmap.d.ts b/heatmap.js/heatmap.d.ts index bff76db98f..04b038c25b 100644 --- a/heatmap.js/heatmap.d.ts +++ b/heatmap.js/heatmap.d.ts @@ -27,8 +27,8 @@ interface HeatmapConfiguration { radius?: number; /* - * The radius each datapoint will have (if not specified on the datapoint - * itself) + * Indicate whether the heatmap should use a global extrema or a local + * extrema (the maximum and minimum of the currently displayed viewport) */ useLocalExtrema?: boolean; From 0a16b7f522b801a0eb741eea4cf9ed74d5f67e1f Mon Sep 17 00:00:00 2001 From: Yang Guan Date: Tue, 4 Nov 2014 17:00:14 -0800 Subject: [PATCH 14/42] Put variables into alphabetical order --- heatmap.js/heatmap.d.ts | 78 ++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/heatmap.js/heatmap.d.ts b/heatmap.js/heatmap.d.ts index 04b038c25b..012e3f9d9f 100644 --- a/heatmap.js/heatmap.d.ts +++ b/heatmap.js/heatmap.d.ts @@ -15,28 +15,29 @@ interface HeatmapConfiguration { */ backgroundColor?: string; + /* + * The blur factor that will be applied to all datapoints. The higher the + * blur factor is, the smoother the gradients will be + * Default value: 0.85 + */ + blur?: number; + /* * An object that represents the gradient */ gradient?: any; /* - * The radius each datapoint will have (if not specified on the datapoint - * itself) + * The property name of your latitude coordinate in a datapoint + * Default value: 'x' */ - radius?: number; + latField?: string; /* - * Indicate whether the heatmap should use a global extrema or a local - * extrema (the maximum and minimum of the currently displayed viewport) + * The property name of your longitude coordinate in a datapoint + * Default value: 'y' */ - useLocalExtrema?: boolean; - - /* - * A global opacity for the whole heatmap. This overrides maxOpacity and - * minOpacity if set - */ - opacity?: number; + lngField?: string; /* * The maximal opacity the highest value in the heatmap will have. (will be @@ -52,26 +53,25 @@ interface HeatmapConfiguration { minOpacity?: number; /* - * The blur factor that will be applied to all datapoints. The higher the - * blur factor is, the smoother the gradients will be - * Default value: 0.85 + * A global opacity for the whole heatmap. This overrides maxOpacity and + * minOpacity if set */ - blur?: number; + opacity?: number; /* - * The property name of your latitude coordinate in a datapoint - * Default value: 'x' + * The radius each datapoint will have (if not specified on the datapoint + * itself) */ - latField?: string; + radius?: number; /* - * The property name of your longitude coordinate in a datapoint - * Default value: 'y' + * Indicate whether the heatmap should use a global extrema or a local + * extrema (the maximum and minimum of the currently displayed viewport) */ - lngField?: string; + useLocalExtrema?: boolean; /* - * The property name of your y coordinate in a datapoint + * The property name of the value/weight in a datapoint */ valueField: string; } @@ -81,28 +81,28 @@ interface HeatmapConfiguration { * HeatmapConfig.latField, HeatmapConfig.lngField and HeatmapConfig.valueField */ interface HeatmapDataPoint { - [index: string] : number; + [index: string]: number; } /* - * An object representing the set of data points on a heatmap. + * An object representing the set of data points on a heatmap */ -interface HeatmapDataObject { - - /* - * Max value of of the valueField - */ - max?: number; - - /* - * Min value of of the valueField - */ - min?: number; +interface HeatmapData { /* * An array of HeatmapDataPoints */ data: HeatmapDataPoint[]; + + /* + * Max value of the valueField + */ + max?: number; + + /* + * Min value of the valueField + */ + min?: number; } /* @@ -116,8 +116,8 @@ declare class HeatmapOverlay { constructor(configuration: HeatmapConfiguration) /* - * Create DOM elements for othe overlay, adding them to map panes and - * puts listeners on relevant map events + * Create DOM elements for an overlay, adding them to map panes and puts + * listeners on relevant map events */ onAdd(map: L.Map): void; @@ -130,5 +130,5 @@ declare class HeatmapOverlay { /* * Initialize a heatmap instance with the given dataset */ - setData(data: {}): void; + setData(data: HeatmapData): void; } From a3c57a84a51084b829196437416e5eed8d665496 Mon Sep 17 00:00:00 2001 From: Vinayak Garg Date: Wed, 5 Nov 2014 15:01:00 +0530 Subject: [PATCH 15/42] Added test file --- jquery.rowGrid/jquery.rowGrid-tests.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 jquery.rowGrid/jquery.rowGrid-tests.ts diff --git a/jquery.rowGrid/jquery.rowGrid-tests.ts b/jquery.rowGrid/jquery.rowGrid-tests.ts new file mode 100644 index 0000000000..be4cb443eb --- /dev/null +++ b/jquery.rowGrid/jquery.rowGrid-tests.ts @@ -0,0 +1,24 @@ +/// +/// + +/* + * Testing different options + */ + +var options = { + minMargin: 10, + maxMargin: 35, + itemSelector: ".item" +}; + +$(".container").rowGrid(options); + + +/* + * Test endless scrolling + */ + +// append new items +$(".container").append("

"); +// arrange appended items +$(".container").rowGrid("appended"); \ No newline at end of file From f71c594fb6fdb84bf7fd28d8cda58a5ac40584a1 Mon Sep 17 00:00:00 2001 From: Vinayak Garg Date: Wed, 5 Nov 2014 15:08:15 +0530 Subject: [PATCH 16/42] Fixed the comment --- jquery.rowGrid/jquery.rowGrid-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.rowGrid/jquery.rowGrid-tests.ts b/jquery.rowGrid/jquery.rowGrid-tests.ts index be4cb443eb..cb11d65964 100644 --- a/jquery.rowGrid/jquery.rowGrid-tests.ts +++ b/jquery.rowGrid/jquery.rowGrid-tests.ts @@ -2,7 +2,7 @@ /// /* - * Testing different options + * Test different options */ var options = { From de91990ef21174f371ab250f68ce6ab5fb641285 Mon Sep 17 00:00:00 2001 From: Vinayak Garg Date: Mon, 3 Nov 2014 19:50:00 +0530 Subject: [PATCH 17/42] Added interface for rowGrid.js --- jquery.rowGrid/jquery.rowGrid.d.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 jquery.rowGrid/jquery.rowGrid.d.ts diff --git a/jquery.rowGrid/jquery.rowGrid.d.ts b/jquery.rowGrid/jquery.rowGrid.d.ts new file mode 100644 index 0000000000..4b136d2bac --- /dev/null +++ b/jquery.rowGrid/jquery.rowGrid.d.ts @@ -0,0 +1,17 @@ +// Type definitions for jQuery rowGrid.js plugin (v1.0.2) +// Project: https://github.com/brunjo/rowGrid.js +// Definitions by: Vinayak Garg +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface JQueryRowGridJSOptions { + minMargin?: number; + maxMargin?: number; + itemSelector: string; +} + +interface JQuery { + rowGrid(options?: JQueryRowGridJSOptions): JQuery; + rowGrid(appended: string): JQuery; +} \ No newline at end of file From b4145190265c07661b17b0c15a6fa127fd4d39ba Mon Sep 17 00:00:00 2001 From: Vinayak Garg Date: Mon, 3 Nov 2014 20:02:55 +0530 Subject: [PATCH 18/42] Added name in CONTRIBUTORS.md --- CONTRIBUTORS.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 9d27a0d1d4..639abfb7aa 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -63,7 +63,7 @@ All definitions files include a header with the author and editors, so at some p * [Clone](https://github.com/pvorb/node-clone) (by [Kieran Simpson](https://github.com/kierans)) * [CodeMirror](http://codemirror.net) (by [François de Campredon](https://github.com/fdecampredon)) * [Commander](http://github.com/visionmedia/commander.js) (by [Marcelo Dezem](https://github.com/mdezem) and [vvakame](https://github.com/vvakame)) -* [configstore](http://github.com/yeoman/configstore) (by [Bart van der Schoor](https://github.com/Bartvds)) +* [configstore](http://github.com/yeoman/configstore) (by [Bart van der Schoor](https://github.com/Bartvds)) * [cookie](https://github.com/jshttp/cookie) (by [Pine Mizune](https://github.com/jshttp/cookie)) * [Cordova](http://cordova.apache.org) (by [Microsoft Open Technologies, Inc.](http://msopentech.com/)) * [Cordovarduino](https://github.com/stereolux/cordovarduino) (by [Hendrik Maus](https://github.com/hendrikmaus)) @@ -207,6 +207,7 @@ All definitions files include a header with the author and editors, so at some p * [jQuery.pnotify](http://sciactive.github.io/pnotify/) (by [David Sichau](https://github.com/DavidSichau/)) * [jQuery.postMessage](http://benalman.com/projects/jquery-postmessage-plugin/) (by [Junle Li](https://github.com/lijunle)) * [jQuery.prettyphoto](https://github.com/scaron/prettyphoto) (by [Paul Gaske](https://github.com/pgaske)) +* [jQuery.rowGrid](https://github.com/brunjo/rowGrid.js) (by [Vinayak Garg](https://github.com/vinayak-garg)) * [jQuery.scrollTo](https://github.com/flesler/jquery.scrollTo) (by [Neil Stalker](https://github.com/nestalk/)) * [jQuery.simplePagination](https://github.com/flaviusmatis/simplePagination.js) (by [Natan Vivo](https://github.com/nvivo/)) * [jquery.superLink](http://james.padolsey.com/demos/plugins/jQuery/superLink/superlink.jquery.js) (by [Blake Niemyjski](https://github.com/niemyjski)) @@ -248,7 +249,7 @@ All definitions files include a header with the author and editors, so at some p * [Knockout.Mapper](https://github.com/LucasLorentz/knockout.mapper) (by [Brandon Meyer](https://github.com/BMeyerKC)) * [Knockout.Mapping](https://github.com/SteveSanderson/knockout.mapping) (by [Boris Yankov](https://github.com/borisyankov)) * [Knockout.Postbox](https://github.com/rniemeyer/knockout-postbox) (by [Judah Gabriel Himango](https://github.com/JudahGabriel)) -* [Knockout.Rx](https://github.com/Igorbek/knockout.rx) (by [Igor Oleinikov](https://github.com/Igorbek)) +* [Knockout.Rx](https://github.com/Igorbek/knockout.rx) (by [Igor Oleinikov](https://github.com/Igorbek)) * [Knockout Secure Binding](https://github.com/brianmhunt/knockout-secure-binding) (by [Pine Mizune](https://github.com/pine613)) * [Knockout.Validation](https://github.com/ericmbarnard/Knockout-Validation) (by [Dan Ludwig](https://github.com/danludwig)) * [Knockout.Viewmodel](http://coderenaissance.github.com/knockout.viewmodel/) (by [Oisin Grehan](https://github.com/oising)) @@ -326,9 +327,9 @@ All definitions files include a header with the author and editors, so at some p * [PDF.js](https://github.com/mozilla/pdf.js) (by [Josh Baldwin](https://github.com/jbaldwin)) * [PeerJS](http://peerjs.com/) (by [Toshiya Nakakura](https://github.com/nakakura)) * [PEG.js](http://pegjs.majda.cz/) (by [vvakame](https://github.com/vvakame)) -* [Persona](http://www.mozilla.org/en-US/persona) (by [James Frasca](https://github.com/Nycto)) -* [PgwModal](http://pgwjs.com/pgwmodal/) (by [Pine Mizune](https://github.com/pine613)) -* [PhantomJS](http://phantomjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker)) +* [Persona](http://www.mozilla.org/en-US/persona) (by [James Frasca](https://github.com/Nycto)) +* [PgwModal](http://pgwjs.com/pgwmodal/) (by [Pine Mizune](https://github.com/pine613)) +* [PhantomJS](http://phantomjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker)) * [PhoneGap](http://phonegap.com) (by [Boris Yankov](https://github.com/borisyankov)) * [Physijs](http://chandlerprall.github.io/Physijs/) (by [gyoh_k](https://github.com/gyohk)) * [Pickadate.js](https://github.com/amsul/pickadate.js) (by [Adi Dahiya](https://github.com/adidahiya)) From e9fa156a9c870c34dc98243e9bf9d20b83ecac1b Mon Sep 17 00:00:00 2001 From: Vinayak Garg Date: Wed, 5 Nov 2014 15:01:00 +0530 Subject: [PATCH 19/42] Added test file --- jquery.rowGrid/jquery.rowGrid-tests.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 jquery.rowGrid/jquery.rowGrid-tests.ts diff --git a/jquery.rowGrid/jquery.rowGrid-tests.ts b/jquery.rowGrid/jquery.rowGrid-tests.ts new file mode 100644 index 0000000000..be4cb443eb --- /dev/null +++ b/jquery.rowGrid/jquery.rowGrid-tests.ts @@ -0,0 +1,24 @@ +/// +/// + +/* + * Testing different options + */ + +var options = { + minMargin: 10, + maxMargin: 35, + itemSelector: ".item" +}; + +$(".container").rowGrid(options); + + +/* + * Test endless scrolling + */ + +// append new items +$(".container").append("
"); +// arrange appended items +$(".container").rowGrid("appended"); \ No newline at end of file From 8e017781ba31f23baf611a556db312a0b5545bd6 Mon Sep 17 00:00:00 2001 From: Vinayak Garg Date: Wed, 5 Nov 2014 15:08:15 +0530 Subject: [PATCH 20/42] Fixed the comment --- jquery.rowGrid/jquery.rowGrid-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.rowGrid/jquery.rowGrid-tests.ts b/jquery.rowGrid/jquery.rowGrid-tests.ts index be4cb443eb..cb11d65964 100644 --- a/jquery.rowGrid/jquery.rowGrid-tests.ts +++ b/jquery.rowGrid/jquery.rowGrid-tests.ts @@ -2,7 +2,7 @@ /// /* - * Testing different options + * Test different options */ var options = { From f4c08ac9ea9ab6ed3f29b8f74082cf5d011eeece Mon Sep 17 00:00:00 2001 From: armorik83 Date: Thu, 6 Nov 2014 00:12:16 +0900 Subject: [PATCH 21/42] add yeoman-generator/yeoman-generator.d.ts --- yeoman-generator/yeoman-generator-tests.ts | 114 +++++++++++++++++ yeoman-generator/yeoman-generator.d.ts | 141 +++++++++++++++++++++ 2 files changed, 255 insertions(+) create mode 100644 yeoman-generator/yeoman-generator-tests.ts create mode 100644 yeoman-generator/yeoman-generator.d.ts diff --git a/yeoman-generator/yeoman-generator-tests.ts b/yeoman-generator/yeoman-generator-tests.ts new file mode 100644 index 0000000000..84f0072065 --- /dev/null +++ b/yeoman-generator/yeoman-generator-tests.ts @@ -0,0 +1,114 @@ +/// +import yeoman = require('yeoman-generator'); + +var base = yeoman.generators.Base; +var namedBase = yeoman.generators.NamedBase; + +var generator = base.extend({ + initializing: function() { + return; + }, + writing: { + app: function() { + return; + }, + other: function() { + return; + } + }, + end: function() { + return; + } +}); + +generator.argument('name', { + desc: 'desc', + required: true, + optional: true, + type: 'any', + defaults: 'any', +}); + +var compose = generator.composeWith('namespace', 'any', { + local: 'local', + link: 'link' +}); + +compose.defaultFor('name'); +compose.destinationRoot('rootPath') === 'string'; +compose.determineAppname(); +compose.getCollisionFilter()('output'); +compose.hookFor('name', { + as: 'string', + args: 'any', + options: 'any' +}); +compose.option('name', { + alias: 'string', + defaults: 'any', + desc: 'string', + hide: true, + type: 'any' +}); +var returnString: boolean; +returnString = compose.rootGeneratorName() === 'string'; +compose.run('args'); +compose.run('args', () => { + return; +}); +compose.runHooks(() => { + return; +}); +returnString = compose.sourceRoot('rootPath') === 'string'; + +var assert = yeoman.assert; + +assert.file('path'); +assert.file(['paths', 'paths']); +assert.fileContent('file', /.*/); +assert.fileContent([ + ['string', /.*/], + ['string', /.*/], + ['string', /.*/] +]); +assert.files([ + ['string', /.*/], + 'string', + ['string', /.*/], + 'string' +]); +assert.implement('subject', 'methods'); +assert.noFile('file'); +assert.noFileContent('file', /.*/); +assert.noFileContent([ + ['string', /.*/], + ['string', /.*/], + ['string', /.*/] +]); +assert.noImplement('subject', 'methods'); +assert.textEqual('value', 'expected'); + +var test = yeoman.test; +var dummyGen = test.createDummyGenerator(); +dummyGen.determineAppname(); + +var createdGen = test.createGenerator('name', ['any', 'amy'], 'args', 'options'); +createdGen.determineAppname(); + +test.decorate('context', 'method', () => { + return; // replacement +}, 'options'); +test.gruntfile('options', () => { + return; // done +}); +test.mockPrompt(createdGen, 'answers'); +test.registerDependencies(['dependencies', 'dependencies']); +test.restore(); +var runContext = test.run('generator'); + +runContext.async()(); +runContext.inDir('dirPath') + .withArguments('args') + .withGenerators(['deps', 'deps']) + .withOptions('opts') + .withPrompts('answers'); diff --git a/yeoman-generator/yeoman-generator.d.ts b/yeoman-generator/yeoman-generator.d.ts new file mode 100644 index 0000000000..aed7a8f034 --- /dev/null +++ b/yeoman-generator/yeoman-generator.d.ts @@ -0,0 +1,141 @@ +// Type definitions for yeoman-generator +// Project: https://github.com/yeoman/generator +// Definitions by: Kentaro Okuno +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module yo { + export interface IYeomanGenerator { + argument(name: string, config: IArgumentConfig): void; + composeWith(namespace: string, options: any, settings?: IComposeSetting): IYeomanGenerator; + defaultFor(name: string): void; + destinationRoot(rootPath: string): string; + determineAppname(): void; + getCollisionFilter(): (output: any) => void; + hookFor(name: string, config: IHookConfig): void; + option(name: string, config: IYeomanGeneratorOption): void; + rootGeneratorName(): string; + run(args?: any): void; + run(args: any, callback?: Function): void; + runHooks(callback?: Function): void; + sourceRoot(rootPath: string): string; + } + + export interface IArgumentConfig { + desc: string; + required: boolean; + optional: boolean; + type: any; + defaults: any; + } + + export interface IComposeSetting { + local?: string; + link?: string; + } + + export interface IHookConfig { + as: string; + args: any; + options: any; + } + + export interface IYeomanGeneratorOption { + alias: string; + defaults: any; + desc: string; + hide: boolean; + type: any; + } + + export interface IQueueProps { + initializing: () => void; + prompting?: () => void; + configuring?: () => void; + default?: () => void; + writing: { + [target: string]: () => void; + }; + conflicts?: () => void; + install?: () => void; + end: () => void; + } + + export interface IBase { + new(args: string, options: any): IYeomanGenerator; + new(args: string[], options: any): IYeomanGenerator; + extend(protoProps: IQueueProps, staticProps?: any): IYeomanGenerator; + } + + export interface INamedBase { + new(args: string, options: any): IYeomanGenerator; + new(args: string[], options: any): IYeomanGenerator; + } + + export interface IAssert { + file(path: string): void; + file(paths: string[]): void; + fileContent(file: string, reg: RegExp): void; + + /** @param {[String, RegExp][]} pairs */ + fileContent(pairs: any[][]): void; + + /** @param {[String, RegExp][]|String[]} pairs */ + files(pairs: any[]): void; + + /** + * @param {Object} subject + * @param {Object|Array} methods + */ + implement(subject: any, methods: any): void; + noFile(file: string): void; + noFileContent(file: string, reg: RegExp): void; + + /** @param {[String, RegExp][]} pairs */ + noFileContent(pairs: any[][]): void; + + /** + * @param {Object} subject + * @param {Object|Array} methods + */ + noImplement(subject: any, methods: any): void; + + textEqual(value: string, expected: string): void; + } + + export interface ITestHelper { + createDummyGenerator(): IYeomanGenerator; + createGenerator(name: string, dependencies: any[], args: any, options: any): IYeomanGenerator; + decorate(context: any, method: string, replacement: Function, options: any): void; + gruntfile(options: any, done: Function): void; + mockPrompt(generator: IYeomanGenerator, answers: any): void; + registerDependencies(dependencies: string[]): void; + restore(): void; + + /** @param {String|Function} generator */ + run(generator: any): IRunContext; + } + + export interface IRunContext { + async(): Function; + inDir(dirPath: string): IRunContext; + + /** @param {String|String[]} args */ + withArguments(args: any): IRunContext; + withGenerators(dependencies: string[]): IRunContext; + withOptions(options: any): IRunContext; + withPrompts(answers: any): IRunContext; + } + + /** @type file file-utils */ + var file: any; + var assert: IAssert; + var test: ITestHelper; + var generators: { + Base: IBase; + NamedBase: INamedBase; + }; +} + +declare module "yeoman-generator" { + export = yo; +} From 0ddb142d5104efae4b45b76abe6d788396b498ee Mon Sep 17 00:00:00 2001 From: armorik83 Date: Thu, 6 Nov 2014 01:04:01 +0900 Subject: [PATCH 22/42] add yosay/yosay.d.ts --- yosay/yosay-tests.ts | 3 +++ yosay/yosay.d.ts | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 yosay/yosay-tests.ts create mode 100644 yosay/yosay.d.ts diff --git a/yosay/yosay-tests.ts b/yosay/yosay-tests.ts new file mode 100644 index 0000000000..257b546eae --- /dev/null +++ b/yosay/yosay-tests.ts @@ -0,0 +1,3 @@ +/// +import yosay = require('yosay'); +yosay('Welcome to the generator!', {maxLength: 20}); \ No newline at end of file diff --git a/yosay/yosay.d.ts b/yosay/yosay.d.ts new file mode 100644 index 0000000000..a46049e102 --- /dev/null +++ b/yosay/yosay.d.ts @@ -0,0 +1,9 @@ +// Type definitions for yosay +// Project: https://github.com/yeoman/yosay +// Definitions by: Kentaro Okuno +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'yosay' { + function yosay(message?: string, options?: {maxLength: number}): string; + export = yosay; +} \ No newline at end of file From 779d3e58b6d77cb0f1bcb9f7b5b56013a4ed99ae Mon Sep 17 00:00:00 2001 From: in-async Date: Thu, 6 Nov 2014 01:38:27 +0900 Subject: [PATCH 23/42] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=82=B3?= =?UTF-8?q?=E3=83=BC=E3=83=89=E3=81=AE=E6=9B=B4=E6=96=B0=E9=80=94=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- angularfire/angularfire-tests.ts | 45 ++++++++++++++++++++------- angularfire/angularfire.d.ts | 52 ++++++++++++++++++++++++-------- 2 files changed, 74 insertions(+), 23 deletions(-) diff --git a/angularfire/angularfire-tests.ts b/angularfire/angularfire-tests.ts index eced9d7fe7..74a6c5a302 100644 --- a/angularfire/angularfire-tests.ts +++ b/angularfire/angularfire-tests.ts @@ -3,7 +3,7 @@ var myapp = angular.module("myapp", ["firebase"]); interface AngularFireScope extends ng.IScope { - items: AngularFire; + items: AngularFireArray; remoteItems: RemoteItems; } @@ -14,23 +14,46 @@ interface RemoteItems { var url = "https://myapp.firebaseio.com"; myapp.controller("MyController", ["$scope", "$firebase", - function($scope: AngularFireScope, $firebase: AngularFireService) { - $scope.items = $firebase(new Firebase(url)); + function ($scope: AngularFireScope, $firebase: AngularFireService) { + var sync = $firebase(new Firebase(url)); + + sync.$asArray() + .$loaded() + .then(function (list: AngularFireArray) { + console.log("list has " + list.length + " items"); + + list.$add({ foo: "bar" }).then(function (ref) { + ref.on("value", function (snapshot) { + if (snapshot.val().foo !== "bar") throw "error"; + }); + }); + + var item = list.$getRecord("foo"); + list.$remove("foo"); + list.$remove(0); + list.$save(); + }); + sync.$asObject() + + + $scope.items = sync.$asArray(); + $scope.object = sync.$asObject(); + $scope.items.$add({ foo: "bar" }); $scope.items.$remove("foo"); $scope.items.$remove(); $scope.items.$save(); var child = $scope.items.$child("foo"); child.$remove(); - $scope.items.$set({ bar: "baz" }); + $scope.items.$set({ bar: "baz" }); var keys = $scope.items.$getIndex(); - keys.forEach(function(key, i) { + keys.forEach(function (key, i) { console.log(i, ($scope.items)[key]); }); - $scope.items.$on("loaded", function() { + $scope.items.$on("loaded", function () { console.log("Initial data received!"); }); - $scope.items.$on("change", function() { + $scope.items.$on("change", function () { console.log("A remote change was applied locally!"); }); $scope.items.$off('loaded'); @@ -39,7 +62,7 @@ myapp.controller("MyController", ["$scope", "$firebase", } $scope.items.$bind($scope, "remoteItems"); $scope.remoteItems.bar = "foo"; - $scope.items.$bind($scope, "remote").then(function(unbind) { + $scope.items.$bind($scope, "remote").then(function (unbind) { unbind(); $scope.remoteItems.bar = "foo"; }); @@ -55,7 +78,7 @@ interface AngularFireAuthScope extends ng.IScope { } myapp.controller("MyAuthController", ["$scope", "$firebaseSimpleLogin", - function($scope: AngularFireAuthScope, $firebaseSimpleLogin: AngularFireAuthService) { + function ($scope: AngularFireAuthScope, $firebaseSimpleLogin: AngularFireAuthService) { var dataRef = new Firebase(url); $scope.loginObj = $firebaseSimpleLogin(dataRef); $scope.loginObj.$getCurrentUser().then(_ => { @@ -65,9 +88,9 @@ myapp.controller("MyAuthController", ["$scope", "$firebaseSimpleLogin", $scope.loginObj.$login('password', { email: email, password: password - }).then(function(user) { + }).then(function (user) { console.log('Logged in as: ', user.uid); - }, function(error) { + }, function (error) { console.error('Login failed: ', error); }); $scope.loginObj.$logout(); diff --git a/angularfire/angularfire.d.ts b/angularfire/angularfire.d.ts index 3f2b0aa106..f81ac243fa 100644 --- a/angularfire/angularfire.d.ts +++ b/angularfire/angularfire.d.ts @@ -1,4 +1,4 @@ -// Type definitions for AngularFire 0.6.0 +// Type definitions for AngularFire 0.8.2 and Firebase Simple Login 1.6.4 // Project: http://angularfire.com // Definitions by: Dénes Harmath // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -7,25 +7,53 @@ /// interface AngularFireService { - (firebase: Firebase): AngularFire; + (firebase: Firebase, config?:any): AngularFire; } interface AngularFire { - $add(value: any): void; - $remove(key?: string): void; - $save(key?: string): void; - $child(key: string): AngularFire; - $set(value: any): void; - $getIndex(): string[]; - $on(eventType: string, callback: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: ()=> void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void; - $off(eventType?: string, callback?: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: ()=> void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void; - $bind($scope: ng.IScope, modelName: string): ng.IPromise; + $asArray(): AngularFireArray; + $asObject(): AngularFireObject; + $ref(): Firebase; + $push(data: any): ng.IPromise; + $set(key: string, data: any): ng.IPromise; + $set(data: any): ng.IPromise; + $remove(key?: string): ng.IPromise; + $update(key: string, data: any): ng.IPromise; + $update(data: any): ng.IPromise; + $transaction(updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise; } interface AngularFireObject { + $id: string; $priority: number; + $value: any; + $save(): ng.IPromise; + $loaded(): ng.IPromise; + $inst(): Firebase; + $bindTo(scope: ng.IScope, varName: string): ng.IPromise; + $watch(callback: Function, context: any): Function; + $destroy(): void; + + $extendFactory(ChildClass: Object, methods?: Object); } +interface AngularFireArray extends Array { + $add(newData: any): ng.IPromise; + $save(recordOrIndex: any): ng.IPromise; + $remove(recordOrIndex: any): ng.IPromise; + $getRecord(key: string): any; + $keyAt(recordOrIndex: any): string; + $indexFor(key: string): number; + $loaded(): ng.IPromise; + $inst(): Firebase; + $watch(cb: (event: string, key: string, prevChild: string) => void, context?: any): Function; + $destroy(): void; + + $extendFactory(ChildClass:Object, methods?:Object); +} + + + interface AngularFireAuthService { (firebase: Firebase): AngularFireAuth; } @@ -34,7 +62,7 @@ interface AngularFireAuth { $getCurrentUser(): ng.IPromise; $login(provider: string, options?: Object): ng.IPromise; $logout(): void; - $createUser(email: string, password: string, noLogin?: boolean): ng.IPromise; + $createUser(email: string, password: string): ng.IPromise; $changePassword(email: string, oldPassword: string, newPassword: string): ng.IPromise; $removeUser(email: string, password: string): ng.IPromise; $sendPasswordResetEmail(email: string): ng.IPromise; From a0e56c27e72009602b8587b696ee42888f8fe5a5 Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Thu, 6 Nov 2014 01:17:54 -0500 Subject: [PATCH 24/42] Adds definitions and tests for the Mousetrap global-bind extension --- .../mousetrap-global-bind-tests.ts | 42 +++++++++++++++++++ .../mousetrap-global-bind.d.ts | 11 +++++ 2 files changed, 53 insertions(+) create mode 100644 mousetrap-global-bind/mousetrap-global-bind-tests.ts create mode 100644 mousetrap-global-bind/mousetrap-global-bind.d.ts diff --git a/mousetrap-global-bind/mousetrap-global-bind-tests.ts b/mousetrap-global-bind/mousetrap-global-bind-tests.ts new file mode 100644 index 0000000000..92374d862e --- /dev/null +++ b/mousetrap-global-bind/mousetrap-global-bind-tests.ts @@ -0,0 +1,42 @@ +/// + +Mousetrap.globalBind('4', function() { console.log('4'); }); +Mousetrap.globalBind("?", function() { console.log('show shortcuts!'); }); +Mousetrap.globalBind('esc', function() { console.log('escape'); }, 'keyup'); + +// combinations +Mousetrap.globalBind('command+shift+K', function() { console.log('command shift k'); }); + +// map multiple combinations to the same callback +Mousetrap.globalBind(['command+k', 'ctrl+k'], function() { + console.log('command k or control k'); + + // return false to prevent default browser behavior + // and stop event from bubbling + return false; +}); + +// gmail style sequences +Mousetrap.globalBind('g i', function() { console.log('go to inbox'); }); +Mousetrap.globalBind('* a', function() { console.log('select all'); }); + +// konami code! +Mousetrap.globalBind('up up down down left right left right b a enter', function() { + console.log('konami code'); +}); + +Mousetrap.globalBind(['ctrl+s', 'meta+s'], (e, combo) => { + if (e.preventDefault) { + e.preventDefault(); + } else { + // internet explorer + e.returnValue = false; + } +}); + +Mousetrap.unbind('?'); + +Mousetrap.trigger('esc'); +Mousetrap.trigger('esc', 'keyup'); + +Mousetrap.reset(); diff --git a/mousetrap-global-bind/mousetrap-global-bind.d.ts b/mousetrap-global-bind/mousetrap-global-bind.d.ts new file mode 100644 index 0000000000..b22d5e3382 --- /dev/null +++ b/mousetrap-global-bind/mousetrap-global-bind.d.ts @@ -0,0 +1,11 @@ +// Type definitions for Mousetrap 1.4.6's global-bind extension +// Project: http://craig.is/killing/mice#extensions.global +// Definitions by: Andrew Bradley +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface MousetrapStatic { + globalBind(keys: string, callback: (e: ExtendedKeyboardEvent, combo: string) => any, action?: string): void; + globalBind(keyArray: string[], callback: (e: ExtendedKeyboardEvent, combo: string) => any, action?: string): void; +} From 1d556e1d7c7d0c0a32ca48daaa4582ed165cd01b Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Thu, 6 Nov 2014 01:31:01 -0500 Subject: [PATCH 25/42] Modified Mousetrap definition to allow Mousetrap to be loaded as an external module. - tests are also updated to test loading as an external module - mousetrap exports itself as an AMD module when an AMD define function is present --- mousetrap/mousetrap-tests.ts | 8 ++++++++ mousetrap/mousetrap.d.ts | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/mousetrap/mousetrap-tests.ts b/mousetrap/mousetrap-tests.ts index 3eac1eef16..d60d8278d3 100644 --- a/mousetrap/mousetrap-tests.ts +++ b/mousetrap/mousetrap-tests.ts @@ -41,3 +41,11 @@ Mousetrap.trigger('esc'); Mousetrap.trigger('esc', 'keyup'); Mousetrap.reset(); + +// Test that Mousetrap can be loaded as an external module. +// Assume that if the externally-loaded module can be assigned to a variable with the type of global Mousetrap, +// then everything is working correctly. + +import importedMousetrap = require('mousetrap'); +var mousetrapModuleReference: typeof Mousetrap = importedMousetrap; + diff --git a/mousetrap/mousetrap.d.ts b/mousetrap/mousetrap.d.ts index dee352b42b..846e1f3ce2 100644 --- a/mousetrap/mousetrap.d.ts +++ b/mousetrap/mousetrap.d.ts @@ -19,3 +19,7 @@ interface MousetrapStatic { } declare var Mousetrap: MousetrapStatic; + +declare module "mousetrap" { + export = Mousetrap; +} From 5eef2e22f9980b06625e816bfc47b3bdc37d0f52 Mon Sep 17 00:00:00 2001 From: in-async Date: Thu, 6 Nov 2014 21:27:22 +0900 Subject: [PATCH 26/42] update angularfire.d.ts from 0.6.0 to 0.8.2 --- angularfire/angularfire-tests.ts | 208 ++++++++++++++++++++++--------- angularfire/angularfire.d.ts | 59 +++++---- 2 files changed, 185 insertions(+), 82 deletions(-) diff --git a/angularfire/angularfire-tests.ts b/angularfire/angularfire-tests.ts index 74a6c5a302..231c0f992c 100644 --- a/angularfire/angularfire-tests.ts +++ b/angularfire/angularfire-tests.ts @@ -3,76 +3,166 @@ var myapp = angular.module("myapp", ["firebase"]); interface AngularFireScope extends ng.IScope { - items: AngularFireArray; - remoteItems: RemoteItems; -} - -interface RemoteItems { - bar: string; + data: any; } var url = "https://myapp.firebaseio.com"; -myapp.controller("MyController", ["$scope", "$firebase", - function ($scope: AngularFireScope, $firebase: AngularFireService) { - var sync = $firebase(new Firebase(url)); +myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$FirebaseArray', + function ($scope: AngularFireScope, $firebase: AngularFireService, $FirebaseObject: AngularFireObjectService, $FirebaseArray: AngularFireArrayService) { + var ref = new Firebase(url); + var sync = $firebase(ref); - sync.$asArray() - .$loaded() - .then(function (list: AngularFireArray) { - console.log("list has " + list.length + " items"); + // AngularFire + { + sync.$asArray(); + sync.$asObject(); + sync.$ref(); + sync.$remove(); + sync.$push({ foo: "foo data" }); + sync.$set("foo", 1); + sync.$set({ foo: 2 }); + sync.$update({ foo: 3 }); + sync.$update("foo", { bar: 1 }); - list.$add({ foo: "bar" }).then(function (ref) { - ref.on("value", function (snapshot) { - if (snapshot.val().foo !== "bar") throw "error"; - }); + // Increment the message count by 1 + sync.$transaction('count', function (currentCount) { + if (!currentCount) return 1; // Initial value for counter. + if (currentCount < 0) return; // Return undefined to abort transaction. + return currentCount + 1; // Increment the count by 1. + }).then(function (snapshot) { + if (!snapshot) { + // Handle aborted transaction. + } else { + // Do something. + console.log(snapshot.val()); + } + }, function (err) { + // Handle the error condition. + console.log(err.stack); }); - - var item = list.$getRecord("foo"); - list.$remove("foo"); - list.$remove(0); - list.$save(); - }); - sync.$asObject() - - - $scope.items = sync.$asArray(); - $scope.object = sync.$asObject(); - - $scope.items.$add({ foo: "bar" }); - $scope.items.$remove("foo"); - $scope.items.$remove(); - $scope.items.$save(); - var child = $scope.items.$child("foo"); - child.$remove(); - $scope.items.$set({ bar: "baz" }); - var keys = $scope.items.$getIndex(); - keys.forEach(function (key, i) { - console.log(i, ($scope.items)[key]); - }); - $scope.items.$on("loaded", function () { - console.log("Initial data received!"); - }); - $scope.items.$on("change", function () { - console.log("A remote change was applied locally!"); - }); - $scope.items.$off('loaded'); - function stopSync() { - $scope.items.$off(); } - $scope.items.$bind($scope, "remoteItems"); - $scope.remoteItems.bar = "foo"; - $scope.items.$bind($scope, "remote").then(function (unbind) { - unbind(); - $scope.remoteItems.bar = "foo"; - }); + + + // AngularFireObject + { + var obj = sync.$asObject(); + + // $id + if (obj.$id !== ref.name()) throw "error"; + + // $loaded() + obj.$loaded().then((data) => { + if (data !== obj) throw "error"; + // $priority + obj.$priority; + + // $value, $save() + obj.$value = "foobar"; + obj.$save(); + }); + + // $inst() + if (obj.$inst() !== sync) throw "error"; + + // $bindTo() + obj.$bindTo($scope, "data").then(function () { + console.log($scope.data); + $scope.data.foo = "baz"; // will be saved to Firebase + sync.$set({ foo: "baz" }); // this would update Firebase and $scope.data + }); + + // $watch() + var unwatch = obj.$watch(function () { + console.log("data changed!"); + }); + unwatch(); + + // $destroy() + obj.$destroy(); + + // $extendFactory() + var NewFactory = $FirebaseObject.$extendFactory({ + getMyFavoriteColor: function () { + return this.favoriteColor + ", no green!"; // obscure Monty Python reference + } + }); + var customObj = $firebase(ref, { objectFactory: NewFactory }).$asObject(); + } + + // AngularFireArray + { + var list = sync.$asArray(); + + // $inst() + if (list.$inst() !== sync) throw "error"; + + // $add() + list.$add({ foo: "foo value" }); + + // $keyAt() + var key = list.$keyAt(0); + + // $indexFor() + var index = list.$indexFor(key); + + // $getRecord() + var item = list.$getRecord(key); + + // $save() + item["bar"] = "bar value"; + list.$save(item); + + // $remove() + list.$remove(item); + + // $loaded() + list.$loaded().then(data => { + if (data !== list) throw "error"; + }); + + // $watch() + var unwatch = list.$watch((event, key, prevChild) => { + switch (event) { + case "child_added": + console.log(key + " added"); + break; + case "child_changed": + console.log(key + " changed"); + break; + case "child_moved": + console.log(key + " moved"); + break; + case "child_removed": + console.log(key + " removed"); + break; + default: + throw "error"; + } + }); + unwatch(); + + // $destroy() + list.$destroy(); + + // $extendFactory() + var ArrayWithSum = $FirebaseArray.$extendFactory({ + sum: function () { + var total = 0; + angular.forEach(this.$list, function (rec) { + total += rec.x; + }); + return total; + } + }); + var list = $firebase(ref, { arrayFactory: ArrayWithSum }).$asArray(); + list.$loaded().then(function () { + console.log("List has " + (list).sum() + " items"); + }); + } } ]); -var foo: AngularFireObject = { - $priority: 0 -}; - interface AngularFireAuthScope extends ng.IScope { loginObj: AngularFireAuth; } diff --git a/angularfire/angularfire.d.ts b/angularfire/angularfire.d.ts index f81ac243fa..b6a0d55d26 100644 --- a/angularfire/angularfire.d.ts +++ b/angularfire/angularfire.d.ts @@ -1,4 +1,4 @@ -// Type definitions for AngularFire 0.8.2 and Firebase Simple Login 1.6.4 +// Type definitions for AngularFire 0.8.2 // Project: http://angularfire.com // Definitions by: Dénes Harmath // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -7,7 +7,7 @@ /// interface AngularFireService { - (firebase: Firebase, config?:any): AngularFire; + (firebase: Firebase, config?: any): AngularFire; } interface AngularFire { @@ -18,52 +18,65 @@ interface AngularFire { $set(key: string, data: any): ng.IPromise; $set(data: any): ng.IPromise; $remove(key?: string): ng.IPromise; - $update(key: string, data: any): ng.IPromise; + $update(key: string, data: Object): ng.IPromise; $update(data: any): ng.IPromise; $transaction(updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise; + $transaction(key:string, updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise; } -interface AngularFireObject { +interface AngularFireObject extends AngularFireSimpleObject { $id: string; $priority: number; $value: any; $save(): ng.IPromise; - $loaded(): ng.IPromise; - $inst(): Firebase; + $loaded(resolve?: (x: AngularFireObject) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; + $loaded(resolve?: (x: AngularFireObject) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; + $loaded(resolve?: (x: AngularFireObject) => void, reject?: (err: any) => any): ng.IPromise; + $inst(): AngularFire; $bindTo(scope: ng.IScope, varName: string): ng.IPromise; - $watch(callback: Function, context: any): Function; + $watch(callback: Function, context?: any): Function; $destroy(): void; - - $extendFactory(ChildClass: Object, methods?: Object); +} +interface AngularFireObjectService { + $extendFactory(ChildClass: Object, methods?: Object): Object; } -interface AngularFireArray extends Array { +interface AngularFireArray extends Array { $add(newData: any): ng.IPromise; $save(recordOrIndex: any): ng.IPromise; $remove(recordOrIndex: any): ng.IPromise; - $getRecord(key: string): any; + $getRecord(key: string): AngularFireSimpleObject; $keyAt(recordOrIndex: any): string; $indexFor(key: string): number; - $loaded(): ng.IPromise; - $inst(): Firebase; + $loaded(resolve?: (x: AngularFireArray) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; + $loaded(resolve?: (x: AngularFireArray) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; + $loaded(resolve?: (x: AngularFireArray) => void, reject?: (err: any) => any): ng.IPromise; + $inst(): AngularFire; $watch(cb: (event: string, key: string, prevChild: string) => void, context?: any): Function; $destroy(): void; - - $extendFactory(ChildClass:Object, methods?:Object); +} +interface AngularFireArrayService { + $extendFactory(ChildClass: Object, methods?: Object): Object; } +interface AngularFireSimpleObject { + $id: string; + $priority: number; + $value: any; + [key: string]: any; +} interface AngularFireAuthService { - (firebase: Firebase): AngularFireAuth; + (firebase: Firebase): AngularFireAuth; } interface AngularFireAuth { - $getCurrentUser(): ng.IPromise; - $login(provider: string, options?: Object): ng.IPromise; - $logout(): void; - $createUser(email: string, password: string): ng.IPromise; - $changePassword(email: string, oldPassword: string, newPassword: string): ng.IPromise; - $removeUser(email: string, password: string): ng.IPromise; - $sendPasswordResetEmail(email: string): ng.IPromise; + $getCurrentUser(): ng.IPromise; + $login(provider: string, options?: Object): ng.IPromise; + $logout(): void; + $createUser(email: string, password: string): ng.IPromise; + $changePassword(email: string, oldPassword: string, newPassword: string): ng.IPromise; + $removeUser(email: string, password: string): ng.IPromise; + $sendPasswordResetEmail(email: string): ng.IPromise; } From e0ffa8d04db54c071d276367c937fefd1df8fd67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Bourgeois?= Date: Thu, 6 Nov 2014 18:10:44 +0100 Subject: [PATCH 27/42] Missing function declaration for knockout. The destroy(function() {...}) was missing inside knockout declarations. --- knockout/knockout.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/knockout/knockout.d.ts b/knockout/knockout.d.ts index 861fc8fe30..5c9ab58f32 100644 --- a/knockout/knockout.d.ts +++ b/knockout/knockout.d.ts @@ -1,6 +1,6 @@ // Type definitions for Knockout v3.2.0-beta // Project: http://knockoutjs.com -// Definitions by: Boris Yankov , Igor Oleinikov +// Definitions by: Boris Yankov , Igor Oleinikov , Clément Bourgeois // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -38,6 +38,7 @@ interface KnockoutObservableArrayFunctions { removeAll(): T[]; destroy(item: T): void; + destroy(destroyFunction: (item: T) => boolean): void; destroyAll(items: T[]): void; destroyAll(): void; } From 59ea3f230968073885dc9f72bcb66747b737f2e5 Mon Sep 17 00:00:00 2001 From: Yang Guan Date: Thu, 6 Nov 2014 10:23:22 -0800 Subject: [PATCH 28/42] Modify tests for heatmap.js --- heatmap.js/heatmap-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heatmap.js/heatmap-tests.ts b/heatmap.js/heatmap-tests.ts index c61458faec..a90eb0aea4 100644 --- a/heatmap.js/heatmap-tests.ts +++ b/heatmap.js/heatmap-tests.ts @@ -6,7 +6,7 @@ var baseLayer = L.tileLayer( maxZoom: 18 }); -var testData: HeatmapDataObject = { +var testData: HeatmapData = { max: 8, data: [ { From c71628e0765eb8e240d8eabd2225f64ea2e2fdb8 Mon Sep 17 00:00:00 2001 From: Jeremy Bell Date: Thu, 6 Nov 2014 16:10:37 -0500 Subject: [PATCH 29/42] Adding legacy 1.2 versions of angular-animate, angular-cookies, angular-mocks, angular-resource, angular-route, angular-sanitize, and angular-scenario to address a reference issue when you bring in the 1.2 version of the core angular library. Updated documentation links in the 1.2 versions to point to the 1.2 versions of the documentation. Labeled /angularjs/angular-*.ts as 1.3 in the headers. These will be the starting points for a deeper 1.3 update review - though they are mostly backwards compatible as-is. --- angularjs/angular-animate.d.ts | 2 +- angularjs/angular-cookies.d.ts | 2 +- angularjs/angular-mocks.d.ts | 2 +- angularjs/angular-resource.d.ts | 30 +- angularjs/angular-route.d.ts | 2 +- angularjs/angular-sanitize.d.ts | 2 +- angularjs/angular-scenario.d.ts | 2 +- angularjs/legacy/angular-1.2.d.ts | 7 + angularjs/legacy/angular-animate-1.2.d.ts | 110 +++++++ angularjs/legacy/angular-cookies-1.2.d.ts | 43 +++ angularjs/legacy/angular-mocks-1.2-tests.ts | 305 ++++++++++++++++++ angularjs/legacy/angular-mocks-1.2.d.ts | 226 +++++++++++++ .../legacy/angular-resource-1.2-tests.ts | 138 ++++++++ angularjs/legacy/angular-resource-1.2.d.ts | 152 +++++++++ angularjs/legacy/angular-route-1.2-tests.ts | 17 + angularjs/legacy/angular-route-1.2.d.ts | 145 +++++++++ .../legacy/angular-sanitize-1.2-tests.ts | 10 + angularjs/legacy/angular-sanitize-1.2.d.ts | 35 ++ angularjs/legacy/angular-scenario-1.0.d.ts | 2 +- angularjs/legacy/angular-scenario-1.2.d.ts | 166 ++++++++++ 20 files changed, 1381 insertions(+), 17 deletions(-) create mode 100644 angularjs/legacy/angular-animate-1.2.d.ts create mode 100644 angularjs/legacy/angular-cookies-1.2.d.ts create mode 100644 angularjs/legacy/angular-mocks-1.2-tests.ts create mode 100644 angularjs/legacy/angular-mocks-1.2.d.ts create mode 100644 angularjs/legacy/angular-resource-1.2-tests.ts create mode 100644 angularjs/legacy/angular-resource-1.2.d.ts create mode 100644 angularjs/legacy/angular-route-1.2-tests.ts create mode 100644 angularjs/legacy/angular-route-1.2.d.ts create mode 100644 angularjs/legacy/angular-sanitize-1.2-tests.ts create mode 100644 angularjs/legacy/angular-sanitize-1.2.d.ts create mode 100644 angularjs/legacy/angular-scenario-1.2.d.ts diff --git a/angularjs/angular-animate.d.ts b/angularjs/angular-animate.d.ts index aa12399e5e..a01c93ef5b 100644 --- a/angularjs/angular-animate.d.ts +++ b/angularjs/angular-animate.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular JS 1.2+ (ngAnimate module) +// Type definitions for Angular JS 1.3 (ngAnimate module) // Project: http://angularjs.org // Definitions by: Michel Salib , Adi Dahiya // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/angularjs/angular-cookies.d.ts b/angularjs/angular-cookies.d.ts index 6222216750..dc0c449089 100644 --- a/angularjs/angular-cookies.d.ts +++ b/angularjs/angular-cookies.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular JS 1.2 (ngCookies module) +// Type definitions for Angular JS 1.3 (ngCookies module) // Project: http://angularjs.org // Definitions by: Diego Vilar // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/angularjs/angular-mocks.d.ts b/angularjs/angular-mocks.d.ts index 2591c006e9..877071127f 100644 --- a/angularjs/angular-mocks.d.ts +++ b/angularjs/angular-mocks.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular JS 1.2 (ngMock, ngMockE2E module) +// Type definitions for Angular JS 1.3 (ngMock, ngMockE2E module) // Project: http://angularjs.org // Definitions by: Diego Vilar // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index 597a58e401..ed08c77dd9 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular JS 1.2 (ngResource module) +// Type definitions for Angular JS 1.3 (ngResource module) // Project: http://angularjs.org // Definitions by: Diego Vilar , Michael Jess // Definitions: https://github.com/daptiv/DefinitelyTyped @@ -11,6 +11,16 @@ /////////////////////////////////////////////////////////////////////////////// declare module ng.resource { + /** + * Currently supported options for the $resource factory options argument. + */ + interface IResourceOptions { + /** + * If true then the trailing slashes from any calculated URL will be stripped (defaults to true) + */ + stripTrailingSlashes?: boolean; + } + /////////////////////////////////////////////////////////////////////////// // ResourceService // see http://docs.angularjs.org/api/ngResource.$resource @@ -20,17 +30,17 @@ declare module ng.resource { /////////////////////////////////////////////////////////////////////////// interface IResourceService { (url: string, paramDefaults?: any, - /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } - where deleteDescriptor : IActionDescriptor */ - actionDescriptors?: any): IResourceClass>; + /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } + where deleteDescriptor : IActionDescriptor */ + actions?: any, options?: IResourceOptions): IResourceClass>; (url: string, paramDefaults?: any, - /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } - where deleteDescriptor : IActionDescriptor */ - actionDescriptors?: any): U; + /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } + where deleteDescriptor : IActionDescriptor */ + actions?: any, options?: IResourceOptions): U; (url: string, paramDefaults?: any, - /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } - where deleteDescriptor : IActionDescriptor */ - actionDescriptors?: any): IResourceClass; + /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } + where deleteDescriptor : IActionDescriptor */ + actions?: any, options?: IResourceOptions): IResourceClass; } // Just a reference to facilitate describing new actions diff --git a/angularjs/angular-route.d.ts b/angularjs/angular-route.d.ts index a71299e258..949680bf2d 100644 --- a/angularjs/angular-route.d.ts +++ b/angularjs/angular-route.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular JS 1.2 (ngRoute module) +// Type definitions for Angular JS 1.3 (ngRoute module) // Project: http://angularjs.org // Definitions by: Jonathan Park // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/angularjs/angular-sanitize.d.ts b/angularjs/angular-sanitize.d.ts index a28bdb0d77..6fde0baef9 100644 --- a/angularjs/angular-sanitize.d.ts +++ b/angularjs/angular-sanitize.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular JS 1.2 (ngSanitize module) +// Type definitions for Angular JS 1.3 (ngSanitize module) // Project: http://angularjs.org // Definitions by: Diego Vilar // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/angularjs/angular-scenario.d.ts b/angularjs/angular-scenario.d.ts index ee71ffbea0..d1b7b19f61 100644 --- a/angularjs/angular-scenario.d.ts +++ b/angularjs/angular-scenario.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular Scenario Testing +// Type definitions for Angular Scenario Testing 1.3 (ngScenario module) // Project: http://angularjs.org // Definitions by: RomanoLindano // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/angularjs/legacy/angular-1.2.d.ts b/angularjs/legacy/angular-1.2.d.ts index a1a4cb15be..fb21b030a6 100644 --- a/angularjs/legacy/angular-1.2.d.ts +++ b/angularjs/legacy/angular-1.2.d.ts @@ -410,6 +410,13 @@ declare module ng { cancel(promise: IPromise): boolean; } + /** + * The animation object which contains callback functions for each event that is expected to be animated. + */ + interface IAnimateCallbackObject { + eventFn(element: Node, doneFn: () => void): Function; + } + /////////////////////////////////////////////////////////////////////////// // FilterService // see http://docs.angularjs.org/api/ng.$filter diff --git a/angularjs/legacy/angular-animate-1.2.d.ts b/angularjs/legacy/angular-animate-1.2.d.ts new file mode 100644 index 0000000000..307e50760c --- /dev/null +++ b/angularjs/legacy/angular-animate-1.2.d.ts @@ -0,0 +1,110 @@ +// Type definitions for Angular JS 1.2 (ngAnimate module) +// Project: http://angularjs.org +// Definitions by: Michel Salib , Adi Dahiya +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +/////////////////////////////////////////////////////////////////////////////// +// ngAnimate module (angular-animate.js) +/////////////////////////////////////////////////////////////////////////////// +declare module ng.animate { + + /////////////////////////////////////////////////////////////////////////// + // AnimateService + // see https://code.angularjs.org/1.2.26/docs/api/ngAnimate/service/$animate + /////////////////////////////////////////////////////////////////////////// + interface IAnimateService extends ng.IAnimateService { + /** + * Globally enables / disables animations. + * + * @param value If provided then set the animation on or off. + * @param element If provided then the element will be used to represent the enable/disable operation. + * @returns current animation state + */ + enabled(value?: boolean, element?: JQuery): boolean; + + /** + * Appends the element to the parentElement element that resides in the document and then runs the enter animation. + * + * @param element the element that will be the focus of the enter animation + * @param parentElement the parent element of the element that will be the focus of the enter animation + * @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation + * @param doneCallback the callback function that will be called once the animation is complete + */ + enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery, doneCallback?: () => void): void; + + /** + * Runs the leave animation operation and, upon completion, removes the element from the DOM. + * + * @param element the element that will be the focus of the leave animation + * @param doneCallback the callback function that will be called once the animation is complete + */ + leave(element: JQuery, doneCallback?: () => void): void; + + /** + * Fires the move DOM operation. Just before the animation starts, the animate service will either append + * it into the parentElement container or add the element directly after the afterElement element if present. + * Then the move animation will be run. + * + * @param element the element that will be the focus of the move animation + * @param parentElement the parent element of the element that will be the focus of the move animation + * @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation + * @param doneCallback the callback function that will be called once the animation is complete + */ + move(element: JQuery, parentElement: JQuery, afterElement?: JQuery, doneCallback?: () => void): void; + + /** + * Triggers a custom animation event based off the className variable and then attaches the className + * value to the element as a CSS class. + * + * @param element the element that will be animated + * @param className the CSS class that will be added to the element and then animated + * @param doneCallback the callback function that will be called once the animation is complete + */ + addClass(element: JQuery, className: string, doneCallback?: () => void): void; + + /** + * Triggers a custom animation event based off the className variable and then removes the CSS class + * provided by the className value from the element. + * + * @param element the element that will be animated + * @param className the CSS class that will be animated and then removed from the element + * @param doneCallback the callback function that will be called once the animation is complete + */ + removeClass(element: JQuery, className: string, doneCallback?: () => void): void; + + /** + * Adds and/or removes the given CSS classes to and from the element. Once complete, the done() callback + * will be fired (if provided). + * + * @param element the element which will have its CSS classes changed removed from it + * @param add the CSS classes which will be added to the element + * @param remove the CSS class which will be removed from the element CSS classes have been set on the element + * @param doneCallback done the callback function (if provided) that will be fired after the CSS classes have been set on the element + */ + setClass(element: JQuery, add: string, remove: string, doneCallback?: () => void): void; + } + + /////////////////////////////////////////////////////////////////////////// + // AngularProvider + // see https://code.angularjs.org/1.2.26/docs/api/ngAnimate/provider/$animateProvider + /////////////////////////////////////////////////////////////////////////// + interface IAnimateProvider { + /** + * Registers a new injectable animation factory function. + * + * @param name The name of the animation. + * @param factory The factory function that will be executed to return the animation object. + */ + register(name: string, factory: () => ng.IAnimateCallbackObject): void; + + /** + * Gets and/or sets the CSS class expression that is checked when performing an animation. + * + * @param expression The className expression which will be checked against all animations. + * @returns The current CSS className expression value. If null then there is no expression value. + */ + classNameFilter(expression?: RegExp): RegExp; + } +} diff --git a/angularjs/legacy/angular-cookies-1.2.d.ts b/angularjs/legacy/angular-cookies-1.2.d.ts new file mode 100644 index 0000000000..c5ff512e84 --- /dev/null +++ b/angularjs/legacy/angular-cookies-1.2.d.ts @@ -0,0 +1,43 @@ +// Type definitions for Angular JS 1.2 (ngCookies module) +// Project: http://angularjs.org +// Definitions by: Diego Vilar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +/////////////////////////////////////////////////////////////////////////////// +// ngCookies module (angular-cookies.js) +/////////////////////////////////////////////////////////////////////////////// +declare module ng.cookies { + + /////////////////////////////////////////////////////////////////////////// + // CookieService + // see https://code.angularjs.org/1.2.26/docs/api/ngCookies/service/$cookies + /////////////////////////////////////////////////////////////////////////// + interface ICookiesService {} + + /////////////////////////////////////////////////////////////////////////// + // CookieStoreService + // see https://code.angularjs.org/1.2.26/docs/api/ngCookies/service/$cookieStore + /////////////////////////////////////////////////////////////////////////// + interface ICookieStoreService { + /** + * Returns the value of given cookie key + * @param key Id to use for lookup + */ + get(key: string): any; + /** + * Sets a value for given cookie key + * @param key Id for the value + * @param value Value to be stored + */ + put(key: string, value: any): void; + /** + * Remove given cookie + * @param key Id of the key-value pair to delete + */ + remove(key: string): void; + } + +} diff --git a/angularjs/legacy/angular-mocks-1.2-tests.ts b/angularjs/legacy/angular-mocks-1.2-tests.ts new file mode 100644 index 0000000000..6f359a67c4 --- /dev/null +++ b/angularjs/legacy/angular-mocks-1.2-tests.ts @@ -0,0 +1,305 @@ +/// + +/////////////////////////////////////// +// IAngularStatic +/////////////////////////////////////// +var angular: ng.IAngularStatic; +var mock: ng.IMockStatic; + +mock = angular.mock; + + +/////////////////////////////////////// +// IMockStatic +/////////////////////////////////////// +var date: Date; + +mock.dump({ key: 'value' }); + +mock.inject( + function () { return 1; }, + function () { return 2; } + ); + +mock.inject( + ['$rootScope', function ($rootScope: ng.IRootScopeService) { return 1; }]); + +// This overload is not documented on the website, but flows from +// how the injector works. +mock.inject( + ['$rootScope', function ($rootScope: ng.IRootScopeService) { return 1; }], + ['$rootScope', function ($rootScope: ng.IRootScopeService) { return 2; }]); + +mock.module('module1', 'module2'); +mock.module( + function () { return 1; }, + function () { return 2; } + ); +mock.module({ module1: function () { return 1; } }); + +date = mock.TzDate(-7, '2013-1-1T15:00:00Z'); +date = mock.TzDate(-8, 12345678); + + +/////////////////////////////////////// +// IExceptionHandlerProvider +/////////////////////////////////////// +var exceptionHandlerProvider: ng.IExceptionHandlerProvider; + +exceptionHandlerProvider.mode('log'); + + +/////////////////////////////////////// +// ITimeoutService +/////////////////////////////////////// +var timeoutService: ng.ITimeoutService; + +timeoutService.flush(); +timeoutService.flush(1234); +timeoutService.flushNext(); +timeoutService.flushNext(1234); +timeoutService.verifyNoPendingTasks(); + +//////////////////////////////////////// +// IIntervalService +//////////////////////////////////////// +var intervalService: ng.IIntervalService; +var intervalServiceTimeActuallyAdvanced: number; + +intervalServiceTimeActuallyAdvanced = intervalService.flush(); +intervalServiceTimeActuallyAdvanced = intervalService.flush(1234); + +/////////////////////////////////////// +// ILogService, ILogCall +/////////////////////////////////////// +var logService: ng.ILogService; +var logCall: ng.ILogCall; +var logs: string[]; + +logService.assertEmpty(); +logService.reset(); + +logCall = logService.debug; +logCall = logService.error; +logCall = logService.info; +logCall = logService.log; +logCall = logService.warn; + +logs = logCall.logs; + + +/////////////////////////////////////// +// IHttpBackendService +/////////////////////////////////////// +var httpBackendService: ng.IHttpBackendService; +var requestHandler: ng.mock.IRequestHandler; + +httpBackendService.flush(); +httpBackendService.flush(1234); +httpBackendService.resetExpectations(); +httpBackendService.verifyNoOutstandingExpectation(); +httpBackendService.verifyNoOutstandingRequest(); + +requestHandler = httpBackendService.expect('GET', 'http://test.local'); +requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data'); +requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', { header: 'value' }); +requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/); +requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, { header: 'value' }); +requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }); +requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }); +requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }, function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.expect('GET', /test.local/); +requestHandler = httpBackendService.expect('GET', /test.local/, 'response data'); +requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', { header: 'value' }); +requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.expect('GET', /test.local/, /response data/); +requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, { header: 'value' }); +requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }); +requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }); +requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; }); + +requestHandler = httpBackendService.expectDELETE('http://test.local'); +requestHandler = httpBackendService.expectDELETE('http://test.local', { header: 'value' }); +requestHandler = httpBackendService.expectDELETE(/test.local/, { header: 'value' }); +requestHandler = httpBackendService.expectGET('http://test.local'); +requestHandler = httpBackendService.expectGET('http://test.local', { header: 'value' }); +requestHandler = httpBackendService.expectGET(/test.local/, { header: 'value' }); +requestHandler = httpBackendService.expectHEAD('http://test.local'); +requestHandler = httpBackendService.expectHEAD('http://test.local', { header: 'value' }); +requestHandler = httpBackendService.expectHEAD(/test.local/, { header: 'value' }); +requestHandler = httpBackendService.expectJSONP('http://test.local'); +requestHandler = httpBackendService.expectJSONP(/test.local/); + +requestHandler = httpBackendService.expectPATCH('http://test.local'); +requestHandler = httpBackendService.expectPATCH('http://test.local', 'response data'); +requestHandler = httpBackendService.expectPATCH('http://test.local', 'response data', { header: 'value' }); +requestHandler = httpBackendService.expectPATCH('http://test.local', /response data/); +requestHandler = httpBackendService.expectPATCH('http://test.local', /response data/, { header: 'value' }); +requestHandler = httpBackendService.expectPATCH('http://test.local', function (data: string): boolean { return true; }); +requestHandler = httpBackendService.expectPATCH('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'value' }); +requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.expectPATCH(/test.local/); +requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data'); +requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data', { header: 'value' }); +requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/); +requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/, { header: 'value' }); +requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; }); +requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' }); +requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' }, { header: 'value' }); + +requestHandler = httpBackendService.expectPOST('http://test.local'); +requestHandler = httpBackendService.expectPOST('http://test.local', 'response data'); +requestHandler = httpBackendService.expectPOST('http://test.local', 'response data', { header: 'value' }); +requestHandler = httpBackendService.expectPOST('http://test.local', /response data/); +requestHandler = httpBackendService.expectPOST('http://test.local', /response data/, { header: 'value' }); +requestHandler = httpBackendService.expectPOST('http://test.local', function (data: string): boolean { return true; }); +requestHandler = httpBackendService.expectPOST('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'value' }); +requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.expectPOST(/test.local/); +requestHandler = httpBackendService.expectPOST(/test.local/, 'response data'); +requestHandler = httpBackendService.expectPOST(/test.local/, 'response data', { header: 'value' }); +requestHandler = httpBackendService.expectPOST(/test.local/, /response data/); +requestHandler = httpBackendService.expectPOST(/test.local/, /response data/, { header: 'value' }); +requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; }); +requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' }); +requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' }, { header: 'value' }); + +requestHandler = httpBackendService.expectPUT('http://test.local'); +requestHandler = httpBackendService.expectPUT('http://test.local', 'response data'); +requestHandler = httpBackendService.expectPUT('http://test.local', 'response data', { header: 'value' }); +requestHandler = httpBackendService.expectPUT('http://test.local', /response data/); +requestHandler = httpBackendService.expectPUT('http://test.local', /response data/, { header: 'value' }); +requestHandler = httpBackendService.expectPUT('http://test.local', function (data: string): boolean { return true; }); +requestHandler = httpBackendService.expectPUT('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value' }); +requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.expectPUT(/test.local/); +requestHandler = httpBackendService.expectPUT(/test.local/, 'response data'); +requestHandler = httpBackendService.expectPUT(/test.local/, 'response data', { header: 'value' }); +requestHandler = httpBackendService.expectPUT(/test.local/, /response data/); +requestHandler = httpBackendService.expectPUT(/test.local/, /response data/, { header: 'value' }); +requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; }); +requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' }); +requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' }, { header: 'value' }); + +requestHandler = httpBackendService.when('GET', 'http://test.local'); +requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data'); +requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', { header: 'value' }); +requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/); +requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, { header: 'value' }); +requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }); +requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }); +requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }, function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.when('GET', /test.local/); +requestHandler = httpBackendService.when('GET', /test.local/, 'response data'); +requestHandler = httpBackendService.when('GET', /test.local/, 'response data', { header: 'value' }); +requestHandler = httpBackendService.when('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.when('GET', /test.local/, /response data/); +requestHandler = httpBackendService.when('GET', /test.local/, /response data/, { header: 'value' }); +requestHandler = httpBackendService.when('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }); +requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }); +requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }); +requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; }); + +requestHandler = httpBackendService.whenDELETE('http://test.local'); +requestHandler = httpBackendService.whenDELETE('http://test.local', { header: 'value' }); +requestHandler = httpBackendService.whenDELETE(/test.local/, { header: 'value' }); +requestHandler = httpBackendService.whenGET('http://test.local'); +requestHandler = httpBackendService.whenGET('http://test.local', { header: 'value' }); +requestHandler = httpBackendService.whenGET(/test.local/, { header: 'value' }); +requestHandler = httpBackendService.whenHEAD('http://test.local'); +requestHandler = httpBackendService.whenHEAD('http://test.local', { header: 'value' }); +requestHandler = httpBackendService.whenHEAD(/test.local/, { header: 'value' }); +requestHandler = httpBackendService.whenJSONP('http://test.local'); +requestHandler = httpBackendService.whenJSONP(/test.local/); + +requestHandler = httpBackendService.whenPATCH('http://test.local'); +requestHandler = httpBackendService.whenPATCH('http://test.local', 'response data'); +requestHandler = httpBackendService.whenPATCH('http://test.local', 'response data', { header: 'value' }); +requestHandler = httpBackendService.whenPATCH('http://test.local', /response data/); +requestHandler = httpBackendService.whenPATCH('http://test.local', /response data/, { header: 'value' }); +requestHandler = httpBackendService.whenPATCH('http://test.local', function (data: string): boolean { return true; }); +requestHandler = httpBackendService.whenPATCH('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value' }); +requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.whenPATCH(/test.local/); +requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data'); +requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data', { header: 'value' }); +requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/); +requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/, { header: 'value' }); +requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; }); +requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' }); +requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' }, { header: 'value' }); + +requestHandler = httpBackendService.whenPOST('http://test.local'); +requestHandler = httpBackendService.whenPOST('http://test.local', 'response data'); +requestHandler = httpBackendService.whenPOST('http://test.local', 'response data', { header: 'value' }); +requestHandler = httpBackendService.whenPOST('http://test.local', /response data/); +requestHandler = httpBackendService.whenPOST('http://test.local', /response data/, { header: 'value' }); +requestHandler = httpBackendService.whenPOST('http://test.local', function (data: string): boolean { return true; }); +requestHandler = httpBackendService.whenPOST('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value' }); +requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.whenPOST(/test.local/); +requestHandler = httpBackendService.whenPOST(/test.local/, 'response data'); +requestHandler = httpBackendService.whenPOST(/test.local/, 'response data', { header: 'value' }); +requestHandler = httpBackendService.whenPOST(/test.local/, /response data/); +requestHandler = httpBackendService.whenPOST(/test.local/, /response data/, { header: 'value' }); +requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; }); +requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' }); +requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' }, { header: 'value' }); + +requestHandler = httpBackendService.whenPUT('http://test.local'); +requestHandler = httpBackendService.whenPUT('http://test.local', 'response data'); +requestHandler = httpBackendService.whenPUT('http://test.local', 'response data', { header: 'value' }); +requestHandler = httpBackendService.whenPUT('http://test.local', /response data/); +requestHandler = httpBackendService.whenPUT('http://test.local', /response data/, { header: 'value' }); +requestHandler = httpBackendService.whenPUT('http://test.local', function (data: string): boolean { return true; }); +requestHandler = httpBackendService.whenPUT('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value' }); +requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value' }, { header: 'value' }); +requestHandler = httpBackendService.whenPUT(/test.local/); +requestHandler = httpBackendService.whenPUT(/test.local/, 'response data'); +requestHandler = httpBackendService.whenPUT(/test.local/, 'response data', { header: 'value' }); +requestHandler = httpBackendService.whenPUT(/test.local/, /response data/); +requestHandler = httpBackendService.whenPUT(/test.local/, /response data/, { header: 'value' }); +requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; }); +requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); +requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' }); +requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' }, { header: 'value' }); + + +/////////////////////////////////////// +// IRequestHandler +/////////////////////////////////////// +requestHandler.passThrough(); +requestHandler.respond(function () { }); +requestHandler.respond({ key: 'value' }); +requestHandler.respond({ key: 'value' }, { header: 'value' }); +requestHandler.respond(404); +requestHandler.respond(404, { key: 'value' }); +requestHandler.respond(404, { key: 'value' }, { header: 'value' }); diff --git a/angularjs/legacy/angular-mocks-1.2.d.ts b/angularjs/legacy/angular-mocks-1.2.d.ts new file mode 100644 index 0000000000..e9b0dc8d24 --- /dev/null +++ b/angularjs/legacy/angular-mocks-1.2.d.ts @@ -0,0 +1,226 @@ +// Type definitions for Angular JS 1.2 (ngMock, ngMockE2E module) +// Project: http://angularjs.org +// Definitions by: Diego Vilar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +/////////////////////////////////////////////////////////////////////////////// +// functions attached to global object (window) +/////////////////////////////////////////////////////////////////////////////// +declare var module: (...modules: any[]) => any; +declare var inject: (...fns: Function[]) => any; + +/////////////////////////////////////////////////////////////////////////////// +// ngMock module (angular-mocks.js) +/////////////////////////////////////////////////////////////////////////////// +declare module ng { + + /////////////////////////////////////////////////////////////////////////// + // AngularStatic + // We reopen it to add the MockStatic definition + /////////////////////////////////////////////////////////////////////////// + interface IAngularStatic { + mock: IMockStatic; + } + + interface IMockStatic { + // see https://code.angularjs.org/1.2.26/docs/api/ngMock/function/angular.mock.dump + dump(obj: any): string; + + // see https://code.angularjs.org/1.2.26/docs/api/ngMock/function/angular.mock.inject + inject(...fns: Function[]): any; + inject(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works + + // see https://code.angularjs.org/1.2.26/docs/api/ngMock/function/angular.mock.module + module(...modules: any[]): any; + + // see https://code.angularjs.org/1.2.26/docs/api/ngMock/type/angular.mock.TzDate + TzDate(offset: number, timestamp: number): Date; + TzDate(offset: number, timestamp: string): Date; + } + + /////////////////////////////////////////////////////////////////////////// + // ExceptionHandlerService + // see https://code.angularjs.org/1.2.26/docs/api/ngMock/service/$exceptionHandler + // see https://code.angularjs.org/1.2.26/docs/api/ngMock/provider/$exceptionHandlerProvider + /////////////////////////////////////////////////////////////////////////// + interface IExceptionHandlerProvider extends IServiceProvider { + mode(mode: string): void; + } + + /////////////////////////////////////////////////////////////////////////// + // TimeoutService + // see https://code.angularjs.org/1.2.26/docs/api/ngMock/service/$timeout + // Augments the original service + /////////////////////////////////////////////////////////////////////////// + interface ITimeoutService { + flush(delay?: number): void; + flushNext(expectedDelay?: number): void; + verifyNoPendingTasks(): void; + } + + /////////////////////////////////////////////////////////////////////////// + // IntervalService + // see https://code.angularjs.org/1.2.26/docs/api/ngMock/service/$interval + // Augments the original service + /////////////////////////////////////////////////////////////////////////// + interface IIntervalService { + flush(millis?: number): number; + } + + /////////////////////////////////////////////////////////////////////////// + // LogService + // see https://code.angularjs.org/1.2.26/docs/api/ngMock/service/$log + // Augments the original service + /////////////////////////////////////////////////////////////////////////// + interface ILogService { + assertEmpty(): void; + reset(): void; + } + + interface ILogCall { + logs: string[]; + } + + /////////////////////////////////////////////////////////////////////////// + // HttpBackendService + // see https://code.angularjs.org/1.2.26/docs/api/ngMock/service/$httpBackend + /////////////////////////////////////////////////////////////////////////// + interface IHttpBackendService { + flush(count?: number): void; + resetExpectations(): void; + verifyNoOutstandingExpectation(): void; + verifyNoOutstandingRequest(): void; + + expect(method: string, url: string, data?: string, headers?: Object): mock.IRequestHandler; + expect(method: string, url: string, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler; + expect(method: string, url: string, data?: RegExp, headers?: Object): mock.IRequestHandler; + expect(method: string, url: string, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler; + expect(method: string, url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; + expect(method: string, url: string, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler; + expect(method: string, url: string, data?: Object, headers?: Object): mock.IRequestHandler; + expect(method: string, url: string, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler; + expect(method: string, url: RegExp, data?: string, headers?: Object): mock.IRequestHandler; + expect(method: string, url: RegExp, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler; + expect(method: string, url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler; + expect(method: string, url: RegExp, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler; + expect(method: string, url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; + expect(method: string, url: RegExp, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler; + expect(method: string, url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler; + expect(method: string, url: RegExp, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler; + + expectDELETE(url: string, headers?: Object): mock.IRequestHandler; + expectDELETE(url: RegExp, headers?: Object): mock.IRequestHandler; + expectGET(url: string, headers?: Object): mock.IRequestHandler; + expectGET(url: RegExp, headers?: Object): mock.IRequestHandler; + expectHEAD(url: string, headers?: Object): mock.IRequestHandler; + expectHEAD(url: RegExp, headers?: Object): mock.IRequestHandler; + expectJSONP(url: string): mock.IRequestHandler; + expectJSONP(url: RegExp): mock.IRequestHandler; + + expectPATCH(url: string, data?: string, headers?: Object): mock.IRequestHandler; + expectPATCH(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler; + expectPATCH(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; + expectPATCH(url: string, data?: Object, headers?: Object): mock.IRequestHandler; + expectPATCH(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler; + expectPATCH(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler; + expectPATCH(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; + expectPATCH(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler; + + expectPOST(url: string, data?: string, headers?: Object): mock.IRequestHandler; + expectPOST(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler; + expectPOST(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; + expectPOST(url: string, data?: Object, headers?: Object): mock.IRequestHandler; + expectPOST(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler; + expectPOST(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler; + expectPOST(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; + expectPOST(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler; + + expectPUT(url: string, data?: string, headers?: Object): mock.IRequestHandler; + expectPUT(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler; + expectPUT(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; + expectPUT(url: string, data?: Object, headers?: Object): mock.IRequestHandler; + expectPUT(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler; + expectPUT(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler; + expectPUT(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; + expectPUT(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler; + + when(method: string, url: string, data?: string, headers?: Object): mock.IRequestHandler; + when(method: string, url: string, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler; + when(method: string, url: string, data?: RegExp, headers?: Object): mock.IRequestHandler; + when(method: string, url: string, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler; + when(method: string, url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; + when(method: string, url: string, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler; + when(method: string, url: string, data?: Object, headers?: Object): mock.IRequestHandler; + when(method: string, url: string, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler; + when(method: string, url: RegExp, data?: string, headers?: Object): mock.IRequestHandler; + when(method: string, url: RegExp, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler; + when(method: string, url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler; + when(method: string, url: RegExp, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler; + when(method: string, url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; + when(method: string, url: RegExp, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler; + when(method: string, url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler; + when(method: string, url: RegExp, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler; + + whenDELETE(url: string, headers?: Object): mock.IRequestHandler; + whenDELETE(url: string, headers?: (object: Object) => boolean): mock.IRequestHandler; + whenDELETE(url: RegExp, headers?: Object): mock.IRequestHandler; + whenDELETE(url: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler; + + whenGET(url: string, headers?: Object): mock.IRequestHandler; + whenGET(url: string, headers?: (object: Object) => boolean): mock.IRequestHandler; + whenGET(url: RegExp, headers?: Object): mock.IRequestHandler; + whenGET(url: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler; + + whenHEAD(url: string, headers?: Object): mock.IRequestHandler; + whenHEAD(url: string, headers?: (object: Object) => boolean): mock.IRequestHandler; + whenHEAD(url: RegExp, headers?: Object): mock.IRequestHandler; + whenHEAD(url: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler; + + whenJSONP(url: string): mock.IRequestHandler; + whenJSONP(url: RegExp): mock.IRequestHandler; + + whenPATCH(url: string, data?: string, headers?: Object): mock.IRequestHandler; + whenPATCH(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler; + whenPATCH(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; + whenPATCH(url: string, data?: Object, headers?: Object): mock.IRequestHandler; + whenPATCH(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler; + whenPATCH(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler; + whenPATCH(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; + whenPATCH(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler; + + whenPOST(url: string, data?: string, headers?: Object): mock.IRequestHandler; + whenPOST(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler; + whenPOST(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; + whenPOST(url: string, data?: Object, headers?: Object): mock.IRequestHandler; + whenPOST(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler; + whenPOST(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler; + whenPOST(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; + whenPOST(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler; + + whenPUT(url: string, data?: string, headers?: Object): mock.IRequestHandler; + whenPUT(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler; + whenPUT(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; + whenPUT(url: string, data?: Object, headers?: Object): mock.IRequestHandler; + whenPUT(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler; + whenPUT(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler; + whenPUT(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; + whenPUT(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler; + } + + export module mock { + + // returned interface by the the mocked HttpBackendService expect/when methods + interface IRequestHandler { + respond(func: Function): void; + respond(status: number, data?: any, headers?: any): void; + respond(data: any, headers?: any): void; + + // Available wehn ngMockE2E is loaded + passThrough(): void; + } + + } + +} diff --git a/angularjs/legacy/angular-resource-1.2-tests.ts b/angularjs/legacy/angular-resource-1.2-tests.ts new file mode 100644 index 0000000000..ca970f5c40 --- /dev/null +++ b/angularjs/legacy/angular-resource-1.2-tests.ts @@ -0,0 +1,138 @@ +/// + +interface IMyResource extends ng.resource.IResource { }; +interface IMyResourceClass extends ng.resource.IResourceClass { }; + +/////////////////////////////////////// +// IActionDescriptor +/////////////////////////////////////// +var actionDescriptor: ng.resource.IActionDescriptor; + +actionDescriptor.headers = { header: 'value' }; +actionDescriptor.isArray = true; +actionDescriptor.method = 'method action'; +actionDescriptor.params = { key: 'value' }; + + +/////////////////////////////////////// +// IResourceClass +/////////////////////////////////////// +var resourceClass: IMyResourceClass; +var resource: IMyResource; +var resourceArray: ng.resource.IResourceArray; + +resource = resourceClass.delete(); +resource = resourceClass.delete({ key: 'value' }); +resource = resourceClass.delete({ key: 'value' }, function () { }); +resource = resourceClass.delete(function () { }); +resource = resourceClass.delete(function () { }, function () { }); +resource = resourceClass.delete({ key: 'value' }, { key: 'value' }); +resource = resourceClass.delete({ key: 'value' }, { key: 'value' }, function () { }); +resource = resourceClass.delete({ key: 'value' }, { key: 'value' }, function () { }, function () { }); +resource.$promise.then(function(data: IMyResource) {}); + +resource = resourceClass.get(); +resource = resourceClass.get({ key: 'value' }); +resource = resourceClass.get({ key: 'value' }, function () { }); +resource = resourceClass.get(function () { }); +resource = resourceClass.get(function () { }, function () { }); +resource = resourceClass.get({ key: 'value' }, { key: 'value' }); +resource = resourceClass.get({ key: 'value' }, { key: 'value' }, function () { }); +resource = resourceClass.get({ key: 'value' }, { key: 'value' }, function () { }, function () { }); + +resourceArray = resourceClass.query(); +resourceArray = resourceClass.query({ key: 'value' }); +resourceArray = resourceClass.query({ key: 'value' }, function () { }); +resourceArray = resourceClass.query(function () { }); +resourceArray = resourceClass.query(function () { }, function () { }); +resourceArray = resourceClass.query({ key: 'value' }, { key: 'value' }); +resourceArray = resourceClass.query({ key: 'value' }, { key: 'value' }, function () { }); +resourceArray = resourceClass.query({ key: 'value' }, { key: 'value' }, function () { }, function () { }); +resourceArray.push(resource); +resourceArray.$promise.then(function(data: ng.resource.IResourceArray) {}); + +resource = resourceClass.remove(); +resource = resourceClass.remove({ key: 'value' }); +resource = resourceClass.remove({ key: 'value' }, function () { }); +resource = resourceClass.remove(function () { }); +resource = resourceClass.remove(function () { }, function () { }); +resource = resourceClass.remove({ key: 'value' }, { key: 'value' }); +resource = resourceClass.remove({ key: 'value' }, { key: 'value' }, function () { }); +resource = resourceClass.remove({ key: 'value' }, { key: 'value' }, function () { }, function () { }); + +resource = resourceClass.save(); +resource = resourceClass.save({ key: 'value' }); +resource = resourceClass.save({ key: 'value' }, function () { }); +resource = resourceClass.save(function () { }); +resource = resourceClass.save(function () { }, function () { }); +resource = resourceClass.save({ key: 'value' }, { key: 'value' }); +resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () { }); +resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () { }, function () { }); + +/////////////////////////////////////// +// IResource +/////////////////////////////////////// + +var promise : ng.IPromise; +var arrayPromise : ng.IPromise; + +promise = resource.$delete(); +promise = resource.$delete({ key: 'value' }); +promise = resource.$delete({ key: 'value' }, function () { }); +promise = resource.$delete(function () { }); +promise = resource.$delete(function () { }, function () { }); +promise = resource.$delete({ key: 'value' }, function () { }, function () { }); +promise.then(function(data: IMyResource) {}); + +promise = resource.$get(); +promise = resource.$get({ key: 'value' }); +promise = resource.$get({ key: 'value' }, function () { }); +promise = resource.$get(function () { }); +promise = resource.$get(function () { }, function () { }); +promise = resource.$get({ key: 'value' }, function () { }, function () { }); + +arrayPromise = resourceArray[0].$query(); +arrayPromise = resourceArray[0].$query({ key: 'value' }); +arrayPromise = resourceArray[0].$query({ key: 'value' }, function () { }); +arrayPromise = resourceArray[0].$query(function () { }); +arrayPromise = resourceArray[0].$query(function () { }, function () { }); +arrayPromise = resourceArray[0].$query({ key: 'value' }, function () { }, function () { }); +arrayPromise.then(function(data: ng.resource.IResourceArray) {}); + +promise = resource.$remove(); +promise = resource.$remove({ key: 'value' }); +promise = resource.$remove({ key: 'value' }, function () { }); +promise = resource.$remove(function () { }); +promise = resource.$remove(function () { }, function () { }); +promise = resource.$remove({ key: 'value' }, function () { }, function () { }); + +promise = resource.$save(); +promise = resource.$save({ key: 'value' }); +promise = resource.$save({ key: 'value' }, function () { }); +promise = resource.$save(function () { }); +promise = resource.$save(function () { }, function () { }); +promise = resource.$save({ key: 'value' }, function () { }, function () { }); + +/////////////////////////////////////// +// IResourceService +/////////////////////////////////////// +var resourceService: ng.resource.IResourceService; +resourceClass = resourceService('test'); +resourceClass = resourceService('test'); +resourceClass = resourceService('test'); + +/////////////////////////////////////// +// IModule +/////////////////////////////////////// +var mod: ng.IModule; +var resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction; +var resourceService: ng.resource.IResourceService; + +resourceClass = resourceServiceFactoryFunction(resourceService); + +resourceServiceFactoryFunction = function (resourceService: ng.resource.IResourceService) { return resourceClass; }; +mod = mod.factory('factory name', resourceServiceFactoryFunction); + +/////////////////////////////////////// +// IResource +/////////////////////////////////////// \ No newline at end of file diff --git a/angularjs/legacy/angular-resource-1.2.d.ts b/angularjs/legacy/angular-resource-1.2.d.ts new file mode 100644 index 0000000000..f3c3fbe65c --- /dev/null +++ b/angularjs/legacy/angular-resource-1.2.d.ts @@ -0,0 +1,152 @@ +// Type definitions for Angular JS 1.2 (ngResource module) +// Project: http://angularjs.org +// Definitions by: Diego Vilar , Michael Jess +// Definitions: https://github.com/daptiv/DefinitelyTyped + +/// + + +/////////////////////////////////////////////////////////////////////////////// +// ngResource module (angular-resource.js) +/////////////////////////////////////////////////////////////////////////////// +declare module ng.resource { + + /////////////////////////////////////////////////////////////////////////// + // ResourceService + // see https://code.angularjs.org/1.2.26/docs/api/ngResource/service/$resource + // Most of the following definitions were achieved by analyzing the + // actual implementation, since the documentation doesn't seem to cover + // that deeply. + /////////////////////////////////////////////////////////////////////////// + interface IResourceService { + (url: string, paramDefaults?: any, + /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } + where deleteDescriptor : IActionDescriptor */ + actionDescriptors?: any): IResourceClass>; + (url: string, paramDefaults?: any, + /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } + where deleteDescriptor : IActionDescriptor */ + actionDescriptors?: any): U; + (url: string, paramDefaults?: any, + /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } + where deleteDescriptor : IActionDescriptor */ + actionDescriptors?: any): IResourceClass; + } + + // Just a reference to facilitate describing new actions + interface IActionDescriptor { + method: string; + isArray?: boolean; + params?: any; + headers?: any; + } + + // Baseclass for everyresource with default actions. + // If you define your new actions for the resource, you will need + // to extend this interface and typecast the ResourceClass to it. + // + // In case of passing the first argument as anything but a function, + // it's gonna be considered data if the action method is POST, PUT or + // PATCH (in other words, methods with body). Otherwise, it's going + // to be considered as parameters to the request. + // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L461-L465 + // + // Only those methods with an HTTP body do have 'data' as first parameter: + // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L463 + // More specifically, those methods are POST, PUT and PATCH: + // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L432 + // + // Also, static calls always return the IResource (or IResourceArray) retrieved + // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L549 + interface IResourceClass { + new(dataOrParams? : any) : T; + get(): T; + get(params: Object): T; + get(success: Function, error?: Function): T; + get(params: Object, success: Function, error?: Function): T; + get(params: Object, data: Object, success?: Function, error?: Function): T; + + query(): IResourceArray; + query(params: Object): IResourceArray; + query(success: Function, error?: Function): IResourceArray; + query(params: Object, success: Function, error?: Function): IResourceArray; + query(params: Object, data: Object, success?: Function, error?: Function): IResourceArray; + + save(): T; + save(data: Object): T; + save(success: Function, error?: Function): T; + save(data: Object, success: Function, error?: Function): T; + save(params: Object, data: Object, success?: Function, error?: Function): T; + + remove(): T; + remove(params: Object): T; + remove(success: Function, error?: Function): T; + remove(params: Object, success: Function, error?: Function): T; + remove(params: Object, data: Object, success?: Function, error?: Function): T; + + delete(): T; + delete(params: Object): T; + delete(success: Function, error?: Function): T; + delete(params: Object, success: Function, error?: Function): T; + delete(params: Object, data: Object, success?: Function, error?: Function): T; + } + + // Instance calls always return the the promise of the request which retrieved the object + // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L546 + interface IResource { + $get(): ng.IPromise; + $get(params?: Object, success?: Function, error?: Function): ng.IPromise; + $get(success: Function, error?: Function): ng.IPromise; + + $query(): ng.IPromise>; + $query(params?: Object, success?: Function, error?: Function): ng.IPromise>; + $query(success: Function, error?: Function): ng.IPromise>; + + $save(): ng.IPromise; + $save(params?: Object, success?: Function, error?: Function): ng.IPromise; + $save(success: Function, error?: Function): ng.IPromise; + + $remove(): ng.IPromise; + $remove(params?: Object, success?: Function, error?: Function): ng.IPromise; + $remove(success: Function, error?: Function): ng.IPromise; + + $delete(): ng.IPromise; + $delete(params?: Object, success?: Function, error?: Function): ng.IPromise; + $delete(success: Function, error?: Function): ng.IPromise; + + /** the promise of the original server interaction that created this instance. **/ + $promise : ng.IPromise; + $resolved : boolean; + } + + /** + * Really just a regular Array object with $promise and $resolve attached to it + */ + interface IResourceArray extends Array { + /** the promise of the original server interaction that created this collection. **/ + $promise : ng.IPromise>; + $resolved : boolean; + } + + /** when creating a resource factory via IModule.factory */ + interface IResourceServiceFactoryFunction { + ($resource: ng.resource.IResourceService): IResourceClass; + >($resource: ng.resource.IResourceService): U; + } +} + +/** extensions to base ng based on using angular-resource */ +declare module ng { + + interface IModule { + /** creating a resource service factory */ + factory(name: string, resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction): IModule; + } +} + +interface Array +{ + /** the promise of the original server interaction that created this collection. **/ + $promise : ng.IPromise>; + $resolved : boolean; +} diff --git a/angularjs/legacy/angular-route-1.2-tests.ts b/angularjs/legacy/angular-route-1.2-tests.ts new file mode 100644 index 0000000000..0b82110ef2 --- /dev/null +++ b/angularjs/legacy/angular-route-1.2-tests.ts @@ -0,0 +1,17 @@ +/// + +/** + * @license HTTP Auth Interceptor Module for AngularJS + * (c) 2013 Jonathan Park @ Daptiv Solutions Inc + * License: MIT + */ + +declare var $routeProvider: ng.route.IRouteProvider; +$routeProvider + .when('/projects/:projectId/dashboard',{ + controller: '', + templateUrl: '', + caseInsensitiveMatch: true, + reloadOnSearch: false + }) + .otherwise({redirectTo: '/'}); diff --git a/angularjs/legacy/angular-route-1.2.d.ts b/angularjs/legacy/angular-route-1.2.d.ts new file mode 100644 index 0000000000..7afd4af5a5 --- /dev/null +++ b/angularjs/legacy/angular-route-1.2.d.ts @@ -0,0 +1,145 @@ +// Type definitions for Angular JS 1.2 (ngRoute module) +// Project: http://angularjs.org +// Definitions by: Jonathan Park +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + + +/////////////////////////////////////////////////////////////////////////////// +// ngRoute module (angular-route.js) +/////////////////////////////////////////////////////////////////////////////// +declare module ng.route { + + /////////////////////////////////////////////////////////////////////////// + // RouteParamsService + // see https://code.angularjs.org/1.2.26/docs/api/ngRoute/service/$routeParams + /////////////////////////////////////////////////////////////////////////// + interface IRouteParamsService { + [key: string]: any; + } + + /////////////////////////////////////////////////////////////////////////// + // RouteService + // see https://code.angularjs.org/1.2.26/docs/api/ngRoute/service/$route + // see https://code.angularjs.org/1.2.26/docs/api/ngRoute/provider/$routeProvider + /////////////////////////////////////////////////////////////////////////// + interface IRouteService { + /** + * Causes $route service to reload the current route even if $location hasn't changed. + * As a result of that, ngView creates new scope, reinstantiates the controller. + */ + reload(): void; + + /** + * Object with all route configuration Objects as its properties. + */ + routes: any; + + // May not always be available. For instance, current will not be available + // to a controller that was not initialized as a result of a route maching. + current?: ICurrentRoute; + } + + + /** + * see https://code.angularjs.org/1.2.26/docs/api/ngRoute/provider/$routeProvider#when for API documentation + */ + interface IRoute { + /** + * {(string|function()=} + * Controller fn that should be associated with newly created scope or the name of a registered controller if passed as a string. + */ + controller?: any; + /** + * A controller alias name. If present the controller will be published to scope under the controllerAs name. + */ + controllerAs?: string; + /** + * Undocumented? + */ + name?: string; + /** + * {string=|function()=} + * Html template as a string or a function that returns an html template as a string which should be used by ngView or ngInclude directives. This property takes precedence over templateUrl. + * + * If template is a function, it will be called with the following parameters: + * + * {Array.} - route parameters extracted from the current $location.path() by applying the current route + */ + template?: string; + /** + * {string=|function()=} + * Path or function that returns a path to an html template that should be used by ngView. + * + * If templateUrl is a function, it will be called with the following parameters: + * + * {Array.} - route parameters extracted from the current $location.path() by applying the current route + */ + templateUrl?: any; + /** + * {Object.=} - An optional map of dependencies which should be injected into the controller. If any of these dependencies are promises, the router will wait for them all to be resolved or one to be rejected before the controller is instantiated. If all the promises are resolved successfully, the values of the resolved promises are injected and $routeChangeSuccess event is fired. If any of the promises are rejected the $routeChangeError event is fired. The map object is: + * + * - key - {string}: a name of a dependency to be injected into the controller. + * - factory - {string|function}: If string then it is an alias for a service. Otherwise if function, then it is injected and the return value is treated as the dependency. If the result is a promise, it is resolved before its value is injected into the controller. Be aware that ngRoute.$routeParams will still refer to the previous route within these resolve functions. Use $route.current.params to access the new route parameters, instead. + */ + resolve?: {[key: string]: any}; + /** + * {(string|function())=} + * Value to update $location path with and trigger route redirection. + * + * If redirectTo is a function, it will be called with the following parameters: + * + * - {Object.} - route parameters extracted from the current $location.path() by applying the current route templateUrl. + * - {string} - current $location.path() + * - {Object} - current $location.search() + * - The custom redirectTo function is expected to return a string which will be used to update $location.path() and $location.search(). + */ + redirectTo?: any; + /** + * Reload route when only $location.search() or $location.hash() changes. + * + * This option defaults to true. If the option is set to false and url in the browser changes, then $routeUpdate event is broadcasted on the root scope. + */ + reloadOnSearch?: boolean; + /** + * Match routes without being case sensitive + * + * This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive + */ + caseInsensitiveMatch?: boolean; + } + + // see https://code.angularjs.org/1.2.26/docs/api/ngRoute/service/$route#current + interface ICurrentRoute extends IRoute { + locals: { + $scope: IScope; + $template: string; + }; + + params: any; + } + + interface IRouteProvider extends IServiceProvider { + /** + * Sets route definition that will be used on route change when no other route definition is matched. + * + * @params Mapping information to be assigned to $route.current. + */ + otherwise(params: IRoute): IRouteProvider; + /** + * Adds a new route definition to the $route service. + * + * @param path Route path (matched against $location.path). If $location.path contains redundant trailing slash or is missing one, the route will still match and the $location.path will be updated to add or drop the trailing slash to exactly match the route definition. + * + * - path can contain named groups starting with a colon: e.g. :name. All characters up to the next slash are matched and stored in $routeParams under the given name when the route matches. + * - path can contain named groups starting with a colon and ending with a star: e.g.:name*. All characters are eagerly stored in $routeParams under the given name when the route matches. + * - path can contain optional named groups with a question mark: e.g.:name?. + * + * For example, routes like /color/:color/largecode/:largecode*\/edit will match /color/brown/largecode/code/with/slashes/edit and extract: color: brown and largecode: code/with/slashes. + * + * @param route Mapping information to be assigned to $route.current on route match. + */ + when(path: string, route: IRoute): IRouteProvider; + } +} diff --git a/angularjs/legacy/angular-sanitize-1.2-tests.ts b/angularjs/legacy/angular-sanitize-1.2-tests.ts new file mode 100644 index 0000000000..853bbf3495 --- /dev/null +++ b/angularjs/legacy/angular-sanitize-1.2-tests.ts @@ -0,0 +1,10 @@ +/// + +var shouldBeString: string; + +declare var $sanitizeService: ng.sanitize.ISanitizeService; +shouldBeString = $sanitizeService(shouldBeString); + +declare var $linky: ng.sanitize.filter.ILinky; +shouldBeString = $linky(shouldBeString); +shouldBeString = $linky(shouldBeString, shouldBeString); diff --git a/angularjs/legacy/angular-sanitize-1.2.d.ts b/angularjs/legacy/angular-sanitize-1.2.d.ts new file mode 100644 index 0000000000..4c6805c9a4 --- /dev/null +++ b/angularjs/legacy/angular-sanitize-1.2.d.ts @@ -0,0 +1,35 @@ +// Type definitions for Angular JS 1.2 (ngSanitize module) +// Project: http://angularjs.org +// Definitions by: Diego Vilar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +/////////////////////////////////////////////////////////////////////////////// +// ngSanitize module (angular-sanitize.js) +/////////////////////////////////////////////////////////////////////////////// +declare module ng.sanitize { + + /////////////////////////////////////////////////////////////////////////// + // SanitizeService + // see https://code.angularjs.org/1.2.26/docs/api/ngSanitize/service/$sanitize + /////////////////////////////////////////////////////////////////////////// + interface ISanitizeService { + (html: string): string; + } + + /////////////////////////////////////////////////////////////////////////// + // Filters included with the ngSanitize + // see https://code.angularjs.org/1.2.26/docs/api/ngSanitize/filter + /////////////////////////////////////////////////////////////////////////// + export module filter { + + // Finds links in text input and turns them into html links. + // Supports http/https/ftp/mailto and plain email address links. + // see https://code.angularjs.org/1.2.26/docs/api/ngSanitize/filter/linky + interface ILinky { + (text: string, target?: string): string; + } + } +} diff --git a/angularjs/legacy/angular-scenario-1.0.d.ts b/angularjs/legacy/angular-scenario-1.0.d.ts index 8dd605f7d8..a44b79096c 100644 --- a/angularjs/legacy/angular-scenario-1.0.d.ts +++ b/angularjs/legacy/angular-scenario-1.0.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular Scenario Testing +// Type definitions for Angular Scenario Testing 1.0 (ngScenario module) // Project: [http://angularjs.org] // Definitions by: [RomanoLindano] // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/angularjs/legacy/angular-scenario-1.2.d.ts b/angularjs/legacy/angular-scenario-1.2.d.ts new file mode 100644 index 0000000000..9e72db8956 --- /dev/null +++ b/angularjs/legacy/angular-scenario-1.2.d.ts @@ -0,0 +1,166 @@ +// Type definitions for Angular Scenario Testing 1.2 (ngScenario module) +// Project: http://angularjs.org +// Definitions by: RomanoLindano +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module ng { + export interface IAngularStatic { + scenario: any; + } +} + +declare module angularScenario { + + export interface RunFunction { + (functionToRun: any): any; + } + export interface RunFunctionWithDescription { + (description: string, functionToRun: any): any; + } + + export interface PauseFunction { + (): any; + } + + export interface SleepFunction { + (seconds: number): any; + } + + export interface Future { + } + + export interface testWindow { + href(): Future; + path(): Future; + search(): Future; + hash(): Future; + } + + export interface testLocation { + url(): Future; + path(): Future; + search(): Future; + hash(): Future; + } + + export interface Browser { + navigateTo(url: string): void; + navigateTo(urlDescription: string, urlFunction: () => string): void; + reload(): void; + window(): testWindow; + location(): testLocation; + } + + export interface Matchers { + toEqual(value: any): void; + toBe(value: any): void; + toBeDefined(): void; + toBeTruthy(): void; + toBeFalsy(): void; + toMatch(regularExpression: any): void; + toBeNull(): void; + toContain(value: any): void; + toBeLessThan(value: any): void; + toBeGreaterThan(value: any): void; + } + + export interface CustomMatchers extends Matchers { + } + + export interface Expect extends CustomMatchers { + not(): angularScenario.CustomMatchers; + } + + export interface UsingFunction { + (selector: string, selectorDescription?: string): void; + } + + export interface BindingFunction { + (bracketBindingExpression: string): Future; + } + + export interface Input { + enter(value: any): any; + check(): any; + select(radioButtonValue: any): any; + val(): Future; + } + + export interface Repeater { + count(): Future; + row(index: number): Future; + column(ngBindingExpression: string): Future; + } + + export interface Select { + option(value: any): any; + option(...listOfValues: any[]): any; + } + + export interface Element { + count(): Future; + click(): any; + dblclick(): any; + mouseover(): any; + mousedown(): any; + mouseup(): any; + query(callback: (selectedDOMElements: JQuery, callbackWhenDone: (objNull: any, futureValue: any) => any) => any): any; + val(): Future; + text(): Future; + html(): Future; + height(): Future; + innerHeight(): Future; + outerHeight(): Future; + width(): Future; + innerWidth(): Future; + outerWidth(): Future; + position(): Future; + scrollLeft(): Future; + scrollTop(): Future; + offset(): Future; + + val(value: any): void; + text(value: any): void; + html(value: any): void; + height(value: any): void; + innerHeight(value: any): void; + outerHeight(value: any): void; + width(value: any): void; + innerWidth(value: any): void; + outerWidth(value: any): void; + position(value: any): void; + scrollLeft(value: any): void; + scrollTop(value: any): void; + offset(value: any): void; + + attr(key: any): Future; + prop(key: any): Future; + css(key: any): Future; + + attr(key: any, value: any): void; + prop(key: any, value: any): void; + css(key: any, value: any): void; + } +} + +declare var describe: angularScenario.RunFunctionWithDescription; +declare var ddescribe: angularScenario.RunFunctionWithDescription; +declare var xdescribe: angularScenario.RunFunctionWithDescription; +declare var beforeEach: angularScenario.RunFunction; +declare var afterEach: angularScenario.RunFunction; +declare var it: angularScenario.RunFunctionWithDescription; +declare var iit: angularScenario.RunFunctionWithDescription; +declare var xit: angularScenario.RunFunctionWithDescription; +declare var pause: angularScenario.PauseFunction; +declare var sleep: angularScenario.SleepFunction; +declare function browser(): angularScenario.Browser; +declare function expect(expectation: angularScenario.Future): angularScenario.Expect; +declare var using: angularScenario.UsingFunction; +declare var binding: angularScenario.BindingFunction; +declare function input(ngModelBinding: string): angularScenario.Input; +declare function repeater(selector: string, repeaterDescription?: string): angularScenario.Repeater; +declare function select(ngModelBinding: string): angularScenario.Select; +declare function element(selector: string, elementDescription?: string): angularScenario.Element; +declare var angular: ng.IAngularStatic; From a012987c65e53119c57a76403d1797dbe3367e15 Mon Sep 17 00:00:00 2001 From: PROGRE Date: Fri, 7 Nov 2014 07:01:15 +0900 Subject: [PATCH 30/42] fix String to string --- socket.io/socket.io.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index ddf7ff11bb..b6aad32931 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -33,7 +33,7 @@ declare module SocketIO { listen(port: number, opts: any): Server; bind(srv: any): Server; onconnection(socket: any): Server; - of(nsp: String): Namespace; + of(nsp: string): Namespace; emit(name: string, ...args: any[]): Socket; use(fn: Function): Namespace; @@ -43,7 +43,7 @@ declare module SocketIO { } interface Namespace extends NodeJS.EventEmitter { - name: String; + name: string; connected: { [id: number]: Socket }; use(fn: Function): Namespace From 24bf981aba084453a946f3a4f588cd2c90a0d4c9 Mon Sep 17 00:00:00 2001 From: in-async Date: Fri, 7 Nov 2014 17:49:10 +0900 Subject: [PATCH 31/42] =?UTF-8?q?=E4=BD=9C=E6=A5=AD=E9=80=94=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- firebase/firebase-tests.ts | 142 +++++++++++++++++++++++++++++++++++++ firebase/firebase.d.ts | 96 ++++++++++++++++++++++++- 2 files changed, 235 insertions(+), 3 deletions(-) diff --git a/firebase/firebase-tests.ts b/firebase/firebase-tests.ts index eb6be83734..647ecb663d 100644 --- a/firebase/firebase-tests.ts +++ b/firebase/firebase-tests.ts @@ -11,6 +11,94 @@ dataRef.auth(AUTH_TOKEN, function(error, result) { } }); +// Log me in +dataRef.authWithCustomToken(AUTH_TOKEN, function(error, authData) { + if (error) { + console.log('Login Failed!', error); + } else { + console.log('Authenticated successfully with payload:', authData); + } +}); + +// Log me in +dataRef.authAnonymously(function(error, authData) { + if (error) { + console.log('Login Failed!', error); + } else { + console.log('Authenticated successfully with payload:', authData); + } +}); + +// Log me in +dataRef.authWithPassword({ + "email" : "bobtony@firebase.com", + "password" : "correcthorsebatterystaple" +}, function(error, authData) { + if (error) { + console.log('Login Failed!', error); + } else { + console.log('Authenticated successfully with payload:', authData); + } +}); + +// Log me in +dataRef.authWithOAuthPopup("twitter", function(error, authData) { + if (error) { + console.log('Login Failed!', error); + } else { + console.log('Authenticated successfully with payload:', authData); + } +}); + +// Log me in +dataRef.authWithOAuthRedirect("twitter", function(error) { + if (error) { + console.log('Login Failed!', error); + } else { + // We'll never get here, as the page will redirect on success. + } +}); + +// Authenticate with Facebook using an existing OAuth 2.0 access token +dataRef.authWithOAuthToken("facebook", "", function(error, authData) { + if (error) { + console.log('Login Failed!', error); + } else { + console.log('Authenticated successfully with payload:', authData); + } +}); +// Authenticate with Twitter using an existing OAuth 1.0a credential set +dataRef.authWithOAuthToken("twitter", { + "user_id" : "", + "oauth_token" : "", + "oauth_token_secret" : "", +}, function(error, authData) { + if (error) { + console.log('Login Failed!', error); + } else { + console.log('Authenticated successfully with payload:', authData); + } +}); + +var authData = dataRef.getAuth(); +if (authData) { + console.log('Authenticated user with uid:', authData.uid); +} + +var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com'); +firebaseRef.onAuth(function(authData) { + if (authData) { + console.log('Client is authenticated with uid ' + authData.uid); + } else { + // Client is unauthenticated + } +}); + +var onAuthChange = function(authData) { /*...*/ }; +firebaseRef.onAuth(onAuthChange); +// Sometime later... +firebaseRef.offAuth(onAuthChange); + //Time to log out! dataRef.unauth(); @@ -32,10 +120,64 @@ var sampleChatRef2 :Firebase= fredRef2.root(); var x3:string = sampleChatRef2.toString(); // x is now 'https://SampleChat.firebaseIO-demo.com'. +var fredRef = new Firebase("https://samplechat.firebaseio-demo.com/users/fred"); +var key = fredRef.key(); // key === "fred" +key = fredRef.child("name/last").key(); // key === "last" +key = fredRef.root().key(); // key === null, since fredRef refers to the root of the Firebase. + var fredRef3:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred'); var x4:string = fredRef3.name(); // x is now 'fred'. +/* + * $set + */ +var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name'); +fredNameRef.child('first').set('Fred'); +fredNameRef.child('last').set('Flintstone'); +// We've written 'Fred' to the Firebase location storing fred's first name, +// and 'Flintstone' to the location storing his last name + +fredNameRef.set({ first: 'Fred', last: 'Flintstone' }); +// Exact same effect as the previous example, except we've written +// fred's first and last name simultaneously + +var onComplete = function(error) { + if (error) { + console.log('Synchronization failed'); + } else { + console.log('Synchronization succeeded'); + } +}; +fredNameRef.set({ first: 'Fred', last: 'Flintstone' }, onComplete); +// Same as the previous example, except we will also log a message +// when the data has finished synchronizing + + +/* + * $update + */ +var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name'); +// Modify the 'first' and 'last' children, but leave other data at fredNameRef unchanged +fredNameRef.update({ first: 'Fred', last: 'Flintstone' }); + +// Same as the previous example, except we will also display an alert +// message when the data has finished synchronizing. +var onComplete = function(error) { + if (error) { + console.log('Synchronization failed'); + } else { + console.log('Synchronization succeeded'); + } +}; +fredNameRef.update({ first: 'Wilma', last: 'Flintstone' }, onComplete); + +var fredRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred'); +//The following 2 function calls are equivalent +fredRef.update({ name: { first: 'Fred', last: 'Flintstone' }}); +fredRef.child('name').set({ first: 'Fred', last: 'Flintstone' }); + + // Increment Fred's rank by 1. var fredRankRef:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred/rank'); fredRankRef.transaction(function(currentRank: number) { diff --git a/firebase/firebase.d.ts b/firebase/firebase.d.ts index bac32fbc63..796d14d59e 100644 --- a/firebase/firebase.d.ts +++ b/firebase/firebase.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Firebase API +// Type definitions for Firebase API 2.0.2 // Project: https://www.firebase.com/docs/javascript/firebase // Definitions by: Vincent Botone // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -43,16 +43,92 @@ interface IFirebaseQuery { } declare class Firebase implements IFirebaseQuery { + /** + * Constructs a new Firebase reference from a full Firebase URL. + */ constructor(firebaseURL: string); - auth(authToken: string, onComplete?: (error: any, result: IFirebaseAuthResult) => void, onCancel?:(error: any) => void): void; + /** + * @deprecated Use authWithCustomToken() instead. + * Authenticates a Firebase client using the provided authentication token or Firebase Secret. + */ + auth(authToken: string, onComplete?: (error: any, result: IFirebaseAuthResult) => void, onCancel?: (error: any) => void): void; + /** + * Authenticates a Firebase client using an authentication token or Firebase Secret. + */ + authWithCustomToken(autoToken: string, onComplete: (error: any, authData: IFirebaseAuthData) => void, options?:Object): void; + /** + * Authenticates a Firebase client using a new, temporary guest account. + */ + authAnonymously(onComplete: (error: any, authData: IFirebaseAuthData) => void, options?: Object): void; + /** + * Authenticates a Firebase client using an email / password combination. + */ + authWithPassword(credentials: IFirebaseCredentials, onComplete: (error: any, authData: IFirebaseAuthData) => void, options?: Object): void; + /** + * Authenticates a Firebase client using a popup-based OAuth flow. + */ + authWithOAuthPopup(provider: string, onComplete:(error: any, authData: IFirebaseAuthData) => void, options?: Object): void; + /** + * Authenticates a Firebase client using a redirect-based OAuth flow. + */ + authWithOAuthRedirect(provider: string, onComplete: (error: any) => void, options?: Object): void; + /** + * Authenticates a Firebase client using OAuth access tokens or credentials. + */ + authWithOAuthToken(provider: string, credentials: string, onComplete: (error: any, authData: IFirebaseAuthData) => void, options?: Object): void; + authWithOAuthToken(provider: string, credentials: Object, onComplete: (error: any, authData: IFirebaseAuthData) => void, options?: Object): void; + /** + * Synchronously access the current authentication state of the client. + */ + getAuth(): IFirebaseAuthData; + /** + * Listen for changes to the client's authentication state. + */ + onAuth(onComplete: (authData: IFirebaseAuthData) => void, context?: Object): void; + /** + * Detaches a callback previously attached with onAuth(). + */ + offAuth(onComplete: (authData: IFirebaseAuthData) => void, context?: Object): void; + /** + * Unauthenticates a Firebase client. + */ unauth(): void; + /** + * Gets a Firebase reference for the location at the specified relative path. + */ child(childPath: string): Firebase; + /** + * Gets a Firebase reference to the parent location. + */ parent(): Firebase; + /** + * Gets a Firebase reference to the root of the Firebase. + */ root(): Firebase; + /** + * Returns the last token in a Firebase location. + */ + key(): string; + /** + * @deprecated Use key() instead. + * Returns the last token in a Firebase location. + */ name(): string; + /** + * Gets the absolute URL corresponding to this Firebase reference's location. + */ toString(): string; + /** + * Writes data to this Firebase location. + */ set(value: any, onComplete?: (error: any) => void): void; - update(value: any, onComplete?: (error: any) => void): void; + /** + * Writes the enumerated children to this Firebase location. + */ + update(value: Object, onComplete?: (error: any) => void): void; + /** + * + */ remove(onComplete?: (error: any) => void): void; push(value: any, onComplete?: (error: any) => void): Firebase; setWithPriority(value: any, priority: string, onComplete?: (error: any) => void): void; @@ -73,3 +149,17 @@ declare class Firebase implements IFirebaseQuery { goOffline(): void; goOnline(): void; } + +// Reference: https://www.firebase.com/docs/web/api/firebase/getauth.html +interface IFirebaseAuthData { + uid: string; + provider: string; + token: string; + expires: number; + auth: Object; +} + +interface IFirebaseCredentials { + email: string; + password: string; +} \ No newline at end of file From 154c40d628946ea6b6b15dc9fc341f47036ccf0b Mon Sep 17 00:00:00 2001 From: in-async Date: Fri, 7 Nov 2014 17:56:53 +0900 Subject: [PATCH 32/42] =?UTF-8?q?Revert=20"=E4=BD=9C=E6=A5=AD=E9=80=94?= =?UTF-8?q?=E4=B8=AD"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 24bf981aba084453a946f3a4f588cd2c90a0d4c9. --- firebase/firebase-tests.ts | 142 ------------------------------------- firebase/firebase.d.ts | 96 +------------------------ 2 files changed, 3 insertions(+), 235 deletions(-) diff --git a/firebase/firebase-tests.ts b/firebase/firebase-tests.ts index 647ecb663d..eb6be83734 100644 --- a/firebase/firebase-tests.ts +++ b/firebase/firebase-tests.ts @@ -11,94 +11,6 @@ dataRef.auth(AUTH_TOKEN, function(error, result) { } }); -// Log me in -dataRef.authWithCustomToken(AUTH_TOKEN, function(error, authData) { - if (error) { - console.log('Login Failed!', error); - } else { - console.log('Authenticated successfully with payload:', authData); - } -}); - -// Log me in -dataRef.authAnonymously(function(error, authData) { - if (error) { - console.log('Login Failed!', error); - } else { - console.log('Authenticated successfully with payload:', authData); - } -}); - -// Log me in -dataRef.authWithPassword({ - "email" : "bobtony@firebase.com", - "password" : "correcthorsebatterystaple" -}, function(error, authData) { - if (error) { - console.log('Login Failed!', error); - } else { - console.log('Authenticated successfully with payload:', authData); - } -}); - -// Log me in -dataRef.authWithOAuthPopup("twitter", function(error, authData) { - if (error) { - console.log('Login Failed!', error); - } else { - console.log('Authenticated successfully with payload:', authData); - } -}); - -// Log me in -dataRef.authWithOAuthRedirect("twitter", function(error) { - if (error) { - console.log('Login Failed!', error); - } else { - // We'll never get here, as the page will redirect on success. - } -}); - -// Authenticate with Facebook using an existing OAuth 2.0 access token -dataRef.authWithOAuthToken("facebook", "", function(error, authData) { - if (error) { - console.log('Login Failed!', error); - } else { - console.log('Authenticated successfully with payload:', authData); - } -}); -// Authenticate with Twitter using an existing OAuth 1.0a credential set -dataRef.authWithOAuthToken("twitter", { - "user_id" : "", - "oauth_token" : "", - "oauth_token_secret" : "", -}, function(error, authData) { - if (error) { - console.log('Login Failed!', error); - } else { - console.log('Authenticated successfully with payload:', authData); - } -}); - -var authData = dataRef.getAuth(); -if (authData) { - console.log('Authenticated user with uid:', authData.uid); -} - -var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com'); -firebaseRef.onAuth(function(authData) { - if (authData) { - console.log('Client is authenticated with uid ' + authData.uid); - } else { - // Client is unauthenticated - } -}); - -var onAuthChange = function(authData) { /*...*/ }; -firebaseRef.onAuth(onAuthChange); -// Sometime later... -firebaseRef.offAuth(onAuthChange); - //Time to log out! dataRef.unauth(); @@ -120,64 +32,10 @@ var sampleChatRef2 :Firebase= fredRef2.root(); var x3:string = sampleChatRef2.toString(); // x is now 'https://SampleChat.firebaseIO-demo.com'. -var fredRef = new Firebase("https://samplechat.firebaseio-demo.com/users/fred"); -var key = fredRef.key(); // key === "fred" -key = fredRef.child("name/last").key(); // key === "last" -key = fredRef.root().key(); // key === null, since fredRef refers to the root of the Firebase. - var fredRef3:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred'); var x4:string = fredRef3.name(); // x is now 'fred'. -/* - * $set - */ -var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name'); -fredNameRef.child('first').set('Fred'); -fredNameRef.child('last').set('Flintstone'); -// We've written 'Fred' to the Firebase location storing fred's first name, -// and 'Flintstone' to the location storing his last name - -fredNameRef.set({ first: 'Fred', last: 'Flintstone' }); -// Exact same effect as the previous example, except we've written -// fred's first and last name simultaneously - -var onComplete = function(error) { - if (error) { - console.log('Synchronization failed'); - } else { - console.log('Synchronization succeeded'); - } -}; -fredNameRef.set({ first: 'Fred', last: 'Flintstone' }, onComplete); -// Same as the previous example, except we will also log a message -// when the data has finished synchronizing - - -/* - * $update - */ -var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name'); -// Modify the 'first' and 'last' children, but leave other data at fredNameRef unchanged -fredNameRef.update({ first: 'Fred', last: 'Flintstone' }); - -// Same as the previous example, except we will also display an alert -// message when the data has finished synchronizing. -var onComplete = function(error) { - if (error) { - console.log('Synchronization failed'); - } else { - console.log('Synchronization succeeded'); - } -}; -fredNameRef.update({ first: 'Wilma', last: 'Flintstone' }, onComplete); - -var fredRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred'); -//The following 2 function calls are equivalent -fredRef.update({ name: { first: 'Fred', last: 'Flintstone' }}); -fredRef.child('name').set({ first: 'Fred', last: 'Flintstone' }); - - // Increment Fred's rank by 1. var fredRankRef:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred/rank'); fredRankRef.transaction(function(currentRank: number) { diff --git a/firebase/firebase.d.ts b/firebase/firebase.d.ts index 796d14d59e..bac32fbc63 100644 --- a/firebase/firebase.d.ts +++ b/firebase/firebase.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Firebase API 2.0.2 +// Type definitions for Firebase API // Project: https://www.firebase.com/docs/javascript/firebase // Definitions by: Vincent Botone // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -43,92 +43,16 @@ interface IFirebaseQuery { } declare class Firebase implements IFirebaseQuery { - /** - * Constructs a new Firebase reference from a full Firebase URL. - */ constructor(firebaseURL: string); - /** - * @deprecated Use authWithCustomToken() instead. - * Authenticates a Firebase client using the provided authentication token or Firebase Secret. - */ - auth(authToken: string, onComplete?: (error: any, result: IFirebaseAuthResult) => void, onCancel?: (error: any) => void): void; - /** - * Authenticates a Firebase client using an authentication token or Firebase Secret. - */ - authWithCustomToken(autoToken: string, onComplete: (error: any, authData: IFirebaseAuthData) => void, options?:Object): void; - /** - * Authenticates a Firebase client using a new, temporary guest account. - */ - authAnonymously(onComplete: (error: any, authData: IFirebaseAuthData) => void, options?: Object): void; - /** - * Authenticates a Firebase client using an email / password combination. - */ - authWithPassword(credentials: IFirebaseCredentials, onComplete: (error: any, authData: IFirebaseAuthData) => void, options?: Object): void; - /** - * Authenticates a Firebase client using a popup-based OAuth flow. - */ - authWithOAuthPopup(provider: string, onComplete:(error: any, authData: IFirebaseAuthData) => void, options?: Object): void; - /** - * Authenticates a Firebase client using a redirect-based OAuth flow. - */ - authWithOAuthRedirect(provider: string, onComplete: (error: any) => void, options?: Object): void; - /** - * Authenticates a Firebase client using OAuth access tokens or credentials. - */ - authWithOAuthToken(provider: string, credentials: string, onComplete: (error: any, authData: IFirebaseAuthData) => void, options?: Object): void; - authWithOAuthToken(provider: string, credentials: Object, onComplete: (error: any, authData: IFirebaseAuthData) => void, options?: Object): void; - /** - * Synchronously access the current authentication state of the client. - */ - getAuth(): IFirebaseAuthData; - /** - * Listen for changes to the client's authentication state. - */ - onAuth(onComplete: (authData: IFirebaseAuthData) => void, context?: Object): void; - /** - * Detaches a callback previously attached with onAuth(). - */ - offAuth(onComplete: (authData: IFirebaseAuthData) => void, context?: Object): void; - /** - * Unauthenticates a Firebase client. - */ + auth(authToken: string, onComplete?: (error: any, result: IFirebaseAuthResult) => void, onCancel?:(error: any) => void): void; unauth(): void; - /** - * Gets a Firebase reference for the location at the specified relative path. - */ child(childPath: string): Firebase; - /** - * Gets a Firebase reference to the parent location. - */ parent(): Firebase; - /** - * Gets a Firebase reference to the root of the Firebase. - */ root(): Firebase; - /** - * Returns the last token in a Firebase location. - */ - key(): string; - /** - * @deprecated Use key() instead. - * Returns the last token in a Firebase location. - */ name(): string; - /** - * Gets the absolute URL corresponding to this Firebase reference's location. - */ toString(): string; - /** - * Writes data to this Firebase location. - */ set(value: any, onComplete?: (error: any) => void): void; - /** - * Writes the enumerated children to this Firebase location. - */ - update(value: Object, onComplete?: (error: any) => void): void; - /** - * - */ + update(value: any, onComplete?: (error: any) => void): void; remove(onComplete?: (error: any) => void): void; push(value: any, onComplete?: (error: any) => void): Firebase; setWithPriority(value: any, priority: string, onComplete?: (error: any) => void): void; @@ -149,17 +73,3 @@ declare class Firebase implements IFirebaseQuery { goOffline(): void; goOnline(): void; } - -// Reference: https://www.firebase.com/docs/web/api/firebase/getauth.html -interface IFirebaseAuthData { - uid: string; - provider: string; - token: string; - expires: number; - auth: Object; -} - -interface IFirebaseCredentials { - email: string; - password: string; -} \ No newline at end of file From 6d9f08eda8b2f7e8560095801b3a3d88b5c11ca6 Mon Sep 17 00:00:00 2001 From: Shinya Ohira Date: Fri, 7 Nov 2014 23:31:02 +0900 Subject: [PATCH 33/42] Fix server.method --- hapi/hapi-tests.ts | 30 ++++++++++++++++++++++++++++++ hapi/hapi.d.ts | 4 ++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/hapi/hapi-tests.ts b/hapi/hapi-tests.ts index da28b97a37..586d3d29f8 100644 --- a/hapi/hapi-tests.ts +++ b/hapi/hapi-tests.ts @@ -25,6 +25,36 @@ server.pack.register([plugin], (err: Object) => { if (err) { throw err; } }); +// Add server method +var add = function (a: number, b: number, next: (err: any, result?: any, ttl?: number) => void) { + next(null, a + b); +}; + +server.method('sum', add, { cache: { expiresIn: 2000 } }); + +server.methods.sum(4, 5, (err: any, result: any) => { + console.log(result); +}); + +var addArray = function (array: Array, next: (err: any, result?: any, ttl?: number) => void) { + var sum: number = 0; + array.forEach((item: number) => { + sum += item; + }); + next(null, sum); +}; + +server.method('sumObj', addArray, { + cache: { expiresIn: 2000 }, + generateKey: (array: Array) => { + return array.join(','); + } +}); + +server.methods.sumObj([5, 6], (err: any, result: any) => { + console.log(result); +}); + // Add the route server.route({ method: 'GET', diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 09453737ad..de65efcdc8 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -279,7 +279,7 @@ declare module Hapi { export class Server { app: any; - methods: Array<() => void>; + methods: any; info: { port: number; host?: string; @@ -336,7 +336,7 @@ declare module Hapi { }; ext(event: any, method: string, options?: any): void; method(method: Array<{name: string; fn: () => void; options: any}>): void; - method(name: string, fn: () => void, options: any): void; + method(name: string, fn: Function, options: any): void; inject(options: any, callback: any): void; handler(name: string, method: (name: string, options: any) => void): void; } From fd5dbacc769bab316b82a052e1c58f7fd72bf88c Mon Sep 17 00:00:00 2001 From: MIZUNE Pine Date: Sat, 8 Nov 2014 03:42:15 +0900 Subject: [PATCH 34/42] Fix ajaxSettings --- zepto/zepto.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zepto/zepto.d.ts b/zepto/zepto.d.ts index aa497b03f9..b01df91739 100644 --- a/zepto/zepto.d.ts +++ b/zepto/zepto.d.ts @@ -1580,13 +1580,20 @@ interface ZeptoAjaxSettings { data?: any; processData?: boolean; contentType?: string; + mimeType?: string; dataType?: string; + jsonp?: string; + jsonpCallback?: any; // string or Function timeout?: number; headers?: { [key: string]: string }; async?: boolean; global?: boolean; context?: any; traditional?: boolean; + cache?: boolean; + xhrFields?: { [key: string]: any }; + username?: string; + password?: string; beforeSend?: (xhr: XMLHttpRequest, settings: ZeptoAjaxSettings) => boolean; success?: (data: any, status: string, xhr: XMLHttpRequest) => void; error?: (xhr: XMLHttpRequest, errorType: string, error: Error) => void; From 17641114cc82526031fd20b966c8a2d73e9531f8 Mon Sep 17 00:00:00 2001 From: John Vilk Date: Fri, 7 Nov 2014 17:01:09 -0500 Subject: [PATCH 35/42] Adding definition file for adm-zip. --- CONTRIBUTORS.md | 1 + adm-zip/adm-zip-tests.ts | 33 +++++ adm-zip/adm-zip.d.ts | 300 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 334 insertions(+) create mode 100644 adm-zip/adm-zip-tests.ts create mode 100644 adm-zip/adm-zip.d.ts diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index f4665695e0..4dbaecc21b 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -7,6 +7,7 @@ All definitions files include a header with the author and editors, so at some p * [accounting.js](http://josscrowcroft.github.io/accounting.js/) (by [Sergey Gerasimov](https://github.com/gerich-home)) * [Ace Cloud9 Editor](http://ace.ajax.org/) (by [Diullei Gomes](https://github.com/Diullei)) * [Add To Home Screen](http://cubiq.org/add-to-home-screen) (by [James Wilkins](http://www.codeplex.com/site/users/view/jamesnw)) +* [adm-zip](https://github.com/cthackers/adm-zip) (by [John Vilk](https://github.com/jvilk/)) * [AmCharts](http://www.amcharts.com/) (by [Covobonomo](https://github.com/covobonomo/)) * [AngularAgility](https://github.com/AngularAgility/AngularAgility) (by [Roland Zwaga](https://github.com/rolandzwaga)) * [AngularBootstrapLightbox](https://github.com/compact/angular-bootstrap-lightbox) (by [Roland Zwaga](https://github.com/rolandzwaga)) diff --git a/adm-zip/adm-zip-tests.ts b/adm-zip/adm-zip-tests.ts new file mode 100644 index 0000000000..f8583ae617 --- /dev/null +++ b/adm-zip/adm-zip-tests.ts @@ -0,0 +1,33 @@ +/// +import AdmZip = require("adm-zip"); + + +// reading archives +var zip = new AdmZip("./my_file.zip"); +var zipEntries = zip.getEntries(); // an array of ZipEntry records + +zipEntries.forEach(function (zipEntry) { + console.log(zipEntry.toString()); // outputs zip entries information + if (zipEntry.entryName == "my_file.txt") { + console.log(zipEntry.getData().toString('utf8')); + } +}); +// outputs the content of some_folder/my_file.txt +console.log(zip.readAsText("some_folder/my_file.txt")); +// extracts the specified file to the specified location +zip.extractEntryTo(/*entry name*/"some_folder/my_file.txt", /*target path*/"/home/me/tempfolder", /*overwrite*/true) +// extracts everything +zip.extractAllTo(/*target path*/"/home/me/zipcontent/", /*overwrite*/true); + + +// creating archives +var zip = new AdmZip(); + +// add file directly +zip.addFile("test.txt", new Buffer("inner content of the file"), "entry comment goes here"); +// add local file +zip.addLocalFile("/home/me/some_picture.png"); +// get everything as a buffer +var willSendthis = zip.toBuffer(); +// or write everything to disk +zip.writeZip(/*target file name*/"/home/me/files.zip"); diff --git a/adm-zip/adm-zip.d.ts b/adm-zip/adm-zip.d.ts new file mode 100644 index 0000000000..9f2eb7dfdb --- /dev/null +++ b/adm-zip/adm-zip.d.ts @@ -0,0 +1,300 @@ +// Type definitions for adm-zip v0.4.4 +// Project: https://github.com/cthackers/adm-zip +// Definitions by: John Vilk +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module AdmZip { + class ZipFile { + /** + * Create a new, empty archive. + */ + constructor(); + /** + * Read an existing archive. + */ + constructor(fileName: string); + /** + * Extracts the given entry from the archive and returns the content as a + * Buffer object. + * @param entry String with the full path of the entry + * @return Buffer or Null in case of error + */ + readFile(entry: string): Buffer; + /** + * Extracts the given entry from the archive and returns the content as a + * Buffer object. + * @param entry ZipEntry object + * @return Buffer or Null in case of error + */ + readFile(entry: IZipEntry): Buffer; + /** + * Asynchronous readFile + * @param entry String with the full path of the entry + * @param callback Called with a Buffer or Null in case of error + */ + readFileAsync(entry: string, callback: (data: Buffer, err: string) => any): void; + /** + * Asynchronous readFile + * @param entry ZipEntry object + * @param callback Called with a Buffer or Null in case of error + * @return Buffer or Null in case of error + */ + readFileAsync(entry: IZipEntry, callback: (data: Buffer, err: string) => any): void; + /** + * Extracts the given entry from the archive and returns the content as + * plain text in the given encoding + * @param entry String with the full path of the entry + * @param encoding Optional. If no encoding is specified utf8 is used + * @return String + */ + readAsText(fileName: string, encoding?: string): string; + /** + * Extracts the given entry from the archive and returns the content as + * plain text in the given encoding + * @param entry ZipEntry object + * @param encoding Optional. If no encoding is specified utf8 is used + * @return String + */ + readAsText(fileName: IZipEntry, encoding?: string): string; + /** + * Asynchronous readAsText + * @param entry String with the full path of the entry + * @param callback Called with the resulting string. + * @param encoding Optional. If no encoding is specified utf8 is used + */ + readAsTextAsync(fileName: string, callback: (data: string) => any, encoding?: string): void; + /** + * Asynchronous readAsText + * @param entry ZipEntry object + * @param callback Called with the resulting string. + * @param encoding Optional. If no encoding is specified utf8 is used + */ + readAsTextAsync(fileName: IZipEntry, callback: (data: string) => any, encoding?: string): void; + /** + * Remove the entry from the file or the entry and all its nested directories + * and files if the given entry is a directory + * @param entry String with the full path of the entry + */ + deleteFile(entry: string): void; + /** + * Remove the entry from the file or the entry and all its nested directories + * and files if the given entry is a directory + * @param entry A ZipEntry object. + */ + deleteFile(entry: IZipEntry): void; + /** + * Adds a comment to the zip. The zip must be rewritten after + * adding the comment. + * @param comment Content of the comment. + */ + addZipComment(comment: string): void; + /** + * Returns the zip comment + * @return The zip comment. + */ + getZipComment(): string; + /** + * Adds a comment to a specified zipEntry. The zip must be rewritten after + * adding the comment. + * The comment cannot exceed 65535 characters in length. + * @param entry String with the full path of the entry + * @param comment The comment to add to the entry. + */ + addZipEntryComment(entry: string, comment: string): void; + /** + * Adds a comment to a specified zipEntry. The zip must be rewritten after + * adding the comment. + * The comment cannot exceed 65535 characters in length. + * @param entry ZipEntry object. + * @param comment The comment to add to the entry. + */ + addZipEntryComment(entry: IZipEntry, comment: string): void; + /** + * Returns the comment of the specified entry. + * @param entry String with the full path of the entry. + * @return String The comment of the specified entry. + */ + getZipEntryComment(entry: string): string; + /** + * Returns the comment of the specified entry + * @param entry ZipEntry object. + * @return String The comment of the specified entry. + */ + getZipEntryComment(entry: IZipEntry): string; + /** + * Updates the content of an existing entry inside the archive. The zip + * must be rewritten after updating the content + * @param entry String with the full path of the entry. + * @param content The entry's new contents. + */ + updateFile(entry: string, content: Buffer): void; + /** + * Updates the content of an existing entry inside the archive. The zip + * must be rewritten after updating the content + * @param entry ZipEntry object. + * @param content The entry's new contents. + */ + updateFile(entry: IZipEntry, content: Buffer): void; + /** + * Adds a file from the disk to the archive. + * @param localPath Path to a file on disk. + * @param zipPath Path to a directory in the archive. Defaults to the empty + * string. + */ + addLocalFile(localPath: string, zipPath?: string): void; + /** + * Adds a local directory and all its nested files and directories to the + * archive. + * @param localPath Path to a folder on disk. + * @param zipPath Path to a folder in the archive. Defaults to an empty + * string. + */ + addLocalFolder(localPath: string, zipPath?: string): void; + /** + * Allows you to create a entry (file or directory) in the zip file. + * If you want to create a directory the entryName must end in / and a null + * buffer should be provided. + * @param entryName Entry path + * @param content Content to add to the entry; must be a 0-length buffer + * for a directory. + * @param comment Comment to add to the entry. + * @param attr Attribute to add to the entry. + */ + addFile(entryName: string, data: Buffer, comment?: string, attr?: number): void; + /** + * Returns an array of ZipEntry objects representing the files and folders + * inside the archive + */ + getEntries(): IZipEntry[]; + /** + * Returns a ZipEntry object representing the file or folder specified by + * ``name``. + * @param name Name of the file or folder to retrieve. + * @return ZipEntry The entry corresponding to the name. + */ + getEntry(name: string): IZipEntry; + /** + * Extracts the given entry to the given targetPath. + * If the entry is a directory inside the archive, the entire directory and + * its subdirectories will be extracted. + * @param entry String with the full path of the entry + * @param targetPath Target folder where to write the file + * @param maintainEntryPath If maintainEntryPath is true and the entry is + * inside a folder, the entry folder will be created in targetPath as + * well. Default is TRUE + * @param overwrite If the file already exists at the target path, the file + * will be overwriten if this is true. Default is FALSE + * + * @return Boolean + */ + extractEntryTo(entryPath: string, targetPath: string, maintainEntryPath?: boolean, overwrite?: boolean): boolean; + /** + * Extracts the given entry to the given targetPath. + * If the entry is a directory inside the archive, the entire directory and + * its subdirectories will be extracted. + * @param entry ZipEntry object + * @param targetPath Target folder where to write the file + * @param maintainEntryPath If maintainEntryPath is true and the entry is + * inside a folder, the entry folder will be created in targetPath as + * well. Default is TRUE + * @param overwrite If the file already exists at the target path, the file + * will be overwriten if this is true. Default is FALSE + * @return Boolean + */ + extractEntryTo(entryPath: IZipEntry, targetPath: string, maintainEntryPath?: boolean, overwrite?: boolean): boolean; + /** + * Extracts the entire archive to the given location + * @param targetPath Target location + * @param overwrite If the file already exists at the target path, the file + * will be overwriten if this is true. Default is FALSE + */ + extractAllTo(targetPath: string, overwrite?: boolean): void; + /** + * Writes the newly created zip file to disk at the specified location or + * if a zip was opened and no ``targetFileName`` is provided, it will + * overwrite the opened zip + * @param targetFileName + */ + writeZip(targetPath?: string): void; + /** + * Returns the content of the entire zip file as a Buffer object + * @return Buffer + */ + toBuffer(): Buffer; + } + + /** + * The ZipEntry is more than a structure representing the entry inside the + * zip file. Beside the normal attributes and headers a entry can have, the + * class contains a reference to the part of the file where the compressed + * data resides and decompresses it when requested. It also compresses the + * data and creates the headers required to write in the zip file. + */ + interface IZipEntry { + /** + * Represents the full name and path of the file + */ + entryName: string; + rawEntryName: Buffer; + /** + * Extra data associated with this entry. + */ + extra: Buffer; + /** + * Entry comment. + */ + comment: string; + name: string; + /** + * Read-Only property that indicates the type of the entry. + */ + isDirectory: boolean; + /** + * Get the header associated with this ZipEntry. + */ + header: Buffer; + /** + * Retrieve the compressed data for this entry. Note that this may trigger + * compression if any properties were modified. + */ + getCompressedData(): Buffer; + /** + * Asynchronously retrieve the compressed data for this entry. Note that + * this may trigger compression if any properties were modified. + */ + getCompressedDataAsync(callback: (data: Buffer) => void): void; + /** + * Set the (uncompressed) data to be associated with this entry. + */ + setData(value: string): void; + /** + * Set the (uncompressed) data to be associated with this entry. + */ + setData(value: Buffer): void; + /** + * Get the decompressed data associated with this entry. + */ + getData(): Buffer; + /** + * Asynchronously get the decompressed data associated with this entry. + */ + getDataAsync(callback: (data: Buffer) => void): void; + /** + * Returns the CEN Entry Header to be written to the output zip file, plus + * the extra data and the entry comment. + */ + packHeader(): Buffer; + /** + * Returns a nicely formatted string with the most important properties of + * the ZipEntry. + */ + toString(): string; + } +} + +declare module "adm-zip" { + import zipFile = AdmZip.ZipFile; + export = zipFile; +} From 20ebd41950f57573ade486620e32436def29d94e Mon Sep 17 00:00:00 2001 From: Niklas Mollenhauer Date: Sat, 8 Nov 2014 01:14:26 +0100 Subject: [PATCH 36/42] Fix bug in node-webkit when requiring "nw.gui" --- node-webkit/node-webkit.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-webkit/node-webkit.d.ts b/node-webkit/node-webkit.d.ts index 92afbff2dd..78c9dd3f0f 100644 --- a/node-webkit/node-webkit.d.ts +++ b/node-webkit/node-webkit.d.ts @@ -3,7 +3,7 @@ // Definitions by: Pedro Casaubon // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module nw.gui { +declare module "nw.gui" { interface IEventEmitter { addListener(event: string, listener: Function): EventEmitter; From a7114686aa0d922d6f6aec7e2083908dc912a6d8 Mon Sep 17 00:00:00 2001 From: Niklas Mollenhauer Date: Sat, 8 Nov 2014 01:15:15 +0100 Subject: [PATCH 37/42] Update tests to use require() --- node-webkit/node-webkit-tests.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/node-webkit/node-webkit-tests.ts b/node-webkit/node-webkit-tests.ts index da10f2901c..fab532d36c 100644 --- a/node-webkit/node-webkit-tests.ts +++ b/node-webkit/node-webkit-tests.ts @@ -1,7 +1,9 @@ /// /// + // Load native UI library -var gui: typeof nw.gui; +// See docs: https://github.com/rogerwang/node-webkit/wiki/Shell +import gui = require("nw.gui"); /* WINDOW */ From 0ffe89ddb428924e90f78818bd50f92c1f5109d7 Mon Sep 17 00:00:00 2001 From: Niklas Mollenhauer Date: Sat, 8 Nov 2014 01:52:05 +0100 Subject: [PATCH 38/42] Fix failed test --- node-webkit/node-webkit-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-webkit/node-webkit-tests.ts b/node-webkit/node-webkit-tests.ts index fab532d36c..ba53c3fc4f 100644 --- a/node-webkit/node-webkit-tests.ts +++ b/node-webkit/node-webkit-tests.ts @@ -111,7 +111,7 @@ import gui = require("nw.gui"); /* MENU ITEM */ - var itemc:nw.gui.MenuItem; + var itemc:gui.MenuItem; // Create a separator itemc = new gui.MenuItem({ type: 'separator' }); From 12af931fb003092a3dc5eb97dfbe210b40d5288b Mon Sep 17 00:00:00 2001 From: in-async Date: Sat, 8 Nov 2014 23:50:15 +0900 Subject: [PATCH 39/42] Fix along the guidelines. --- angularfire/angularfire-tests.ts | 6 +- angularfire/angularfire.d.ts | 98 ++++++++++++++++---------------- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/angularfire/angularfire-tests.ts b/angularfire/angularfire-tests.ts index 231c0f992c..7d39e4181d 100644 --- a/angularfire/angularfire-tests.ts +++ b/angularfire/angularfire-tests.ts @@ -168,7 +168,7 @@ interface AngularFireAuthScope extends ng.IScope { } myapp.controller("MyAuthController", ["$scope", "$firebaseSimpleLogin", - function ($scope: AngularFireAuthScope, $firebaseSimpleLogin: AngularFireAuthService) { + function($scope: AngularFireAuthScope, $firebaseSimpleLogin: AngularFireAuthService) { var dataRef = new Firebase(url); $scope.loginObj = $firebaseSimpleLogin(dataRef); $scope.loginObj.$getCurrentUser().then(_ => { @@ -178,9 +178,9 @@ myapp.controller("MyAuthController", ["$scope", "$firebaseSimpleLogin", $scope.loginObj.$login('password', { email: email, password: password - }).then(function (user) { + }).then(function(user) { console.log('Logged in as: ', user.uid); - }, function (error) { + }, function(error) { console.error('Login failed: ', error); }); $scope.loginObj.$logout(); diff --git a/angularfire/angularfire.d.ts b/angularfire/angularfire.d.ts index b6a0d55d26..0bebb23c52 100644 --- a/angularfire/angularfire.d.ts +++ b/angularfire/angularfire.d.ts @@ -7,76 +7,76 @@ /// interface AngularFireService { - (firebase: Firebase, config?: any): AngularFire; + (firebase: Firebase, config?: any): AngularFire; } interface AngularFire { - $asArray(): AngularFireArray; - $asObject(): AngularFireObject; - $ref(): Firebase; - $push(data: any): ng.IPromise; - $set(key: string, data: any): ng.IPromise; - $set(data: any): ng.IPromise; - $remove(key?: string): ng.IPromise; - $update(key: string, data: Object): ng.IPromise; - $update(data: any): ng.IPromise; - $transaction(updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise; - $transaction(key:string, updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise; + $asArray(): AngularFireArray; + $asObject(): AngularFireObject; + $ref(): Firebase; + $push(data: any): ng.IPromise; + $set(key: string, data: any): ng.IPromise; + $set(data: any): ng.IPromise; + $remove(key?: string): ng.IPromise; + $update(key: string, data: Object): ng.IPromise; + $update(data: any): ng.IPromise; + $transaction(updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise; + $transaction(key:string, updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise; } interface AngularFireObject extends AngularFireSimpleObject { - $id: string; - $priority: number; - $value: any; - $save(): ng.IPromise; - $loaded(resolve?: (x: AngularFireObject) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; - $loaded(resolve?: (x: AngularFireObject) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; - $loaded(resolve?: (x: AngularFireObject) => void, reject?: (err: any) => any): ng.IPromise; - $inst(): AngularFire; - $bindTo(scope: ng.IScope, varName: string): ng.IPromise; - $watch(callback: Function, context?: any): Function; - $destroy(): void; + $id: string; + $priority: number; + $value: any; + $save(): ng.IPromise; + $loaded(resolve?: (x: AngularFireObject) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; + $loaded(resolve?: (x: AngularFireObject) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; + $loaded(resolve?: (x: AngularFireObject) => void, reject?: (err: any) => any): ng.IPromise; + $inst(): AngularFire; + $bindTo(scope: ng.IScope, varName: string): ng.IPromise; + $watch(callback: Function, context?: any): Function; + $destroy(): void; } interface AngularFireObjectService { - $extendFactory(ChildClass: Object, methods?: Object): Object; + $extendFactory(ChildClass: Object, methods?: Object): Object; } interface AngularFireArray extends Array { - $add(newData: any): ng.IPromise; - $save(recordOrIndex: any): ng.IPromise; - $remove(recordOrIndex: any): ng.IPromise; - $getRecord(key: string): AngularFireSimpleObject; - $keyAt(recordOrIndex: any): string; - $indexFor(key: string): number; - $loaded(resolve?: (x: AngularFireArray) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; - $loaded(resolve?: (x: AngularFireArray) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; - $loaded(resolve?: (x: AngularFireArray) => void, reject?: (err: any) => any): ng.IPromise; - $inst(): AngularFire; - $watch(cb: (event: string, key: string, prevChild: string) => void, context?: any): Function; - $destroy(): void; + $add(newData: any): ng.IPromise; + $save(recordOrIndex: any): ng.IPromise; + $remove(recordOrIndex: any): ng.IPromise; + $getRecord(key: string): AngularFireSimpleObject; + $keyAt(recordOrIndex: any): string; + $indexFor(key: string): number; + $loaded(resolve?: (x: AngularFireArray) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; + $loaded(resolve?: (x: AngularFireArray) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; + $loaded(resolve?: (x: AngularFireArray) => void, reject?: (err: any) => any): ng.IPromise; + $inst(): AngularFire; + $watch(cb: (event: string, key: string, prevChild: string) => void, context?: any): Function; + $destroy(): void; } interface AngularFireArrayService { - $extendFactory(ChildClass: Object, methods?: Object): Object; + $extendFactory(ChildClass: Object, methods?: Object): Object; } interface AngularFireSimpleObject { - $id: string; - $priority: number; - $value: any; - [key: string]: any; + $id: string; + $priority: number; + $value: any; + [key: string]: any; } interface AngularFireAuthService { - (firebase: Firebase): AngularFireAuth; + (firebase: Firebase): AngularFireAuth; } interface AngularFireAuth { - $getCurrentUser(): ng.IPromise; - $login(provider: string, options?: Object): ng.IPromise; - $logout(): void; - $createUser(email: string, password: string): ng.IPromise; - $changePassword(email: string, oldPassword: string, newPassword: string): ng.IPromise; - $removeUser(email: string, password: string): ng.IPromise; - $sendPasswordResetEmail(email: string): ng.IPromise; + $getCurrentUser(): ng.IPromise; + $login(provider: string, options?: Object): ng.IPromise; + $logout(): void; + $createUser(email: string, password: string): ng.IPromise; + $changePassword(email: string, oldPassword: string, newPassword: string): ng.IPromise; + $removeUser(email: string, password: string): ng.IPromise; + $sendPasswordResetEmail(email: string): ng.IPromise; } From 0607d042b41fd53aef05afca5a0679c0e211fbc9 Mon Sep 17 00:00:00 2001 From: vvakame Date: Sun, 9 Nov 2014 00:14:20 +0900 Subject: [PATCH 40/42] mv mousetrap-global-bind/mousetrap-global-bind.d.ts -> mousetrap/mousetrap-global-bind.d.ts --- .../mousetrap-global-bind-tests.ts | 0 {mousetrap-global-bind => mousetrap}/mousetrap-global-bind.d.ts | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename {mousetrap-global-bind => mousetrap}/mousetrap-global-bind-tests.ts (100%) rename {mousetrap-global-bind => mousetrap}/mousetrap-global-bind.d.ts (88%) diff --git a/mousetrap-global-bind/mousetrap-global-bind-tests.ts b/mousetrap/mousetrap-global-bind-tests.ts similarity index 100% rename from mousetrap-global-bind/mousetrap-global-bind-tests.ts rename to mousetrap/mousetrap-global-bind-tests.ts diff --git a/mousetrap-global-bind/mousetrap-global-bind.d.ts b/mousetrap/mousetrap-global-bind.d.ts similarity index 88% rename from mousetrap-global-bind/mousetrap-global-bind.d.ts rename to mousetrap/mousetrap-global-bind.d.ts index b22d5e3382..ecfdd2ff23 100644 --- a/mousetrap-global-bind/mousetrap-global-bind.d.ts +++ b/mousetrap/mousetrap-global-bind.d.ts @@ -3,7 +3,7 @@ // Definitions by: Andrew Bradley // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// interface MousetrapStatic { globalBind(keys: string, callback: (e: ExtendedKeyboardEvent, combo: string) => any, action?: string): void; From eae67433b791fa98ee59c33aa99f6219daeae956 Mon Sep 17 00:00:00 2001 From: jbblanchet Date: Sat, 8 Nov 2014 12:45:12 -0500 Subject: [PATCH 41/42] Declare variable so import works When declaring a module, it's necessary to declare a variable then export it, else the import keyword won't work properly when using modules. --- tv4/tv4.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tv4/tv4.d.ts b/tv4/tv4.d.ts index 702d3c3bc6..02b7ebba2f 100644 --- a/tv4/tv4.d.ts +++ b/tv4/tv4.d.ts @@ -43,5 +43,6 @@ interface TV4 { errorCodes:TV4ErrorCodes; } declare module "tv4" { -export = TV4; + var tv4: TV4 + export = tv4; } From 5f4765a1c903a82b35d96023f866bf381afbafa7 Mon Sep 17 00:00:00 2001 From: Basarat Ali Syed Date: Mon, 10 Nov 2014 16:15:58 +1100 Subject: [PATCH 42/42] Use the new beta build env on Travis https://github.com/travis-ci/docs-travis-ci-com/blob/ha-docker-documentation/user/container-based-infrastructure.md Seen on `Microsoft/TypeScript/pull/1085` by travis team --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index acfc5176f9..0bad26ece1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,7 @@ language: node_js node_js: - "0.10" +sudo: false + notifications: email: false