diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index aafef048d..6768db043 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,4 +1,4 @@ -# Contributors +# Contributors This is a non-exhaustive list of definitions and their creators. If you created a definition but are not listed then feel free to send a pull request on this file with your name and url. @@ -13,6 +13,7 @@ All definitions files include a header with the author and editors, so at some p * [AngularFire](https://www.firebase.com/docs/angular/reference.html) (by [Dénes Harmath](https://github.com/thSoft)) * [AngularJS](http://angularjs.org) (by [Diego Vilar](https://github.com/diegovilar)) ([wiki](https://github.com/borisyankov/DefinitelyTyped/wiki/AngularJS-Definitions-Usage-Notes)) * [angularLocalStorage](https://github.com/agrublev/angularLocalStorage) (by [Hiroki Horiuchi](https://github.com/horiuchi/)) +* [angular-spinner](https://github.com/urish/angular-spinner) (by [Marcin Biegała](https://github.com/Biegal)) * [AngularUI](http://angular-ui.github.io/) (by [Michel Salib](https://github.com/michelsalib)) * [Angular Hotkeys](https://github.com/chieffancypants/angular-hotkeys/) (by [Jason Zhao](https://github.com/jlz27)) * [Angular Protractor](https://github.com/angular/protractor) (by [Bill Armstrong](https://github.com/BillArmstrong)) @@ -46,6 +47,7 @@ All definitions files include a header with the author and editors, so at some p * [CasperJS](http://casperjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker)) * [Cheerio](https://github.com/MatthewMueller/cheerio) (by [Bret Little](https://github.com/blittle)) * [Chosen](http://harvesthq.github.com/chosen/) (by [Boris Yankov](https://github.com/borisyankov)) +* [Chroma.js](https://github.com/gka/chroma.js) (by [Sebastian Brückner](https://github.com/invliD)) * [Chrome](http://developer.chrome.com/extensions/) (by [Matthew Kimber](https://github.com/matthewkimber) and [otiai10](https://github.com/otiai10)) * [Chrome App](http://developer.chrome.com/apps/) (by [Adam Lay](https://github.com/AdamLay)) * [CKEditor](https://github.com/ckeditor/ckeditor-dev) (by [Ondrej Sevcik](https://github.com/ondrejsevcik)) @@ -72,12 +74,14 @@ All definitions files include a header with the author and editors, so at some p * [Elm](http://elm-lang.org) (by [Dénes Harmath](https://github.com/thSoft)) * [ember.js](http://emberjs.com/) (by [Boris Yankov](https://github.com/borisyankov)) * [emissary](https://github.com/atom/emissary) (by [vvakame](https://github.com/vvakame)) +* [Emscripten](http://kripken.github.io/emscripten-site/) (by [Kensuke MATSUZAKI](https://github.com/zakki)) * [EpicEditor](http://epiceditor.com/) (by [Boris Yankov](https://github.com/borisyankov)) * [ES6-Promises](https://github.com/jakearchibald/ES6-Promises) (by [François de Campredon](https://github.com/fdecampredon/)) * [Esprima](http://esprima.org/) (by [Teppei Sato](https://github.com/teppeis)) * [expect.js](https://github.com/LearnBoost/expect.js) (by [Teppei Sato](https://github.com/teppeis)) * [expectations](https://github.com/spmason/expectations) (by [vvakame](https://github.com/vvakame)) * [Express](http://expressjs.com/) (by [Boris Yankov](https://github.com/borisyankov)) +* [express-session](https://www.npmjs.org/package/express-session) (by [Hiroki Horiuchi](https://github.com/horiuchi/)) * [Ext JS](http://www.sencha.com/products/extjs/) (by [Brian Kotek](https://github.com/brian428)) * [Fabric.js](http://fabricjs.com/) (by [Oliver Klemencic](https://github.com/oklemencic/)) * [Fancybox](http://fancybox.net/) (by [Boris Yankov](https://github.com/borisyankov)) @@ -115,6 +119,7 @@ All definitions files include a header with the author and editors, so at some p * [Google Translate API](https://developers.google.com/translate/) (by [Frank M](https://github.com/sgtfrankieboy)) * [Google Url Shortener](https://developers.google.com/url-shortener/) (by [Frank M](https://github.com/sgtfrankieboy)) * [Hammer.js](http://eightmedia.github.com/hammer.js/) (by [Boris Yankov](https://github.com/borisyankov)) +* [Hapi](http://github.com/spumko/hapi) (by [Hakubo](http://github.com/hakubo)) * [Handlebars](http://handlebarsjs.com/) (by [Boris Yankov](https://github.com/borisyankov)) * [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)) @@ -125,6 +130,8 @@ All definitions files include a header with the author and editors, so at some p * [highlight.js](https://github.com/isagalaev/highlight.js) (by [Niklas Mollenhauer](https://github.com/nikeee)) * [History.js](https://github.com/browserstate/history.js) (by [Boris Yankov](https://github.com/borisyankov)) * [Html2Canvas.js](https://github.com/niklasvh/html2canvas/) (by [Richard Hepburn](https://github.com/rwhepburn)) +* [htmlparser2](https://github.com/fb55/htmlparser2/) (by [James Roland Cabresos](https://github.com/staticfunction)) +* [http-string-parser](https://github.com/apiaryio/http-string-parser) (by [MIZUNE Pine](https://github.com/pine613)) * [Humane.js](http://wavded.github.com/humane-js/) (by [John Vrbanac](https://github.com/jmvrbanac)) * [i18next](http://i18next.com/) (by [Maarten Docter](https://github.com/mdocter)) * [iCheck](http://damirfoy.com/iCheck/) (by [Dániel Tar](https://github.com/qcz)) @@ -137,6 +144,7 @@ All definitions files include a header with the author and editors, so at some p * [IxJS (Interactive extensions)](https://github.com/Reactive-Extensions/IxJS) (by [Igor Oleinikov](https://github.com/Igorbek)) * [jake](https://github.com/mde/jake) (by [Kon](http://phyzkit.net/)) * [Jasmine](http://pivotal.github.com/jasmine/) (by [Boris Yankov](https://github.com/borisyankov)) +* [Jasmine-data_driven_tests](https://github.com/gburghardt/jasmine-data_driven_tests) (by [Anthony MacKinnon](https://github.com/AnthonyMacKinnon)) * [Jasmine-jQuery](https://github.com/velesin/jasmine-jquery) (by [Gregor Stamac](https://github.com/gstamac)) * [jDataView](https://github.com/jDataView/jDataView) (by [Ingvar Stepanyan](https://github.com/RReverser)) * [JointJS](http://www.jointjs.com/) (by [Aidan Reel](http://github.com/areel)) @@ -153,6 +161,7 @@ All definitions files include a header with the author and editors, so at some p * [jQuery.Colorbox](http://www.jacklmoore.com/colorbox/) (by [Gidon Junge](https://github.com/gjunge)) * [jQuery.contextMenu](http://medialize.github.com/jQuery-contextMenu/) (by [Natan Vivo](https://github.com/nvivo/)) * [jQuery.Cookie](https://github.com/carhartl/jquery-cookie) (by [Roy Goode](https://github.com/RoyGoode)) +* [jQuery.customSelect](https://github.com/adamcoulombe/jquery.customSelect) (by [tomato360](https://github.com/tomato360)) * [jQuery.Cycle](http://jquery.malsup.com/cycle/) (by [François Guillot](http://fguillot.developpez.com/)) * [jQuery.Cycle2](http://jquery.malsup.com/cycle2/) (by [Donny Nadolny](https://github.com/dnadolny)) * [jQuery.dataTables](http://www.datatables.net) (by [Armin Sander](https://github.com/pragmatrix)) @@ -167,6 +176,7 @@ All definitions files include a header with the author and editors, so at some p * [jQuery.jNotify](http://jnotify.codeplex.com) (by [James Curran](https://github.com/jamescurran/)) * [jQuery.joyride](http://zurb.com/playground/jquery-joyride-feature-tour-plugin) (by [Vincent Bortone](https://github.com/vbortone)) * [jQuery.jSignature](https://github.com/willowsystems/jSignature) (by [Patrick Magee](https://github.com/pjmagee)) +* [jQuery.leanModal](http://leanmodal.finelysliced.com.au/)(by [tomato360](https://github.com/tomato360)) * [jQuery.notifyBar](http://www.whoop.ee/posts/2013-04-05-the-resurrection-of-jquery-notify-bar/) (by [Shunsuke Ohtani](https://github.com/zaneli)) * [jQuery.noty](http://needim.github.io/noty/) (by [Aaron King](https://github.com/kingdango/)) * [jQuery.payment](http://needim.github.io/noty/) (by [Eric J. Smith](https://github.com/ejsmith/)) @@ -191,9 +201,11 @@ All definitions files include a header with the author and editors, so at some p * [jQuery.Validation](http://bassistance.de/jquery-plugins/jquery-plugin-validation/) (by [Boris Yankov](https://github.com/borisyankov)) * [jQuery.Watermark](http://jquery-watermark.googlecode.com) (by [Anwar Javed](https://github.com/anwarjaved)) * [jQuery.base64](https://github.com/yatt/jquery.base64) (by [Shinya Mochizuki](https://github.com/enrapt-mochizuki)) +* [jquery-handsontable](https://github.com/handsontable/jquery-handsontable) (by [Ted John](https://github.com/intelorca)) * [js-git](https://github.com/creationix/js-git) (by [Bart van der Schoor](https://github.com/Bartvds)) * [js-url](https://github.com/websanova/js-url) (by [MIZUNE Pine](https://github.com/pine613)) * [js-yaml](https://github.com/nodeca/js-yaml) (by [Bart van der Schoor](https://github.com/Bartvds/)) +* [jsbn](http://www-cs-students.stanford.edu/%7Etjw/jsbn/) (by [Eugene Chernyshov](https://github.com/Evgenus)) * [jScrollPane](http://jscrollpane.kelvinluck.com) (by [Dániel Tar](https://github.com/qcz)) * [JSDeferred](http://cho45.stfuawsc.com/jsdeferred/) (by [Daisuke Mino](https://github.com/minodisk)) * [JSONEditorOnline](https://github.com/josdejong/jsoneditoronline) (by [Vincent Bortone](https://github.com/vbortone/)) @@ -235,6 +247,7 @@ All definitions files include a header with the author and editors, so at some p * [MathJax](https://github.com/mathjax/MathJax) (by [Roland Zwaga](https://github.com/rolandzwaga)) * [mCustomScrollbar](https://github.com/malihu/malihu-custom-scrollbar-plugin) (by [Sarah Williams](https://github.com/flurg)) * [Meteor](https://www.meteor.com) (by [Dave Allen](https://github.com/fullflavedave)) +* [md5.js](http://labs.cybozu.co.jp/blog/mitsunari/2007/07/md5js_1.html) (by [MIZUNE Pine](https://github.com/pine613)) * [Microsoft Ajax](http://msdn.microsoft.com/en-us/library/ee341002(v=vs.100).aspx) (by [Patrick Magee](https://github.com/pjmagee)) * [Microsoft Live Connect](http://msdn.microsoft.com/en-us/library/live/hh243643.aspx) (by [John Vilk](https://github.com/jvilk)) * [Minimatch](https://github.com/isaacs/minimatch) (by [vvakame](https://github.com/vvakame)) @@ -245,10 +258,13 @@ All definitions files include a header with the author and editors, so at some p * [Moment.js](https://github.com/timrwood/moment) (by [Michael Lakerveld](https://github.com/Lakerfield)) * [MongoDB](http://mongodb.github.io/node-mongodb-native/) (from TypeScript samples, updated by [Niklas Mollenhauer](https://github.com/nikeee)) * [mongoose](http://mongoosejs.com/) (by [Hiroki Horiuchi](https://github.com/horiuchi/)) +* [morgan](https://github.com/expressjs/morgan/) (by [James Roland Cabresos](https://github.com/staticfunction/)) * [Mousetrap](http://craig.is/killing/mice) (by [Dániel Tar](https://github.com/qcz)) * [msgpack.js](https://github.com/uupaa/msgpack.js) (by [Shinya Mochizuki](https://github.com/enrapt-mochizuki)) * [Mustache.js](https://github.com/janl/mustache.js) (by [Boris Yankov](https://github.com/borisyankov)) +* [mysql](https://github.com/felixge/node-mysql) (by [William Johnston](https://github.com/wjohnsto)) * [nconf](https://github.com/flatiron/nconf) (by [Jeff Goddard](https://github.com/jedigo)) +* [needle](https://github.com/tomas/needle) (by [San Chen](https://github.com/bigsan)) * [noble](https://github.com/sandeepmistry/noble) (by [Seon-Wook Park](https://github.com/swook)) * [nock](https://github.com/pgte/nock) (by [bonnici](https://github.com/bonnici)) * [Node.js](http://nodejs.org/) (from TypeScript samples) @@ -268,6 +284,7 @@ All definitions files include a header with the author and editors, so at some p * [OpenLayers](https://github.com/openlayers/openlayers) (by [Ilya Bolkhovsky](https://github.com/bolhovsky/)) * [Optimist](https://github.com/substack/node-optimist) (by [Carlos Ballesteros Velasco](https://github.com/soywiz)) * [Passport](http://passportjs.org/) (by [Hiroki Horiuchi](https://github.com/horiuchi/)) +* [passport-facebook](https://github.com/jaredhanson/passport-facebook) (by [James Roland Cabresos](https://github.com/staticfunction/)) * [passport-strategy](https://github.com/jaredhanson/passport-strategy) (by [Lior Mualem](https://github.com/liorm)) * [pathwatcher](http://atom.github.io/node-pathwatcher/) (by [vvakame](https://github.com/vvakame)) * [Parallel.js](https://github.com/adambom/parallel.js) (by [Josh Baldwin](https://github.com/jbaldwin)) @@ -277,13 +294,16 @@ All definitions files include a header with the author and editors, so at some p * [Persona](http://www.mozilla.org/en-US/persona) (by [James Frasca](https://github.com/Nycto)) * [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)) * [PixiJS](https://github.com/GoodBoyDigital/pixi.js) (by [Pedro Casaubon](https://github.com/xperiments)) * [Platform](https://github.com/bestiejs/platform.js) (by [Jake Hickman](https://github.com/JakeH)) * [PouchDB](http://pouchdb.com) (by [Bill Sears](https://github.com/MrBigDog2U/)) * [PreloadJS](http://www.createjs.com/#!/PreloadJS) (by [Pedro Ferreira](https://bitbucket.org/drk4)) * [ProgressJs](http://usablica.github.io/progress.js/) (by [Shunsuke Ohtani](https://github.com/zaneli)) +* [promise-pool](https://github.com/vilic/promise-pool) (by [VILIC VANE](https://github.com/vilic)) * [Q](https://github.com/kriskowal/q) (by Barrie Nemetchek, Andrew Gaspar) * [Q-io](https://github.com/kriskowal/q-io) (by [Bart van der Schoor](https://github.com/Bartvds)) +* [q-retry](https://github.com/vilic/q-retry) (by [VILIC VANE](https://github.com/vilic)) * [QUnit](http://qunitjs.com/) (by [Diullei Gomes](https://github.com/Diullei)) * [Raven.js](https://github.com/getsentry/raven-js) (by [Santi Albo](https://github.com/santialbo)) * [Recaptcha.js](https://www.google.com/recaptcha) (by [Brent Jenkins](https://github.com/brentj73)) @@ -304,9 +324,11 @@ All definitions files include a header with the author and editors, so at some p * [Semver](https://github.com/isaacs/node-semver) (by [Bart van der Schoor](https://github.com/Bartvds)) * [Sencha Touch](http://www.sencha.com/products/touch/) (by [Brian Kotek](https://github.com/brian428)) * [SharePoint](http://sptypescript.codeplex.com) (by [Stanislav Vyshchepan](http://gandjustas.blogspot.ru) and [Andrey Markeev](http://markeev.com)) +* [ShellJS](http://shelljs.org) (by [Niklas Mollenhauer](https://github.com/nikeee)) * [SignalR](http://www.asp.net/signalr) (by [Boris Yankov](https://github.com/borisyankov)) * [simple-cw-node](https://github.com/astronaughts/simple-cw-node) (by [vvakame](https://github.com/vvakame)) * [Sinon](http://sinonjs.org/) (by [William Sears](https://github.com/mrbigdog2u)) +* [SIPml](http://sipml5.org/) (by [Adriaan Groenenboom](https://github.com/chookies)) * [sjcl](http://crypto.stanford.edu/sjcl/) (by [Eugene Chernyshov](https://github.com/Evgenus)) * [SlickGrid](https://github.com/mleibman/SlickGrid) (by [Josh Baldwin](https://github.com/jbaldwin)) * [smoothie](https://github.com/joewalnes/smoothie) (by [Mike H. Hawley](https://github.com/mikehhawley) and [Drew Noakes](https://drewnoakes.com)) @@ -315,6 +337,7 @@ All definitions files include a header with the author and editors, so at some p * [SockJS](https://github.com/sockjs/sockjs-client) (by [Emil Ivanov](https://github.com/vladev)) * [sockjs-node](https://github.com/sockjs/sockjs-node) (by [Phil McCloghry-Laing](https://github.com/pmccloghrylaing)) * [SoundJS](http://www.createjs.com/#!/SoundJS) (by [Pedro Ferreira](https://bitbucket.org/drk4)) +* [source-map](https://github.com/mozilla/source-map) (by [Morten Houston Ludvigsen](https://github.com/MortenHoustonLudvigsen)) * [Spin](http://fgnass.github.com/spin.js/) (by [Boris Yankov](https://github.com/borisyankov)) * [sqlite3](https://github.com/mapbox/node-sqlite3) (by [Nick Malaguti](https://github.com/nmalaguti)) * [status-bar](https://github.com/atom/status-bar) (by [vvakame](https://github.com/vvakame)) @@ -360,6 +383,7 @@ All definitions files include a header with the author and editors, so at some p * [ws](http://einaros.github.io/ws/) (by [Paul Loyd](https://github.com/loyd)) * [x2js](https://code.google.com/p/x2js/) (by [Hiroki Horiuchi](https://github.com/horiuchi/)) * [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) (by [Michel Salib](https://github.com/michelsalib)) +* [xpath](https://github.com/goto100/xpath) (by [Andrew Bradley](https://github.com/cspotcode)) * [XRegExp](http://xregexp.com/) (by [Bart van der Schoor](https://github.com/Bartvds)) * [YouTube](https://developers.google.com/youtube/) (by [Daz Wilkin](https://github.com/DazWilkin/)) * [YouTube Analytics API](https://developers.google.com/youtube/analytics/) (by [Frank M](https://github.com/sgtfrankieboy)) diff --git a/ace/ace.d.ts.tscparams b/ace/ace.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/ace.d.ts.tscparams +++ b/ace/ace.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/all-tests.ts.tscparams b/ace/all-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/all-tests.ts.tscparams +++ b/ace/all-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/tests/ace-anchor-tests.ts.tscparams b/ace/tests/ace-anchor-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/tests/ace-anchor-tests.ts.tscparams +++ b/ace/tests/ace-anchor-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/tests/ace-background_tokenizer-tests.ts.tscparams b/ace/tests/ace-background_tokenizer-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/tests/ace-background_tokenizer-tests.ts.tscparams +++ b/ace/tests/ace-background_tokenizer-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/tests/ace-default-tests.ts.tscparams b/ace/tests/ace-default-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/tests/ace-default-tests.ts.tscparams +++ b/ace/tests/ace-default-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/tests/ace-document-tests.ts.tscparams b/ace/tests/ace-document-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/tests/ace-document-tests.ts.tscparams +++ b/ace/tests/ace-document-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/tests/ace-edit_session-tests.ts.tscparams b/ace/tests/ace-edit_session-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/tests/ace-edit_session-tests.ts.tscparams +++ b/ace/tests/ace-edit_session-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/tests/ace-editor1-tests.ts.tscparams b/ace/tests/ace-editor1-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/tests/ace-editor1-tests.ts.tscparams +++ b/ace/tests/ace-editor1-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/tests/ace-editor_highlight_selected_word-tests.ts.tscparams b/ace/tests/ace-editor_highlight_selected_word-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/tests/ace-editor_highlight_selected_word-tests.ts.tscparams +++ b/ace/tests/ace-editor_highlight_selected_word-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/tests/ace-editor_navigation-tests.ts.tscparams b/ace/tests/ace-editor_navigation-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/tests/ace-editor_navigation-tests.ts.tscparams +++ b/ace/tests/ace-editor_navigation-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/tests/ace-editor_text_edit-tests.ts.tscparams b/ace/tests/ace-editor_text_edit-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/tests/ace-editor_text_edit-tests.ts.tscparams +++ b/ace/tests/ace-editor_text_edit-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/tests/ace-multi_select-tests.ts.tscparams b/ace/tests/ace-multi_select-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/tests/ace-multi_select-tests.ts.tscparams +++ b/ace/tests/ace-multi_select-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/tests/ace-placeholder-tests.ts.tscparams b/ace/tests/ace-placeholder-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/tests/ace-placeholder-tests.ts.tscparams +++ b/ace/tests/ace-placeholder-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/tests/ace-range-tests.ts.tscparams b/ace/tests/ace-range-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/tests/ace-range-tests.ts.tscparams +++ b/ace/tests/ace-range-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/tests/ace-range_list-tests.ts.tscparams b/ace/tests/ace-range_list-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/tests/ace-range_list-tests.ts.tscparams +++ b/ace/tests/ace-range_list-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/tests/ace-search-tests.ts.tscparams b/ace/tests/ace-search-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/tests/ace-search-tests.ts.tscparams +++ b/ace/tests/ace-search-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/tests/ace-selection-tests.ts.tscparams b/ace/tests/ace-selection-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/tests/ace-selection-tests.ts.tscparams +++ b/ace/tests/ace-selection-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/tests/ace-token_iterator-tests.ts.tscparams b/ace/tests/ace-token_iterator-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/tests/ace-token_iterator-tests.ts.tscparams +++ b/ace/tests/ace-token_iterator-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ace/tests/ace-virtual_renderer-tests.ts.tscparams b/ace/tests/ace-virtual_renderer-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ace/tests/ace-virtual_renderer-tests.ts.tscparams +++ b/ace/tests/ace-virtual_renderer-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/amcharts/AmCharts.d.ts.tscparams b/amcharts/AmCharts.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/amcharts/AmCharts.d.ts.tscparams +++ b/amcharts/AmCharts.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/amplifyjs/amplifyjs-tests.ts.tscparams b/amplifyjs/amplifyjs-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/amplifyjs/amplifyjs-tests.ts.tscparams +++ b/amplifyjs/amplifyjs-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/amplifyjs/amplifyjs.d.ts.tscparams b/amplifyjs/amplifyjs.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/amplifyjs/amplifyjs.d.ts.tscparams +++ b/amplifyjs/amplifyjs.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/angular-spinner/angular-spinner-tests.ts b/angular-spinner/angular-spinner-tests.ts new file mode 100644 index 000000000..cb50a9c37 --- /dev/null +++ b/angular-spinner/angular-spinner-tests.ts @@ -0,0 +1,12 @@ +/// + +var myApp = angular.module('testModule'); + +module AngularSpinnerTest { + var app = angular.module("angularSpinnerTest", ["angular-spinner"]); + + app.config(['usSpinnerService', function(usSpinnerService: ISpinnerService) { + usSpinnerService.spin('key1'); + usSpinnerService.stop('key2'); + }]); +} diff --git a/angular-spinner/angular-spinner.d.ts b/angular-spinner/angular-spinner.d.ts new file mode 100644 index 000000000..99784d38f --- /dev/null +++ b/angular-spinner/angular-spinner.d.ts @@ -0,0 +1,26 @@ +// Type definitions for angular-spinner.js 0.5.1 +// Project: https://github.com/urish/angular-spinner +// Definitions by: Marcin Biegała +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +/** +* SpinnerService +* see https://github.com/urish/angular-spinner +*/ +interface ISpinnerService { + /** + * Start selected spinner + * + * @param spinner key + */ + spin(key: string): void; + + /** + * Stop selected spinner + * + * @param spinner key + */ + stop(key: string): void; +} diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index 313ef8635..4b8da8449 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -33,13 +33,14 @@ declare module ng.translate { } interface ITranslateService { - (key: string, ...params: string[]): ng.IPromise; + (translationId: string, interpolateParams?: any, interpolationId?: string): ng.IPromise; + (translationId: string[], interpolateParams?: any, interpolationId?: string): ng.IPromise<{ [key: string]: string }>; cloakClassName(): string; cloakClassName(name: string): ITranslateProvider; fallbackLanguage(langKey?: string): string; fallbackLanguage(langKey?: string[]): string; instant(translationId: string, interpolateParams?: any, interpolationId?: string): string; - instant(translationId: string[], interpolateParams?: any, interpolationId?: string): string; + instant(translationId: string[], interpolateParams?: any, interpolationId?: string): { [key: string]: string }; isPostCompilingEnabled(): boolean; preferredLanguage(): string; proposedLanguage(): string; diff --git a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts index 8ed8be859..608591b58 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts @@ -118,7 +118,7 @@ testApp.config(( }); testApp.controller('TestCtrl', ( - $scope: ng.IScope, + $scope: ng.ui.bootstrap.IModalScope, $log: ng.ILogService, $modal: ng.ui.bootstrap.IModalService, $modalStack: ng.ui.bootstrap.IModalStackService, @@ -147,9 +147,9 @@ testApp.controller('TestCtrl', ( $log.log('modal opened'); }); - modalInstance.result.then(closeResult=> { + modalInstance.result.then((closeResult:any)=> { $log.log('modal closed', closeResult); - }, dismissResult=> { + }, (dismissResult:any)=> { $log.log('modal dismissed', dismissResult); }); diff --git a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts index 2d792d1b1..ad90dc9db 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular UI Bootstrap 0.10.0 +// Type definitions for Angular UI Bootstrap 0.11.0 // Project: https://github.com/angular-ui/bootstrap // Definitions by: Brian Surowiec // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -198,6 +198,22 @@ declare module ng.ui.bootstrap { opened: ng.IPromise; } + interface IModalScope extends ng.IScope { + /** + * Those methods make it easy to close a modal window without a need to create a dedicated controller + */ + + /** + * Dismiss the dialog without assigning a value to the promise output + */ + $dismiss(reason?: any): void; + + /** + * Close the dialog resolving the promise to the given value + */ + $close(result?: any): void; + } + interface IModalSettings { /** * a path to a template representing modal's content @@ -211,9 +227,9 @@ declare module ng.ui.bootstrap { /** * a scope instance to be used for the modal's content (actually the $modal service is going to create a child scope of a provided scope). - * Defaults to `$rootScope` + * Defaults to `$rootScope`. */ - scope?: any; + scope?: IModalScope; /** * a controller for a modal instance - it can initialize scope used by modal. @@ -246,6 +262,16 @@ declare module ng.ui.bootstrap { * additional CSS class(es) to be added to a modal window template */ windowClass?: string; + + /** + * optional size of modal window. Allowed values: 'sm' (small) or 'lg' (large). Requires Bootstrap 3.1.0 or later + */ + size?: string; + + /** + * a path to a template overriding modal's window template + */ + windowTemplateUrl?: string; } interface IModalStackService { diff --git a/angular-ui/angular-ui-router.d.ts b/angular-ui/angular-ui-router.d.ts index 081d35723..005bf8b90 100644 --- a/angular-ui/angular-ui-router.d.ts +++ b/angular-ui/angular-ui-router.d.ts @@ -11,8 +11,9 @@ declare module ng.ui { name?: string; template?: any; templateUrl?: any; - templateProvider?: () => string; + templateProvider?: any; controller?: any; + controllerAs?: string; controllerProvider?: any; resolve?: {}; url?: string; diff --git a/angularjs/angular-tests.ts b/angularjs/angular-tests.ts index a1577856e..ad1eef90c 100644 --- a/angularjs/angular-tests.ts +++ b/angularjs/angular-tests.ts @@ -231,11 +231,11 @@ foo.then((x) => { }).then((x) => { // Object is inferred here x.a = 123; - //Try a promise + //Try a promise var y: ng.IPromise; - return y; + return y; }).then((x) => { - // x is infered to be a number, which is the resolved value of a promise + // x is infered to be a number, which is the resolved value of a promise x.toFixed(); }); @@ -281,252 +281,375 @@ test_IAttributes({ $attr: {} }); +class SampleDirective implements ng.IDirective { + public restrict = 'A'; + name = 'doh'; + + compile(templateElement: ng.IAugmentedJQuery) { + return { + post: this.link + }; + } + + static instance():ng.IDirective { + return new SampleDirective(); + } + + link(scope: ng.IScope) { + + } +} + +class SampleDirective2 implements ng.IDirective { + public restrict = 'EAC'; + + compile(templateElement: ng.IAugmentedJQuery) { + return { + pre: this.link + }; + } + + static instance():ng.IDirective { + return new SampleDirective2(); + } + + link(scope: ng.IScope) { + + } +} + +angular.module('SameplDirective', []).directive('sampleDirective', SampleDirective.instance).directive('sameplDirective2', SampleDirective2.instance); + // test from https://docs.angularjs.org/guide/directive angular.module('docsSimpleDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.customer = { - name: 'Naomi', - address: '1600 Amphitheatre' - }; - }]) - .directive('myCustomer', function() { - return { - template: 'Name: {{customer.name}} Address: {{customer.address}}' - }; - }); + .controller('Controller', ['$scope', function($scope: any) { + $scope.customer = { + name: 'Naomi', + address: '1600 Amphitheatre' + }; + }]) + .directive('myCustomer', function() { + return { + template: 'Name: {{customer.name}} Address: {{customer.address}}' + }; + }); angular.module('docsTemplateUrlDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.customer = { - name: 'Naomi', - address: '1600 Amphitheatre' - }; - }]) - .directive('myCustomer', function() { - return { - templateUrl: 'my-customer.html' - }; - }); + .controller('Controller', ['$scope', function($scope: any) { + $scope.customer = { + name: 'Naomi', + address: '1600 Amphitheatre' + }; + }]) + .directive('myCustomer', function() { + return { + templateUrl: 'my-customer.html' + }; + }); angular.module('docsRestrictDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.customer = { - name: 'Naomi', - address: '1600 Amphitheatre' - }; - }]) - .directive('myCustomer', function() { - return { - restrict: 'E', - templateUrl: 'my-customer.html' - }; - }); + .controller('Controller', ['$scope', function($scope: any) { + $scope.customer = { + name: 'Naomi', + address: '1600 Amphitheatre' + }; + }]) + .directive('myCustomer', function() { + return { + restrict: 'E', + templateUrl: 'my-customer.html' + }; + }); angular.module('docsScopeProblemExample', []) - .controller('NaomiController', ['$scope', function($scope: any) { - $scope.customer = { - name: 'Naomi', - address: '1600 Amphitheatre' - }; - }]) - .controller('IgorController', ['$scope', function($scope: any) { - $scope.customer = { - name: 'Igor', - address: '123 Somewhere' - }; - }]) - .directive('myCustomer', function() { - return { - restrict: 'E', - templateUrl: 'my-customer.html' - }; - }); + .controller('NaomiController', ['$scope', function($scope: any) { + $scope.customer = { + name: 'Naomi', + address: '1600 Amphitheatre' + }; + }]) + .controller('IgorController', ['$scope', function($scope: any) { + $scope.customer = { + name: 'Igor', + address: '123 Somewhere' + }; + }]) + .directive('myCustomer', function() { + return { + restrict: 'E', + templateUrl: 'my-customer.html' + }; + }); angular.module('docsIsolateScopeDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' }; - $scope.igor = { name: 'Igor', address: '123 Somewhere' }; - }]) - .directive('myCustomer', function() { - return { - restrict: 'E', - scope: { - customerInfo: '=info' - }, - templateUrl: 'my-customer-iso.html' - }; - }); + .controller('Controller', ['$scope', function($scope: any) { + $scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' }; + $scope.igor = { name: 'Igor', address: '123 Somewhere' }; + }]) + .directive('myCustomer', function() { + return { + restrict: 'E', + scope: { + customerInfo: '=info' + }, + templateUrl: 'my-customer-iso.html' + }; + }); angular.module('docsIsolationExample', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' }; - $scope.vojta = { name: 'Vojta', address: '3456 Somewhere Else' }; - }]) - .directive('myCustomer', function() { - return { - restrict: 'E', - scope: { - customerInfo: '=info' - }, - templateUrl: 'my-customer-plus-vojta.html' - }; - }); + .controller('Controller', ['$scope', function($scope: any) { + $scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' }; + $scope.vojta = { name: 'Vojta', address: '3456 Somewhere Else' }; + }]) + .directive('myCustomer', function() { + return { + restrict: 'E', + scope: { + customerInfo: '=info' + }, + templateUrl: 'my-customer-plus-vojta.html' + }; + }); angular.module('docsTimeDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.format = 'M/d/yy h:mm:ss a'; - }]) - .directive('myCurrentTime', ['$interval', 'dateFilter', function($interval: any, dateFilter: any): ng.IDirective { + .controller('Controller', ['$scope', function($scope: any) { + $scope.format = 'M/d/yy h:mm:ss a'; + }]) + .directive('myCurrentTime', ['$interval', 'dateFilter', function($interval: any, dateFilter: any) { - return { - link: function(scope: any, element: any, attrs: any) { - var format: any, - timeoutId: any; + return { + link: function(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs:ng.IAttributes) { + var format: any, + timeoutId: any; - function updateTime() { - element.text(dateFilter(new Date(), format)); - } + function updateTime() { + element.text(dateFilter(new Date(), format)); + } - scope.$watch(attrs.myCurrentTime, function (value: any) { - format = value; - updateTime(); - }); + scope.$watch(attrs['myCurrentTime'], function (value: any) { + format = value; + updateTime(); + }); - element.on('$destroy', function () { - $interval.cancel(timeoutId); - }); + element.on('$destroy', function () { + $interval.cancel(timeoutId); + }); - // start the UI update process; save the timeoutId for canceling - timeoutId = $interval(function () { - updateTime(); // update DOM - }, 1000); - } - }; - }]); + // start the UI update process; save the timeoutId for canceling + timeoutId = $interval(function () { + updateTime(); // update DOM + }, 1000); + } + }; + }]); angular.module('docsTransclusionDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.name = 'Tobias'; - }]) - .directive('myDialog', function() { - return { - restrict: 'E', - transclude: true, - templateUrl: 'my-dialog.html' - }; - }); + .controller('Controller', ['$scope', function($scope: any) { + $scope.name = 'Tobias'; + }]) + .directive('myDialog', function() { + return { + restrict: 'E', + transclude: true, + templateUrl: 'my-dialog.html' + }; + }); angular.module('docsTransclusionExample', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.name = 'Tobias'; - }]) - .directive('myDialog', function() { - return { - restrict: 'E', - transclude: true, - scope: {}, - templateUrl: 'my-dialog.html', - link: function (scope: any, element: any) { - scope.name = 'Jeff'; - } - }; - }); + .controller('Controller', ['$scope', function($scope: any) { + $scope.name = 'Tobias'; + }]) + .directive('myDialog', function() { + return { + restrict: 'E', + transclude: true, + scope: {}, + templateUrl: 'my-dialog.html', + link: function (scope: ng.IScope, element: ng.IAugmentedJQuery) { + scope['name'] = 'Jeff'; + } + }; + }); angular.module('docsIsoFnBindExample', []) - .controller('Controller', ['$scope', '$timeout', function($scope: any, $timeout: any) { - $scope.name = 'Tobias'; - $scope.hideDialog = function () { - $scope.dialogIsHidden = true; - $timeout(function () { - $scope.dialogIsHidden = false; - }, 2000); - }; - }]) - .directive('myDialog', function() { - return { - restrict: 'E', - transclude: true, - scope: { - 'close': '&onClose' - }, - templateUrl: 'my-dialog-close.html' - }; - }); + .controller('Controller', ['$scope', '$timeout', function($scope: any, $timeout: any) { + $scope.name = 'Tobias'; + $scope.hideDialog = function () { + $scope.dialogIsHidden = true; + $timeout(function () { + $scope.dialogIsHidden = false; + }, 2000); + }; + }]) + .directive('myDialog', function() { + return { + restrict: 'E', + transclude: true, + scope: { + 'close': '&onClose' + }, + templateUrl: 'my-dialog-close.html' + }; + }); angular.module('dragModule', []) - .directive('myDraggable', ['$document', function($document: any) { - return function(scope: any, element: any, attr: any) { - var startX = 0, startY = 0, x = 0, y = 0; + .directive('myDraggable', ['$document', function($document: any) { + return function(scope: any, element: any, attr: any) { + var startX = 0, startY = 0, x = 0, y = 0; - element.css({ - position: 'relative', - border: '1px solid red', - backgroundColor: 'lightgrey', - cursor: 'pointer' - }); + element.css({ + position: 'relative', + border: '1px solid red', + backgroundColor: 'lightgrey', + cursor: 'pointer' + }); - element.on('mousedown', function(event: any) { - // Prevent default dragging of selected content - event.preventDefault(); - startX = event.pageX - x; - startY = event.pageY - y; - $document.on('mousemove', mousemove); - $document.on('mouseup', mouseup); - }); + element.on('mousedown', function(event: any) { + // Prevent default dragging of selected content + event.preventDefault(); + startX = event.pageX - x; + startY = event.pageY - y; + $document.on('mousemove', mousemove); + $document.on('mouseup', mouseup); + }); - function mousemove(event: any) { - y = event.pageY - startY; - x = event.pageX - startX; - element.css({ - top: y + 'px', - left: x + 'px' - }); - } + function mousemove(event: any) { + y = event.pageY - startY; + x = event.pageX - startX; + element.css({ + top: y + 'px', + left: x + 'px' + }); + } - function mouseup() { - $document.off('mousemove', mousemove); - $document.off('mouseup', mouseup); - } - }; - }]); + function mouseup() { + $document.off('mousemove', mousemove); + $document.off('mouseup', mouseup); + } + }; + }]); angular.module('docsTabsExample', []) - .directive('myTabs', function() { - return { - restrict: 'E', - transclude: true, - scope: {}, - controller: function($scope: any) { - var panes: any = $scope.panes = []; + .directive('myTabs', function() { + return { + restrict: 'E', + transclude: true, + scope: {}, + controller: function($scope: ng.IScope) { + var panes: any = $scope['panes'] = []; - $scope.select = function(pane: any) { - angular.forEach(panes, function(pane: any) { - pane.selected = false; - }); - pane.selected = true; - }; + $scope['select'] = function(pane: any) { + angular.forEach(panes, function(pane: any) { + pane.selected = false; + }); + pane.selected = true; + }; - this.addPane = function(pane: any) { - if (panes.length === 0) { - $scope.select(pane); - } - panes.push(pane); - }; - }, - templateUrl: 'my-tabs.html' - }; - }) - .directive('myPane', function() { - return { - require: '^myTabs', - restrict: 'E', - transclude: true, - scope: { - title: '@' - }, - link: function(scope, element, attrs, tabsCtrl) { - tabsCtrl.addPane(scope); - }, - templateUrl: 'my-pane.html' - }; - }); + this.addPane = function(pane: any) { + if (panes.length === 0) { + $scope['select'](pane); + } + panes.push(pane); + }; + }, + templateUrl: 'my-tabs.html' + }; + }) + .directive('myPane', function() { + return { + require: '^myTabs', + restrict: 'E', + transclude: true, + scope: { + title: '@' + }, + link: function(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes, tabsCtrl: any) { + tabsCtrl.addPane(scope); + }, + templateUrl: 'my-pane.html' + }; + }); + +interface copyExampleUser { + name?: string; + email?: string; + gender?: string; +} + +interface copyExampleScope { + + user: copyExampleUser; + master: copyExampleUser; + update: (copyExampleUser: copyExampleUser) => any; + reset: () => any; +} + +angular.module('copyExample', []) + .controller('ExampleController', ['$scope', function ($scope: copyExampleScope) { + $scope.master = { }; + + $scope.update = function (user) { + // Example with 1 argument + $scope.master = angular.copy(user); + }; + + $scope.reset = function () { + // Example with 2 arguments + angular.copy($scope.master, $scope.user); + }; + + $scope.reset(); + }]); + +module locationTests { + + var $location: ng.ILocationService; + + /* + * From https://docs.angularjs.org/api/ng/service/$location + */ + + // given url http://example.com/#/some/path?foo=bar&baz=xoxo + var searchObject = $location.search(); + // => {foo: 'bar', baz: 'xoxo'} + + + // set foo to 'yipee' + $location.search('foo', 'yipee'); + // => $location + + // set foo to 5 + $location.search('foo', 5); + // => $location + + /* + * From: https://docs.angularjs.org/guide/$location + */ + + // in browser with HTML5 history support: + // open http://example.com/#!/a -> rewrite to http://example.com/a + // (replacing the http://example.com/#!/a history record) + $location.path() == '/a' + + $location.path('/foo'); + $location.absUrl() == 'http://example.com/foo' + + $location.search() == {} + $location.search({ a: 'b', c: true }); + $location.absUrl() == 'http://example.com/foo?a=b&c' + + $location.path('/new').search('x=y'); + $location.url() == 'new?x=y' + $location.absUrl() == 'http://example.com/new?x=y' + + // in browser without html5 history support: + // open http://example.com/new?x=y -> redirect to http://example.com/#!/new?x=y + // (again replacing the http://example.com/new?x=y history item) + $location.path() == '/new' + $location.search() == { x: 'y' } + + $location.path('/foo/bar'); + $location.path() == '/foo/bar' + $location.url() == '/foo/bar?x=y' + $location.absUrl() == 'http://example.com/#!/foo/bar?x=y' +} \ No newline at end of file diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index e447985fb..bd6bd01cb 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular JS 1.2+ +// Type definitions for Angular JS 1.3+ // Project: http://angularjs.org // Definitions by: Diego Vilar // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -20,7 +20,7 @@ declare module ng { // not directly implemented, but ensures that constructed class implements $get interface IServiceProviderClass { - new(...args: any[]): IServiceProvider; + new (...args: any[]): IServiceProvider; } interface IServiceProviderFactory { @@ -38,11 +38,134 @@ declare module ng { /////////////////////////////////////////////////////////////////////////// interface IAngularStatic { bind(context: any, fn: Function, ...args: any[]): Function; - bootstrap(element: string, modules?: any[]): auto.IInjectorService; - bootstrap(element: JQuery, modules?: any[]): auto.IInjectorService; - bootstrap(element: Element, modules?: any[]): auto.IInjectorService; - bootstrap(element: Document, modules?: any[]): auto.IInjectorService; - copy(source: any, destination?: any): any; + + /** + * Use this function to manually start up angular application. + * + * @param element DOM element which is the root of angular application. + * @param modules An array of modules to load into the application. + * Each item in the array should be the name of a predefined module or a (DI annotated) + * function that will be invoked by the injector as a run block. + */ + bootstrap(element: string, modules?: string): auto.IInjectorService; + /** + * Use this function to manually start up angular application. + * + * @param element DOM element which is the root of angular application. + * @param modules An array of modules to load into the application. + * Each item in the array should be the name of a predefined module or a (DI annotated) + * function that will be invoked by the injector as a run block. + */ + bootstrap(element: string, modules?: Function): auto.IInjectorService; + /** + * Use this function to manually start up angular application. + * + * @param element DOM element which is the root of angular application. + * @param modules An array of modules to load into the application. + * Each item in the array should be the name of a predefined module or a (DI annotated) + * function that will be invoked by the injector as a run block. + */ + bootstrap(element: string, modules?: string[]): auto.IInjectorService; + /** + * Use this function to manually start up angular application. + * + * @param element DOM element which is the root of angular application. + * @param modules An array of modules to load into the application. + * Each item in the array should be the name of a predefined module or a (DI annotated) + * function that will be invoked by the injector as a run block. + */ + bootstrap(element: JQuery, modules?: string): auto.IInjectorService; + /** + * Use this function to manually start up angular application. + * + * @param element DOM element which is the root of angular application. + * @param modules An array of modules to load into the application. + * Each item in the array should be the name of a predefined module or a (DI annotated) + * function that will be invoked by the injector as a run block. + */ + bootstrap(element: JQuery, modules?: Function): auto.IInjectorService; + /** + * Use this function to manually start up angular application. + * + * @param element DOM element which is the root of angular application. + * @param modules An array of modules to load into the application. + * Each item in the array should be the name of a predefined module or a (DI annotated) + * function that will be invoked by the injector as a run block. + */ + bootstrap(element: JQuery, modules?: string[]): auto.IInjectorService; + /** + * Use this function to manually start up angular application. + * + * @param element DOM element which is the root of angular application. + * @param modules An array of modules to load into the application. + * Each item in the array should be the name of a predefined module or a (DI annotated) + * function that will be invoked by the injector as a run block. + */ + bootstrap(element: Element, modules?: string): auto.IInjectorService; + /** + * Use this function to manually start up angular application. + * + * @param element DOM element which is the root of angular application. + * @param modules An array of modules to load into the application. + * Each item in the array should be the name of a predefined module or a (DI annotated) + * function that will be invoked by the injector as a run block. + */ + bootstrap(element: Element, modules?: Function): auto.IInjectorService; + /** + * Use this function to manually start up angular application. + * + * @param element DOM element which is the root of angular application. + * @param modules An array of modules to load into the application. + * Each item in the array should be the name of a predefined module or a (DI annotated) + * function that will be invoked by the injector as a run block. + */ + bootstrap(element: Element, modules?: string[]): auto.IInjectorService; + /** + * Use this function to manually start up angular application. + * + * @param element DOM element which is the root of angular application. + * @param modules An array of modules to load into the application. + * Each item in the array should be the name of a predefined module or a (DI annotated) + * function that will be invoked by the injector as a run block. + */ + bootstrap(element: Document, modules?: string): auto.IInjectorService; + /** + * Use this function to manually start up angular application. + * + * @param element DOM element which is the root of angular application. + * @param modules An array of modules to load into the application. + * Each item in the array should be the name of a predefined module or a (DI annotated) + * function that will be invoked by the injector as a run block. + */ + bootstrap(element: Document, modules?: Function): auto.IInjectorService; + /** + * Use this function to manually start up angular application. + * + * @param element DOM element which is the root of angular application. + * @param modules An array of modules to load into the application. + * Each item in the array should be the name of a predefined module or a (DI annotated) + * function that will be invoked by the injector as a run block. + */ + bootstrap(element: Document, modules?: string[]): auto.IInjectorService; + + /** + * Creates a deep copy of source, which should be an object or an array. + * + * - If no destination is supplied, a copy of the object or array is created. + * - If a destination is provided, all of its elements (for array) or properties (for objects) are deleted and then all elements/properties from the source are copied to it. + * - If source is not an object or array (inc. null and undefined), source is returned. + * - If source is identical to 'destination' an exception will be thrown. + * + * @param source The source that will be used to make a copy. Can be any type, including primitives, null, and undefined. + * @param destination Destination into which the source is copied. If provided, must be of the same type as source. + */ + copy(source: T, destination?: T): T; + + /** + * Wraps a raw DOM element or HTML string as a jQuery element. + * + * If jQuery is available, angular.element is an alias for the jQuery function. If jQuery is not available, angular.element delegates to Angular's built-in subset of jQuery, called "jQuery lite" or "jqLite." + */ element: IAugmentedJQueryStatic; equals(value1: any, value2: any): boolean; extend(destination: any, ...sources: any[]): any; @@ -164,8 +287,20 @@ declare module ng { * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation). */ controller(name: string, inlineAnnotatedConstructor: any[]): IModule; - controller(object : Object): IModule; + controller(object: Object): IModule; + /** + * Register a new directive with the compiler. + * + * @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind) + * @param directiveFactory An injectable directive factory function. + */ directive(name: string, directiveFactory: IDirectiveFactory): IModule; + /** + * Register a new directive with the compiler. + * + * @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind) + * @param directiveFactory An injectable directive factory function. + */ directive(name: string, inlineAnnotatedFunction: any[]): IModule; directive(object: Object): IModule; /** @@ -245,7 +380,7 @@ declare module ng { // The observer function will be invoked once during the next $digest // following compilation. The observer is then invoked whenever the // interpolated value changes. - $observe(name: string, fn:(value?:any)=>any): Function; + $observe(name: string, fn: (value?: any) => any): Function; // A map of DOM element attribute names to the normalized name. This is needed // to do reverse lookup from normalized name back to actual name. @@ -267,12 +402,16 @@ declare module ng { $dirty: boolean; $valid: boolean; $invalid: boolean; + $submitted: boolean; $error: any; $addControl(control: ng.INgModelController): void; $removeControl(control: ng.INgModelController): void; $setValidity(validationErrorKey: string, isValid: boolean, control: ng.INgModelController): void; $setDirty(): void; $setPristine(): void; + $commitViewValue(): void; + $rollbackViewValue(): void; + $setSubmitted(): void; } /////////////////////////////////////////////////////////////////////////// @@ -285,6 +424,13 @@ declare module ng { // Documentation states viewValue and modelValue to be a string but other // types do work and it's common to use them. $setViewValue(value: any): void; + $validate(): void; + $setTouched(): void; + $setUntouched(): void; + $rollbackViewValue(): void; + $commitViewValue(revalidate?: boolean): void; + $isEmpty(value: any): boolean; + $viewValue: any; $modelValue: any; @@ -293,12 +439,24 @@ declare module ng { $formatters: IModelFormatter[]; $viewChangeListeners: IModelViewChangeListener[]; $error: any; + $name: string; + + $touched: boolean; + $untouched: boolean; + + $validators: IModelValidators; + $asyncValidators: IModelValidators; + $pristine: boolean; $dirty: boolean; $valid: boolean; $invalid: boolean; } + interface IModelValidators { + [index: string]: (...args: any[]) => boolean; + } + interface IModelParser { (value: any): any; } @@ -311,11 +469,11 @@ declare module ng { (): void; } - /////////////////////////////////////////////////////////////////////////// - // Scope - // see http://docs.angularjs.org/api/ng.$rootScope.Scope - /////////////////////////////////////////////////////////////////////////// - interface IScope { + /** + * $rootScope - $rootScopeProvider - service in module ng + * see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and https://docs.angularjs.org/api/ng/service/$rootScope + */ + interface IRootScopeService { $apply(): any; $apply(exp: string): any; $apply(exp: (scope: IScope) => any): any; @@ -325,17 +483,23 @@ declare module ng { $digest(): void; $emit(name: string, ...args: any[]): IAngularEvent; - // Documentation says exp is optional, but actual implementaton counts on it - $eval(expression: string, args?: Object): any; - $eval(expression: (scope: IScope) => any, args?: Object): any; + $eval(expression?: string, args?: Object): any; + $eval(expression?: (scope: IScope) => any, args?: Object): any; - // Documentation says exp is optional, but actual implementaton counts on it - $evalAsync(expression: string): void; - $evalAsync(expression: (scope: IScope) => any): void; + $evalAsync(expression?: string): void; + $evalAsync(expression?: (scope: IScope) => any): void; // Defaults to false by the implementation checking strategy $new(isolate?: boolean): IScope; + /** + * Listens on events of a given type. See $emit for discussion of event life cycle. + * + * The event listener function format is: function(event, args...). + * + * @param name Event name to listen on. + * @param listener Function to call when the event is emitted. + */ $on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function; $watch(watchExpression: string, listener?: string, objectEquality?: boolean): Function; @@ -347,28 +511,49 @@ declare module ng { $watchCollection(watchExpression: (scope: IScope) => any, listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; $watchGroup(watchExpressions: any[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; - $watchGroup(watchExpressions: {(scope: IScope) : any}[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; + $watchGroup(watchExpressions: { (scope: IScope): any }[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; $parent: IScope; $root: IRootScopeService; + this: IRootScopeService; - $id: string; + $id: number; // Hidden members $$isolateBindings: any; $$phase: any; } - interface IAngularEvent { - targetScope: IScope; - currentScope: IScope; - name: string; - preventDefault: Function; - defaultPrevented: boolean; + interface IScope extends IRootScopeService { + [index: string]: any; + } - // Available only events that were $emit-ted + interface IAngularEvent { + /** + * the scope on which the event was $emit-ed or $broadcast-ed. + */ + targetScope: IScope; + /** + * the scope that is currently handling the event. Once the event propagates through the scope hierarchy, this property is set to null. + */ + currentScope: IScope; + /** + * name of the event. + */ + name: string; + /** + * calling stopPropagation function will cancel further event propagation (available only for events that were $emit-ed). + */ stopPropagation?: Function; + /** + * calling preventDefault sets defaultPrevented flag to true. + */ + preventDefault: Function; + /** + * true if preventDefault was called. + */ + defaultPrevented: boolean; } /////////////////////////////////////////////////////////////////////////// @@ -517,25 +702,79 @@ declare module ng { assign(context: any, value: any): any; } - /////////////////////////////////////////////////////////////////////////// - // LocationService - // see http://docs.angularjs.org/api/ng.$location - // see http://docs.angularjs.org/api/ng.$locationProvider - // see http://docs.angularjs.org/guide/dev_guide.services.$location - /////////////////////////////////////////////////////////////////////////// + /** + * $location - $locationProvider - service in module ng + * see https://docs.angularjs.org/api/ng/service/$location + */ interface ILocationService { absUrl(): string; hash(): string; hash(newHash: string): ILocationService; host(): string; + + /** + * Return path of current url + */ path(): string; - path(newPath: string): ILocationService; + + /** + * Change path when called with parameter and return $location. + * Note: Path should always begin with forward slash (/), this method will add the forward slash if it is missing. + * + * @param path New path + */ + path(path: string): ILocationService; + port(): number; protocol(): string; replace(): ILocationService; + + /** + * Return search part (as object) of current url + */ search(): any; - search(parametersMap: any): ILocationService; - search(parameter: string, parameterValue: any): ILocationService; + + /** + * Change search part when called with parameter and return $location. + * + * @param search When called with a single argument the method acts as a setter, setting the search component of $location to the specified value. + * + * If the argument is a hash object containing an array of values, these values will be encoded as duplicate search parameters in the url. + */ + search(search: any): ILocationService; + + /** + * Change search part when called with parameter and return $location. + * + * @param search New search params + * @param paramValue If search is a string or a Number, then paramValue will override only a single search property. If paramValue is null, the property specified via the first argument will be deleted. + */ + search(search: string, paramValue: string): ILocationService; + + /** + * Change search part when called with parameter and return $location. + * + * @param search New search params + * @param paramValue If search is a string or a Number, then paramValue will override only a single search property. If paramValue is null, the property specified via the first argument will be deleted. + */ + search(search: string, paramValue: number): ILocationService; + + /** + * Change search part when called with parameter and return $location. + * + * @param search New search params + * @param paramValue If paramValue is an array, it will override the property of the search component of $location specified via the first argument. + */ + search(search: string, paramValue: string[]): ILocationService; + + /** + * Change search part when called with parameter and return $location. + * + * @param search New search params + * @param paramValue If paramValue is true, the property specified via the first argument will be added with no value nor trailing equal sign. + */ + search(search: string, paramValue: boolean): ILocationService; + url(): string; url(url: string): ILocationService; } @@ -626,22 +865,50 @@ declare module ng { } interface IPromise { + /** + * Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected. + * + * This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method. + */ then(successCallback: (promiseValue: T) => IHttpPromise, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; + /** + * Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected. + * + * This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method. + */ then(successCallback: (promiseValue: T) => IPromise, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; + /** + * Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected. + * + * This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method. + */ then(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult, notifyCallback?: (state: any) => any): IPromise; - + /** + * Shorthand for promise.then(null, errorCallback) + */ catch(onRejected: (reason: any) => IHttpPromise): IPromise; + /** + * Shorthand for promise.then(null, errorCallback) + */ catch(onRejected: (reason: any) => IPromise): IPromise; + /** + * Shorthand for promise.then(null, errorCallback) + */ catch(onRejected: (reason: any) => TResult): IPromise; - finally(finallyCallback: ()=>any):IPromise; + /** + * Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information. + * + * Because finally is a reserved word in JavaScript and reserved keywords are not supported as property names by ES3, you'll need to invoke the method like promise['finally'](callback) to make your code IE8 and Android 2.x compatible. + */ + finally(finallyCallback: () => any): IPromise; } interface IDeferred { resolve(value?: T): void; reject(reason?: any): void; - notify(state?:any): void; + notify(state?: any): void; promise: IPromise; } @@ -670,7 +937,7 @@ declare module ng { // Methods bellow are not documented info(): any; - get (cacheId: string): ICacheObject; + get(cacheId: string): ICacheObject; } interface ICacheObject { @@ -682,7 +949,7 @@ declare module ng { //capacity: number; }; put(key: string, value?: any): void; - get (key: string): any; + get(key: string): any; remove(key: string): void; removeAll(): void; destroy(): void; @@ -962,12 +1229,6 @@ declare module ng { /////////////////////////////////////////////////////////////////////////// interface ITemplateCacheService extends ICacheObject {} - /////////////////////////////////////////////////////////////////////////// - // RootScopeService - // see http://docs.angularjs.org/api/ng.$rootScope - /////////////////////////////////////////////////////////////////////////// - interface IRootScopeService extends IScope {} - /////////////////////////////////////////////////////////////////////////// // SCEService // see http://docs.angularjs.org/api/ng.$sce @@ -1031,22 +1292,34 @@ declare module ng { (...args: any[]): IDirective; } - - interface IDirective{ - compile?: - (templateElement: IAugmentedJQuery, - templateAttributes: IAttributes, - transclude: ITranscludeFunction - ) => any; - controller?: any; - controllerAs?: string; - link?: - (scope: IScope, + interface IDirectiveLinkFn { + ( + scope: IScope, instanceElement: IAugmentedJQuery, instanceAttributes: IAttributes, controller: any, transclude: ITranscludeFunction - ) => void; + ): void; + } + + interface IDirectivePrePost { + pre?: IDirectiveLinkFn; + post?: IDirectiveLinkFn; + } + + interface IDirectiveCompileFn { + ( + templateElement: IAugmentedJQuery, + templateAttributes: IAttributes, + transclude: ITranscludeFunction + ): IDirectivePrePost; + } + + interface IDirective { + compile?: IDirectiveCompileFn; + controller?: any; + controllerAs?: string; + link?: IDirectiveLinkFn; name?: string; priority?: number; replace?: boolean; @@ -1059,12 +1332,12 @@ declare module ng { transclude?: any; } - /////////////////////////////////////////////////////////////////////////// - // angular.element - // when calling angular.element, angular returns a jQuery object, - // augmented with additional methods like e.g. scope. - // see: http://docs.angularjs.org/api/angular.element - /////////////////////////////////////////////////////////////////////////// + /** + * angular.element + * when calling angular.element, angular returns a jQuery object, + * augmented with additional methods like e.g. scope. + * see: http://docs.angularjs.org/api/angular.element + */ interface IAugmentedJQueryStatic extends JQueryStatic { (selector: string, context?: any): IAugmentedJQuery; (element: Element): IAugmentedJQuery; diff --git a/angularjs/legacy/angular-1.0-tests.ts.tscparams b/angularjs/legacy/angular-1.0-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/angularjs/legacy/angular-1.0-tests.ts.tscparams +++ b/angularjs/legacy/angular-1.0-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/angularjs/legacy/angular-1.2-tests.ts b/angularjs/legacy/angular-1.2-tests.ts new file mode 100644 index 000000000..d0f60609a --- /dev/null +++ b/angularjs/legacy/angular-1.2-tests.ts @@ -0,0 +1,571 @@ +/// + +// issue: https://github.com/borisyankov/DefinitelyTyped/issues/369 +// https://github.com/witoldsz/angular-http-auth/blob/master/src/angular-http-auth.js +/** + * @license HTTP Auth Interceptor Module for AngularJS + * (c) 2012 Witold Szczerba + * License: MIT + */ + +class AuthService { + /** + * Holds all the requests which failed due to 401 response, + * so they can be re-requested in future, once login is completed. + */ + buffer: { config: ng.IRequestConfig; deferred: ng.IDeferred; }[] = []; + + /** + * Required by HTTP interceptor. + * Function is attached to provider to be invisible for regular users of this service. + */ + pushToBuffer = function(config: ng.IRequestConfig, deferred: ng.IDeferred) { + this.buffer.push({ + config: config, + deferred: deferred + }); + } + + $get = [ + '$rootScope', '$injector', function($rootScope: ng.IScope, $injector: ng.auto.IInjectorService) { + var $http: ng.IHttpService; //initialized later because of circular dependency problem + function retry(config: ng.IRequestConfig, deferred: ng.IDeferred) { + $http = $http || $injector.get('$http'); + $http(config).then(function (response) { + deferred.resolve(response); + }); + } + function retryAll() { + for (var i = 0; i < this.buffer.length; ++i) { + retry(this.buffer[i].config, this.buffer[i].deferred); + } + this.buffer = []; + } + + return { + loginConfirmed: function () { + $rootScope.$broadcast('event:auth-loginConfirmed'); + retryAll(); + } + } + } + ]; +} + +angular.module('http-auth-interceptor', []) + + .provider('authService', AuthService) + +/** + * $http interceptor. + * On 401 response - it stores the request and broadcasts 'event:angular-auth-loginRequired'. + */ + .config(['$httpProvider', 'authServiceProvider', function ($httpProvider: ng.IHttpProvider, authServiceProvider: any) { + + var interceptor = ['$rootScope', '$q', function ($rootScope: ng.IScope, $q: ng.IQService) { + function success(response: ng.IHttpPromiseCallbackArg) { + return response; + } + + function error(response: ng.IHttpPromiseCallbackArg) { + if (response.status === 401) { + var deferred = $q.defer(); + authServiceProvider.pushToBuffer(response.config, deferred); + $rootScope.$broadcast('event:auth-loginRequired'); + return deferred.promise; + } + // otherwise + return $q.reject(response); + } + + return function (promise: ng.IHttpPromise) { + return promise.then(success, error); + } + + }]; + $httpProvider.responseInterceptors.push(interceptor); + }]); + + +module HttpAndRegularPromiseTests { + interface Person { + firstName: string; + lastName: string; + } + + interface ExpectedResponse extends Person { } + + interface SomeControllerScope extends ng.IScope { + person: Person; + theAnswer: number; + letters: string[]; + snack: string; + nothing?: string; + } + + var someController: Function = ($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) => { + $http.get("http://somewhere/some/resource") + .success((data: ExpectedResponse) => { + $scope.person = data; + }); + + $http.get("http://somewhere/some/resource") + .then((response: ng.IHttpPromiseCallbackArg) => { + // typing lost, so something like + // var i: number = response.data + // would type check + $scope.person = response.data; + }); + + $http.get("http://somewhere/some/resource") + .then((response: ng.IHttpPromiseCallbackArg) => { + // typing lost, so something like + // var i: number = response.data + // would NOT type check + $scope.person = response.data; + }); + + var aPromise: ng.IPromise = $q.when({ firstName: "Jack", lastName: "Sparrow" }); + aPromise.then((person: Person) => { + $scope.person = person; + }); + + var bPromise: ng.IPromise = $q.when(42); + bPromise.then((answer: number) => { + $scope.theAnswer = answer; + }); + + var cPromise: ng.IPromise = $q.when(["a", "b", "c"]); + cPromise.then((letters: string[]) => { + $scope.letters = letters; + }); + + // When $q.when is passed an IPromise, it returns an IPromise + var dPromise: ng.IPromise = $q.when($q.when("ALBATROSS!")); + dPromise.then((snack: string) => { + $scope.snack = snack; + }); + + // $q.when may be called without arguments + var ePromise: ng.IPromise = $q.when(); + ePromise.then(() => { + $scope.nothing = "really nothing"; + }); + } + + // Test that we can pass around a type-checked success/error Promise Callback + var anotherController: Function = ($scope: SomeControllerScope, $http: + ng.IHttpService, $q: ng.IQService) => { + + var buildFooData: Function = () => 42; + + var doFoo: Function = (callback: ng.IHttpPromiseCallback) => { + $http.get('/foo', buildFooData()) + .success(callback); + } + + doFoo((data: any) => console.log(data)); + } +} + +// Test for AngularJS Syntax + +module My.Namespace { + export var x: any; // need to export something for module to kick in +} + +// IModule Registering Test +var mod = angular.module('tests', []); +mod.controller('name', function ($scope: ng.IScope) { }) +mod.controller('name', ['$scope', function ($scope: ng.IScope) { }]) +mod.controller(My.Namespace); +mod.directive('name', function ($scope: ng.IScope) { }) +mod.directive('name', ['$scope', function ($scope: ng.IScope) { }]) +mod.directive(My.Namespace); +mod.factory('name', function ($scope: ng.IScope) { }) +mod.factory('name', ['$scope', function ($scope: ng.IScope) { }]) +mod.factory(My.Namespace); +mod.filter('name', function ($scope: ng.IScope) { }) +mod.filter('name', ['$scope', function ($scope: ng.IScope) { }]) +mod.filter(My.Namespace); +mod.provider('name', function ($scope: ng.IScope) { return { $get: () => { } } }) +mod.provider('name', TestProvider); +mod.provider('name', ['$scope', function ($scope: ng.IScope) { }]) +mod.provider(My.Namespace); +mod.service('name', function ($scope: ng.IScope) { }) +mod.service('name', ['$scope', function ($scope: ng.IScope) { }]) +mod.service(My.Namespace); +mod.constant('name', 23); +mod.constant('name', "23"); +mod.constant(My.Namespace); +mod.value('name', 23); +mod.value('name', "23"); +mod.value(My.Namespace); + +class TestProvider implements ng.IServiceProvider { + constructor(private $scope: ng.IScope) { + } + + $get() { + } +} + +// Promise signature tests +var foo: ng.IPromise; +foo.then((x) => { + // x is inferred to be a number + return "asdf"; +}).then((x) => { + // x is inferred to be string + x.length; + return 123; +}).then((x) => { + // x is infered to be a number + x.toFixed(); + return; +}).then((x) => { + // x is infered to be void + // Typescript will prevent you to actually use x as a local variable + // Try object: + return { a: 123 }; +}).then((x) => { + // Object is inferred here + x.a = 123; + //Try a promise + var y: ng.IPromise; + return y; +}).then((x) => { + // x is infered to be a number, which is the resolved value of a promise + x.toFixed(); +}); + + +var httpFoo: ng.IHttpPromise; +httpFoo.then((x) => { + // When returning a promise the generic type must be inferred. + var innerPromise : ng.IPromise; + return innerPromise; +}).then((x) => { + // must still be number. + x.toFixed(); +}); + + +function test_angular_forEach() { + var values: { [key: string]: string } = { name: 'misko', gender: 'male' }; + var log: string[] = []; + angular.forEach(values, function (value, key) { + this.push(key + ': ' + value); + }, log); + //expect(log).toEqual(['name: misko', 'gender: male']); +} + +// angular.element() tests +var element = angular.element("div.myApp"); +var scope: ng.IScope = element.scope(); +var isolateScope: ng.IScope = element.isolateScope(); + + + +function test_IAttributes(attributes: ng.IAttributes){ + return attributes; +} + +test_IAttributes({ + $addClass: function (classVal){}, + $removeClass: function(classVal){}, + $set: function(key, value){}, + $observe: function(name, fn){ + return fn; + }, + $attr: {} +}); + +class SampleDirective implements ng.IDirective { + public restrict = 'A'; + name = 'doh'; + + compile(templateElement: ng.IAugmentedJQuery) { + return { + post: this.link + }; + } + + static instance():ng.IDirective { + return new SampleDirective(); + } + + link(scope: ng.IScope) { + + } +} + +class SampleDirective2 implements ng.IDirective { + public restrict = 'EAC'; + + compile(templateElement: ng.IAugmentedJQuery) { + return { + pre: this.link + }; + } + + static instance():ng.IDirective { + return new SampleDirective2(); + } + + link(scope: ng.IScope) { + + } +} + +angular.module('SameplDirective', []).directive('sampleDirective', SampleDirective.instance).directive('sameplDirective2', SampleDirective2.instance); + +// test from https://docs.angularjs.org/guide/directive +angular.module('docsSimpleDirective', []) + .controller('Controller', ['$scope', function($scope: any) { + $scope.customer = { + name: 'Naomi', + address: '1600 Amphitheatre' + }; + }]) + .directive('myCustomer', function() { + return { + template: 'Name: {{customer.name}} Address: {{customer.address}}' + }; + }); + +angular.module('docsTemplateUrlDirective', []) + .controller('Controller', ['$scope', function($scope: any) { + $scope.customer = { + name: 'Naomi', + address: '1600 Amphitheatre' + }; + }]) + .directive('myCustomer', function() { + return { + templateUrl: 'my-customer.html' + }; + }); + +angular.module('docsRestrictDirective', []) + .controller('Controller', ['$scope', function($scope: any) { + $scope.customer = { + name: 'Naomi', + address: '1600 Amphitheatre' + }; + }]) + .directive('myCustomer', function() { + return { + restrict: 'E', + templateUrl: 'my-customer.html' + }; + }); + +angular.module('docsScopeProblemExample', []) + .controller('NaomiController', ['$scope', function($scope: any) { + $scope.customer = { + name: 'Naomi', + address: '1600 Amphitheatre' + }; + }]) + .controller('IgorController', ['$scope', function($scope: any) { + $scope.customer = { + name: 'Igor', + address: '123 Somewhere' + }; + }]) + .directive('myCustomer', function() { + return { + restrict: 'E', + templateUrl: 'my-customer.html' + }; + }); + +angular.module('docsIsolateScopeDirective', []) + .controller('Controller', ['$scope', function($scope: any) { + $scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' }; + $scope.igor = { name: 'Igor', address: '123 Somewhere' }; + }]) + .directive('myCustomer', function() { + return { + restrict: 'E', + scope: { + customerInfo: '=info' + }, + templateUrl: 'my-customer-iso.html' + }; + }); + +angular.module('docsIsolationExample', []) + .controller('Controller', ['$scope', function($scope: any) { + $scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' }; + $scope.vojta = { name: 'Vojta', address: '3456 Somewhere Else' }; + }]) + .directive('myCustomer', function() { + return { + restrict: 'E', + scope: { + customerInfo: '=info' + }, + templateUrl: 'my-customer-plus-vojta.html' + }; + }); + +angular.module('docsTimeDirective', []) + .controller('Controller', ['$scope', function($scope: any) { + $scope.format = 'M/d/yy h:mm:ss a'; + }]) + .directive('myCurrentTime', ['$interval', 'dateFilter', function($interval: any, dateFilter: any) { + + return { + link: function(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs:ng.IAttributes) { + var format: any, + timeoutId: any; + + function updateTime() { + element.text(dateFilter(new Date(), format)); + } + + scope.$watch(attrs['myCurrentTime'], function (value: any) { + format = value; + updateTime(); + }); + + element.on('$destroy', function () { + $interval.cancel(timeoutId); + }); + + // start the UI update process; save the timeoutId for canceling + timeoutId = $interval(function () { + updateTime(); // update DOM + }, 1000); + } + }; + }]); + +angular.module('docsTransclusionDirective', []) + .controller('Controller', ['$scope', function($scope: any) { + $scope.name = 'Tobias'; + }]) + .directive('myDialog', function() { + return { + restrict: 'E', + transclude: true, + templateUrl: 'my-dialog.html' + }; + }); + +angular.module('docsTransclusionExample', []) + .controller('Controller', ['$scope', function($scope: any) { + $scope.name = 'Tobias'; + }]) + .directive('myDialog', function() { + return { + restrict: 'E', + transclude: true, + scope: {}, + templateUrl: 'my-dialog.html', + link: function (scope: ng.IScope, element: ng.IAugmentedJQuery) { + scope['name'] = 'Jeff'; + } + }; + }); + +angular.module('docsIsoFnBindExample', []) + .controller('Controller', ['$scope', '$timeout', function($scope: any, $timeout: any) { + $scope.name = 'Tobias'; + $scope.hideDialog = function () { + $scope.dialogIsHidden = true; + $timeout(function () { + $scope.dialogIsHidden = false; + }, 2000); + }; + }]) + .directive('myDialog', function() { + return { + restrict: 'E', + transclude: true, + scope: { + 'close': '&onClose' + }, + templateUrl: 'my-dialog-close.html' + }; + }); + +angular.module('dragModule', []) + .directive('myDraggable', ['$document', function($document: any) { + return function(scope: any, element: any, attr: any) { + var startX = 0, startY = 0, x = 0, y = 0; + + element.css({ + position: 'relative', + border: '1px solid red', + backgroundColor: 'lightgrey', + cursor: 'pointer' + }); + + element.on('mousedown', function(event: any) { + // Prevent default dragging of selected content + event.preventDefault(); + startX = event.pageX - x; + startY = event.pageY - y; + $document.on('mousemove', mousemove); + $document.on('mouseup', mouseup); + }); + + function mousemove(event: any) { + y = event.pageY - startY; + x = event.pageX - startX; + element.css({ + top: y + 'px', + left: x + 'px' + }); + } + + function mouseup() { + $document.off('mousemove', mousemove); + $document.off('mouseup', mouseup); + } + }; + }]); + +angular.module('docsTabsExample', []) + .directive('myTabs', function() { + return { + restrict: 'E', + transclude: true, + scope: {}, + controller: function($scope: ng.IScope) { + var panes: any = $scope['panes'] = []; + + $scope['select'] = function(pane: any) { + angular.forEach(panes, function(pane: any) { + pane.selected = false; + }); + pane.selected = true; + }; + + this.addPane = function(pane: any) { + if (panes.length === 0) { + $scope['select'](pane); + } + panes.push(pane); + }; + }, + templateUrl: 'my-tabs.html' + }; + }) + .directive('myPane', function() { + return { + require: '^myTabs', + restrict: 'E', + transclude: true, + scope: { + title: '@' + }, + link: function(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes, tabsCtrl: any) { + tabsCtrl.addPane(scope); + }, + templateUrl: 'my-pane.html' + }; + }); diff --git a/angularjs/legacy/angular-1.2.d.ts b/angularjs/legacy/angular-1.2.d.ts new file mode 100644 index 000000000..a1a4cb15b --- /dev/null +++ b/angularjs/legacy/angular-1.2.d.ts @@ -0,0 +1,1182 @@ +// Type definitions for Angular JS 1.2+ +// Project: http://angularjs.org +// Definitions by: Diego Vilar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +declare var angular: ng.IAngularStatic; + +// Support for painless dependency injection +interface Function { + $inject?: string[]; +} + +/////////////////////////////////////////////////////////////////////////////// +// ng module (angular.js) +/////////////////////////////////////////////////////////////////////////////// +declare module ng { + + // not directly implemented, but ensures that constructed class implements $get + interface IServiceProviderClass { + new(...args: any[]): IServiceProvider; + } + + interface IServiceProviderFactory { + (...args: any[]): IServiceProvider; + } + + // All service providers extend this interface + interface IServiceProvider { + $get: any; + } + + /////////////////////////////////////////////////////////////////////////// + // AngularStatic + // see http://docs.angularjs.org/api + /////////////////////////////////////////////////////////////////////////// + interface IAngularStatic { + bind(context: any, fn: Function, ...args: any[]): Function; + bootstrap(element: string, modules?: any[]): auto.IInjectorService; + bootstrap(element: JQuery, modules?: any[]): auto.IInjectorService; + bootstrap(element: Element, modules?: any[]): auto.IInjectorService; + bootstrap(element: Document, modules?: any[]): auto.IInjectorService; + copy(source: any, destination?: any): any; + element: IAugmentedJQueryStatic; + equals(value1: any, value2: any): boolean; + extend(destination: any, ...sources: any[]): any; + + /** + * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. + * + * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. + * + * @param obj Object to iterate over. + * @param iterator Iterator function. + * @param context Object to become context (this) for the iterator function. + */ + forEach(obj: T[], iterator: (value: T, key: number) => any, context?: any): any; + /** + * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. + * + * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. + * + * @param obj Object to iterate over. + * @param iterator Iterator function. + * @param context Object to become context (this) for the iterator function. + */ + forEach(obj: { [index: string]: T; }, iterator: (value: T, key: string) => any, context?: any): any; + /** + * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. + * + * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. + * + * @param obj Object to iterate over. + * @param iterator Iterator function. + * @param context Object to become context (this) for the iterator function. + */ + forEach(obj: any, iterator: (value: any, key: any) => any, context?: any): any; + + fromJson(json: string): any; + identity(arg?: any): any; + injector(modules?: any[]): auto.IInjectorService; + isArray(value: any): boolean; + isDate(value: any): boolean; + isDefined(value: any): boolean; + isElement(value: any): boolean; + isFunction(value: any): boolean; + isNumber(value: any): boolean; + isObject(value: any): boolean; + isString(value: any): boolean; + isUndefined(value: any): boolean; + lowercase(str: string): string; + + /** + * The angular.module is a global place for creating, registering and retrieving Angular modules. All modules (angular core or 3rd party) that should be available to an application must be registered using this mechanism. + * + * When passed two or more arguments, a new module is created. If passed only one argument, an existing module (the name passed as the first argument to module) is retrieved. + * + * @param name The name of the module to create or retrieve. + * @param requires The names of modules this module depends on. If specified then new module is being created. If unspecified then the module is being retrieved for further configuration. + * @param configFn Optional configuration function for the module. + */ + module( + name: string, + requires?: string[], + configFn?: Function): IModule; + + noop(...args: any[]): void; + toJson(obj: any, pretty?: boolean): string; + uppercase(str: string): string; + version: { + full: string; + major: number; + minor: number; + dot: number; + codename: string; + }; + } + + /////////////////////////////////////////////////////////////////////////// + // Module + // see http://docs.angularjs.org/api/angular.Module + /////////////////////////////////////////////////////////////////////////// + interface IModule { + animation(name: string, animationFactory: Function): IModule; + animation(name: string, inlineAnnotatedFunction: any[]): IModule; + animation(object: Object): IModule; + /** + * Use this method to register work which needs to be performed on module loading. + * + * @param configFn Execute this function on module load. Useful for service configuration. + */ + config(configFn: Function): IModule; + /** + * Use this method to register work which needs to be performed on module loading. + * + * @param inlineAnnotatedFunction Execute this function on module load. Useful for service configuration. + */ + config(inlineAnnotatedFunction: any[]): IModule; + /** + * Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator. + * + * @param name The name of the constant. + * @param value The constant value. + */ + constant(name: string, value: any): IModule; + constant(object: Object): IModule; + /** + * The $controller service is used by Angular to create new controllers. + * + * This provider allows controller registration via the register method. + * + * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors. + * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation). + */ + controller(name: string, controllerConstructor: Function): IModule; + /** + * The $controller service is used by Angular to create new controllers. + * + * This provider allows controller registration via the register method. + * + * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors. + * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation). + */ + controller(name: string, inlineAnnotatedConstructor: any[]): IModule; + controller(object : Object): IModule; + directive(name: string, directiveFactory: IDirectiveFactory): IModule; + directive(name: string, inlineAnnotatedFunction: any[]): IModule; + directive(object: Object): IModule; + /** + * Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider. + * + * @param name The name of the instance. + * @param $getFn The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}). + */ + factory(name: string, $getFn: Function): IModule; + /** + * Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider. + * + * @param name The name of the instance. + * @param inlineAnnotatedFunction The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}). + */ + factory(name: string, inlineAnnotatedFunction: any[]): IModule; + factory(object: Object): IModule; + filter(name: string, filterFactoryFunction: Function): IModule; + filter(name: string, inlineAnnotatedFunction: any[]): IModule; + filter(object: Object): IModule; + provider(name: string, serviceProviderFactory: IServiceProviderFactory): IModule; + provider(name: string, serviceProviderConstructor: IServiceProviderClass): IModule; + provider(name: string, inlineAnnotatedConstructor: any[]): IModule; + provider(name: string, providerObject: IServiceProvider): IModule; + provider(object: Object): IModule; + /** + * Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests. + */ + run(initializationFunction: Function): IModule; + /** + * Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests. + */ + run(inlineAnnotatedFunction: any[]): IModule; + service(name: string, serviceConstructor: Function): IModule; + service(name: string, inlineAnnotatedConstructor: any[]): IModule; + service(object: Object): IModule; + /** + * Register a value service with the $injector, such as a string, a number, an array, an object or a function. This is short for registering a service where its provider's $get property is a factory function that takes no arguments and returns the value service. + + Value services are similar to constant services, except that they cannot be injected into a module configuration function (see config) but they can be overridden by an Angular decorator. + * + * @param name The name of the instance. + * @param value The value. + */ + value(name: string, value: any): IModule; + value(object: Object): IModule; + + // Properties + name: string; + requires: string[]; + } + + /////////////////////////////////////////////////////////////////////////// + // Attributes + // see http://docs.angularjs.org/api/ng.$compile.directive.Attributes + /////////////////////////////////////////////////////////////////////////// + interface IAttributes { + // this is necessary to be able to access the scoped attributes. it's not very elegant + // because you have to use attrs['foo'] instead of attrs.foo but I don't know of a better way + // this should really be limited to return string but it creates this problem: http://stackoverflow.com/q/17201854/165656 + [name: string]: any; + + // Adds the CSS class value specified by the classVal parameter to the + // element. If animations are enabled then an animation will be triggered + // for the class addition. + $addClass(classVal: string): void; + + // Removes the CSS class value specified by the classVal parameter from the + // element. If animations are enabled then an animation will be triggered for + // the class removal. + $removeClass(classVal: string): void; + + // Set DOM element attribute value. + $set(key: string, value: any): void; + + // Observes an interpolated attribute. + // The observer function will be invoked once during the next $digest + // following compilation. The observer is then invoked whenever the + // interpolated value changes. + $observe(name: string, fn:(value?:any)=>any): Function; + + // A map of DOM element attribute names to the normalized name. This is needed + // to do reverse lookup from normalized name back to actual name. + $attr: Object; + } + + /** + * form.FormController - type in module ng + * see https://docs.angularjs.org/api/ng/type/form.FormController + */ + interface IFormController { + + /** + * Indexer which should return ng.INgModelController for most properties but cannot because of "All named properties must be assignable to string indexer type" constraint - see https://github.com/Microsoft/TypeScript/issues/272 + */ + [name: string]: any; + + $pristine: boolean; + $dirty: boolean; + $valid: boolean; + $invalid: boolean; + $error: any; + $addControl(control: ng.INgModelController): void; + $removeControl(control: ng.INgModelController): void; + $setValidity(validationErrorKey: string, isValid: boolean, control: ng.INgModelController): void; + $setDirty(): void; + $setPristine(): void; + } + + /////////////////////////////////////////////////////////////////////////// + // NgModelController + // see http://docs.angularjs.org/api/ng.directive:ngModel.NgModelController + /////////////////////////////////////////////////////////////////////////// + interface INgModelController { + $render(): void; + $setValidity(validationErrorKey: string, isValid: boolean): void; + // Documentation states viewValue and modelValue to be a string but other + // types do work and it's common to use them. + $setViewValue(value: any): void; + $viewValue: any; + + $modelValue: any; + + $parsers: IModelParser[]; + $formatters: IModelFormatter[]; + $viewChangeListeners: IModelViewChangeListener[]; + $error: any; + $pristine: boolean; + $dirty: boolean; + $valid: boolean; + $invalid: boolean; + } + + interface IModelParser { + (value: any): any; + } + + interface IModelFormatter { + (value: any): any; + } + + interface IModelViewChangeListener { + (): void; + } + + /////////////////////////////////////////////////////////////////////////// + // Scope and RootScope + // see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and http://docs.angularjs.org/api/ng.$rootScope + /////////////////////////////////////////////////////////////////////////// + interface IRootScopeService { + $apply(): any; + $apply(exp: string): any; + $apply(exp: (scope: IScope) => any): any; + + $broadcast(name: string, ...args: any[]): IAngularEvent; + $destroy(): void; + $digest(): void; + $emit(name: string, ...args: any[]): IAngularEvent; + + // Documentation says exp is optional, but actual implementaton counts on it + $eval(expression: string, args?: Object): any; + $eval(expression: (scope: IScope) => any, args?: Object): any; + + // Documentation says exp is optional, but actual implementaton counts on it + $evalAsync(expression: string): void; + $evalAsync(expression: (scope: IScope) => any): void; + + // Defaults to false by the implementation checking strategy + $new(isolate?: boolean): IScope; + + $on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function; + + $watch(watchExpression: string, listener?: string, objectEquality?: boolean): Function; + $watch(watchExpression: string, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: boolean): Function; + $watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: boolean): Function; + $watch(watchExpression: (scope: IScope) => any, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: boolean): Function; + + $watchCollection(watchExpression: string, listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; + $watchCollection(watchExpression: (scope: IScope) => any, listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; + + $watchGroup(watchExpressions: any[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; + $watchGroup(watchExpressions: {(scope: IScope) : any}[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; + + $parent: IScope; + + $root: IRootScopeService; + this: IRootScopeService; + + $id: string; + + // Hidden members + $$isolateBindings: any; + $$phase: any; + } + + interface IScope extends IRootScopeService { + [index: string]: any; + } + + interface IAngularEvent { + targetScope: IScope; + currentScope: IScope; + name: string; + preventDefault: Function; + defaultPrevented: boolean; + + // Available only events that were $emit-ted + stopPropagation?: Function; + } + + /////////////////////////////////////////////////////////////////////////// + // WindowService + // see http://docs.angularjs.org/api/ng.$window + /////////////////////////////////////////////////////////////////////////// + interface IWindowService extends Window { + [key: string]: any; + } + + /////////////////////////////////////////////////////////////////////////// + // BrowserService + // TODO undocumented, so we need to get it from the source code + /////////////////////////////////////////////////////////////////////////// + interface IBrowserService { + [key: string]: any; + } + + /////////////////////////////////////////////////////////////////////////// + // TimeoutService + // see http://docs.angularjs.org/api/ng.$timeout + /////////////////////////////////////////////////////////////////////////// + interface ITimeoutService { + (func: Function, delay?: number, invokeApply?: boolean): IPromise; + cancel(promise: IPromise): boolean; + } + + /////////////////////////////////////////////////////////////////////////// + // IntervalService + // see http://docs.angularjs.org/api/ng.$interval + /////////////////////////////////////////////////////////////////////////// + interface IIntervalService { + (func: Function, delay: number, count?: number, invokeApply?: boolean): IPromise; + cancel(promise: IPromise): boolean; + } + + /////////////////////////////////////////////////////////////////////////// + // FilterService + // see http://docs.angularjs.org/api/ng.$filter + // see http://docs.angularjs.org/api/ng.$filterProvider + /////////////////////////////////////////////////////////////////////////// + interface IFilterService { + (name: string): Function; + } + + interface IFilterProvider extends IServiceProvider { + register(name: string, filterFactory: Function): IServiceProvider; + } + + /////////////////////////////////////////////////////////////////////////// + // LocaleService + // see http://docs.angularjs.org/api/ng.$locale + /////////////////////////////////////////////////////////////////////////// + interface ILocaleService { + id: string; + + // These are not documented + // Check angular's i18n files for exemples + NUMBER_FORMATS: ILocaleNumberFormatDescriptor; + DATETIME_FORMATS: ILocaleDateTimeFormatDescriptor; + pluralCat: (num: any) => string; + } + + interface ILocaleNumberFormatDescriptor { + DECIMAL_SEP: string; + GROUP_SEP: string; + PATTERNS: ILocaleNumberPatternDescriptor[]; + CURRENCY_SYM: string; + } + + interface ILocaleNumberPatternDescriptor { + minInt: number; + minFrac: number; + maxFrac: number; + posPre: string; + posSuf: string; + negPre: string; + negSuf: string; + gSize: number; + lgSize: number; + } + + interface ILocaleDateTimeFormatDescriptor { + MONTH: string[]; + SHORTMONTH: string[]; + DAY: string[]; + SHORTDAY: string[]; + AMPMS: string[]; + medium: string; + short: string; + fullDate: string; + longDate: string; + mediumDate: string; + shortDate: string; + mediumTime: string; + shortTime: string; + } + + /////////////////////////////////////////////////////////////////////////// + // LogService + // see http://docs.angularjs.org/api/ng.$log + // see http://docs.angularjs.org/api/ng.$logProvider + /////////////////////////////////////////////////////////////////////////// + interface ILogService { + debug: ILogCall; + error: ILogCall; + info: ILogCall; + log: ILogCall; + warn: ILogCall; + } + + interface ILogProvider { + debugEnabled(enabled: boolean): ILogProvider; + debugEnabled(): boolean; + } + + // We define this as separete interface so we can reopen it later for + // the ngMock module. + interface ILogCall { + (...args: any[]): void; + } + + /////////////////////////////////////////////////////////////////////////// + // ParseService + // see http://docs.angularjs.org/api/ng.$parse + // see http://docs.angularjs.org/api/ng.$parseProvider + /////////////////////////////////////////////////////////////////////////// + interface IParseService { + (expression: string): ICompiledExpression; + } + + interface IParseProvider { + logPromiseWarnings(): boolean; + logPromiseWarnings(value: boolean): IParseProvider; + + unwrapPromises(): boolean; + unwrapPromises(value: boolean): IParseProvider; + } + + interface ICompiledExpression { + (context: any, locals?: any): any; + + // If value is not provided, undefined is gonna be used since the implementation + // does not check the parameter. Let's force a value for consistency. If consumer + // whants to undefine it, pass the undefined value explicitly. + assign(context: any, value: any): any; + } + + /////////////////////////////////////////////////////////////////////////// + // LocationService + // see http://docs.angularjs.org/api/ng.$location + // see http://docs.angularjs.org/api/ng.$locationProvider + // see http://docs.angularjs.org/guide/dev_guide.services.$location + /////////////////////////////////////////////////////////////////////////// + interface ILocationService { + absUrl(): string; + hash(): string; + hash(newHash: string): ILocationService; + host(): string; + path(): string; + path(newPath: string): ILocationService; + port(): number; + protocol(): string; + replace(): ILocationService; + search(): any; + search(parametersMap: any): ILocationService; + search(parameter: string, parameterValue: any): ILocationService; + url(): string; + url(url: string): ILocationService; + } + + interface ILocationProvider extends IServiceProvider { + hashPrefix(): string; + hashPrefix(prefix: string): ILocationProvider; + html5Mode(): boolean; + + // Documentation states that parameter is string, but + // implementation tests it as boolean, which makes more sense + // since this is a toggler + html5Mode(active: boolean): ILocationProvider; + } + + /////////////////////////////////////////////////////////////////////////// + // DocumentService + // see http://docs.angularjs.org/api/ng.$document + /////////////////////////////////////////////////////////////////////////// + interface IDocumentService extends IAugmentedJQuery {} + + /////////////////////////////////////////////////////////////////////////// + // ExceptionHandlerService + // see http://docs.angularjs.org/api/ng.$exceptionHandler + /////////////////////////////////////////////////////////////////////////// + interface IExceptionHandlerService { + (exception: Error, cause?: string): void; + } + + /////////////////////////////////////////////////////////////////////////// + // RootElementService + // see http://docs.angularjs.org/api/ng.$rootElement + /////////////////////////////////////////////////////////////////////////// + interface IRootElementService extends JQuery {} + + /** + * $q - service in module ng + * A promise/deferred implementation inspired by Kris Kowal's Q. + * See http://docs.angularjs.org/api/ng/service/$q + */ + interface IQService { + /** + * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. + * + * Returns a single promise that will be resolved with an array/hash of values, each value corresponding to the promise at the same index/key in the promises array/hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. + * + * @param promises An array or hash of promises. + */ + all(promises: IPromise[]): IPromise; + /** + * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. + * + * Returns a single promise that will be resolved with an array/hash of values, each value corresponding to the promise at the same index/key in the promises array/hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. + * + * @param promises An array or hash of promises. + */ + all(promises: { [id: string]: IPromise; }): IPromise<{ [id: string]: any }>; + /** + * Creates a Deferred object which represents a task which will finish in the future. + */ + defer(): IDeferred; + /** + * Creates a promise that is resolved as rejected with the specified reason. This api should be used to forward rejection in a chain of promises. If you are dealing with the last promise in a promise chain, you don't need to worry about it. + * + * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of reject as the throw keyword in JavaScript. This also means that if you "catch" an error via a promise error callback and you want to forward the error to the promise derived from the current promise, you have to "rethrow" the error by returning a rejection constructed via reject. + * + * @param reason Constant, message, exception or an object representing the rejection reason. + */ + reject(reason?: any): IPromise; + /** + * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. + * + * @param value Value or a promise + */ + when(value: IPromise): IPromise; + /** + * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. + * + * @param value Value or a promise + */ + when(value: T): IPromise; + /** + * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. + * + * @param value Value or a promise + */ + when(): IPromise; + } + + interface IPromise { + then(successCallback: (promiseValue: T) => IHttpPromise, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; + then(successCallback: (promiseValue: T) => IPromise, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; + then(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult, notifyCallback?: (state: any) => any): IPromise; + + + catch(onRejected: (reason: any) => IHttpPromise): IPromise; + catch(onRejected: (reason: any) => IPromise): IPromise; + catch(onRejected: (reason: any) => TResult): IPromise; + + finally(finallyCallback: ()=>any):IPromise; + } + + interface IDeferred { + resolve(value?: T): void; + reject(reason?: any): void; + notify(state?:any): void; + promise: IPromise; + } + + /////////////////////////////////////////////////////////////////////////// + // AnchorScrollService + // see http://docs.angularjs.org/api/ng.$anchorScroll + /////////////////////////////////////////////////////////////////////////// + interface IAnchorScrollService { + (): void; + } + + interface IAnchorScrollProvider extends IServiceProvider { + disableAutoScrolling(): void; + } + + /////////////////////////////////////////////////////////////////////////// + // CacheFactoryService + // see http://docs.angularjs.org/api/ng.$cacheFactory + /////////////////////////////////////////////////////////////////////////// + interface ICacheFactoryService { + // Lets not foce the optionsMap to have the capacity member. Even though + // it's the ONLY option considered by the implementation today, a consumer + // might find it useful to associate some other options to the cache object. + //(cacheId: string, optionsMap?: { capacity: number; }): CacheObject; + (cacheId: string, optionsMap?: { capacity: number; }): ICacheObject; + + // Methods bellow are not documented + info(): any; + get (cacheId: string): ICacheObject; + } + + interface ICacheObject { + info(): { + id: string; + size: number; + + // Not garanteed to have, since it's a non-mandatory option + //capacity: number; + }; + put(key: string, value?: any): void; + get (key: string): any; + remove(key: string): void; + removeAll(): void; + destroy(): void; + } + + /////////////////////////////////////////////////////////////////////////// + // CompileService + // see http://docs.angularjs.org/api/ng.$compile + // see http://docs.angularjs.org/api/ng.$compileProvider + /////////////////////////////////////////////////////////////////////////// + interface ICompileService { + (element: string, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; + (element: Element, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; + (element: JQuery, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; + } + + interface ICompileProvider extends IServiceProvider { + directive(name: string, directiveFactory: Function): ICompileProvider; + + // Undocumented, but it is there... + directive(directivesMap: any): ICompileProvider; + + aHrefSanitizationWhitelist(): RegExp; + aHrefSanitizationWhitelist(regexp: RegExp): ICompileProvider; + + imgSrcSanitizationWhitelist(): RegExp; + imgSrcSanitizationWhitelist(regexp: RegExp): ICompileProvider; + } + + interface ICloneAttachFunction { + // Let's hint but not force cloneAttachFn's signature + (clonedElement?: JQuery, scope?: IScope): any; + } + + // This corresponds to the "publicLinkFn" returned by $compile. + interface ITemplateLinkingFunction { + (scope: IScope, cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery; + } + + // This corresponds to $transclude (and also the transclude function passed to link). + interface ITranscludeFunction { + // If the scope is provided, then the cloneAttachFn must be as well. + (scope: IScope, cloneAttachFn: ICloneAttachFunction): IAugmentedJQuery; + // If one argument is provided, then it's assumed to be the cloneAttachFn. + (cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery; + } + + /////////////////////////////////////////////////////////////////////////// + // ControllerService + // see http://docs.angularjs.org/api/ng.$controller + // see http://docs.angularjs.org/api/ng.$controllerProvider + /////////////////////////////////////////////////////////////////////////// + interface IControllerService { + // Although the documentation doesn't state this, locals are optional + (controllerConstructor: Function, locals?: any): any; + (controllerName: string, locals?: any): any; + } + + interface IControllerProvider extends IServiceProvider { + register(name: string, controllerConstructor: Function): void; + register(name: string, dependencyAnnotatedConstructor: any[]): void; + } + + /** + * HttpService + * see http://docs.angularjs.org/api/ng/service/$http + */ + interface IHttpService { + /** + * Object describing the request to be made and how it should be processed. + */ + (config: IRequestConfig): IHttpPromise; + + /** + * Shortcut method to perform GET request. + * + * @param url Relative or absolute URL specifying the destination of the request + * @param config Optional configuration object + */ + get(url: string, config?: IRequestShortcutConfig): IHttpPromise; + + /** + * Shortcut method to perform DELETE request. + * + * @param url Relative or absolute URL specifying the destination of the request + * @param config Optional configuration object + */ + delete(url: string, config?: IRequestShortcutConfig): IHttpPromise; + + /** + * Shortcut method to perform HEAD request. + * + * @param url Relative or absolute URL specifying the destination of the request + * @param config Optional configuration object + */ + head(url: string, config?: IRequestShortcutConfig): IHttpPromise; + + /** + * Shortcut method to perform JSONP request. + * + * @param url Relative or absolute URL specifying the destination of the request + * @param config Optional configuration object + */ + jsonp(url: string, config?: IRequestShortcutConfig): IHttpPromise; + + /** + * Shortcut method to perform POST request. + * + * @param url Relative or absolute URL specifying the destination of the request + * @param data Request content + * @param config Optional configuration object + */ + post(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise; + + /** + * Shortcut method to perform PUT request. + * + * @param url Relative or absolute URL specifying the destination of the request + * @param data Request content + * @param config Optional configuration object + */ + put(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise; + + /** + * Runtime equivalent of the $httpProvider.defaults property. Allows configuration of default headers, withCredentials as well as request and response transformations. + */ + defaults: IRequestConfig; + + /** + * Array of config objects for currently pending requests. This is primarily meant to be used for debugging purposes. + */ + pendingRequests: any[]; + } + + /** + * Object describing the request to be made and how it should be processed. + * see http://docs.angularjs.org/api/ng/service/$http#usage + */ + interface IRequestShortcutConfig { + /** + * {Object.} + * Map of strings or objects which will be turned to ?key1=value1&key2=value2 after the url. If the value is not a string, it will be JSONified. + */ + params?: any; + + /** + * Map of strings or functions which return strings representing HTTP headers to send to the server. If the return value of a function is null, the header will not be sent. + */ + headers?: any; + + /** + * Name of HTTP header to populate with the XSRF token. + */ + xsrfHeaderName?: string; + + /** + * Name of cookie containing the XSRF token. + */ + xsrfCookieName?: string; + + /** + * {boolean|Cache} + * If true, a default $http cache will be used to cache the GET request, otherwise if a cache instance built with $cacheFactory, this cache will be used for caching. + */ + cache?: any; + + /** + * whether to to set the withCredentials flag on the XHR object. See [requests with credentials]https://developer.mozilla.org/en/http_access_control#section_5 for more information. + */ + withCredentials?: boolean; + + /** + * {string|Object} + * Data to be sent as the request message data. + */ + data?: any; + + /** + * {function(data, headersGetter)|Array.} + * Transform function or an array of such functions. The transform function takes the http request body and headers and returns its transformed (typically serialized) version. + */ + transformRequest?: any; + + /** + * {function(data, headersGetter)|Array.} + * Transform function or an array of such functions. The transform function takes the http response body and headers and returns its transformed (typically deserialized) version. + */ + transformResponse?: any; + + /** + * {number|Promise} + * Timeout in milliseconds, or promise that should abort the request when resolved. + */ + timeout?: any; + + /** + * See requestType. + */ + responseType?: string; + } + + /** + * Object describing the request to be made and how it should be processed. + * see http://docs.angularjs.org/api/ng/service/$http#usage + */ + interface IRequestConfig extends IRequestShortcutConfig { + /** + * HTTP method (e.g. 'GET', 'POST', etc) + */ + method: string; + /** + * Absolute or relative URL of the resource that is being requested. + */ + url: string; + } + + interface IHttpPromiseCallback { + (data: T, status: number, headers: (headerName: string) => string, config: IRequestConfig): void; + } + + interface IHttpPromiseCallbackArg { + data?: T; + status?: number; + headers?: (headerName: string) => string; + config?: IRequestConfig; + statusText?: string; + } + + interface IHttpPromise extends IPromise { + success(callback: IHttpPromiseCallback): IHttpPromise; + error(callback: IHttpPromiseCallback): IHttpPromise; + then(successCallback: (response: IHttpPromiseCallbackArg) => IPromise, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; + then(successCallback: (response: IHttpPromiseCallbackArg) => TResult, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; + } + + interface IHttpProvider extends IServiceProvider { + defaults: IRequestConfig; + interceptors: any[]; + responseInterceptors: any[]; + } + + /////////////////////////////////////////////////////////////////////////// + // HttpBackendService + // see http://docs.angularjs.org/api/ng.$httpBackend + // You should never need to use this service directly. + /////////////////////////////////////////////////////////////////////////// + interface IHttpBackendService { + // XXX Perhaps define callback signature in the future + (method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: boolean): void; + } + + /////////////////////////////////////////////////////////////////////////// + // InterpolateService + // see http://docs.angularjs.org/api/ng.$interpolate + // see http://docs.angularjs.org/api/ng.$interpolateProvider + /////////////////////////////////////////////////////////////////////////// + interface IInterpolateService { + (text: string, mustHaveExpression?: boolean): IInterpolationFunction; + endSymbol(): string; + startSymbol(): string; + } + + interface IInterpolationFunction { + (context: any): string; + } + + interface IInterpolateProvider extends IServiceProvider { + startSymbol(): string; + startSymbol(value: string): IInterpolateProvider; + endSymbol(): string; + endSymbol(value: string): IInterpolateProvider; + } + + /////////////////////////////////////////////////////////////////////////// + // TemplateCacheService + // see http://docs.angularjs.org/api/ng.$templateCache + /////////////////////////////////////////////////////////////////////////// + interface ITemplateCacheService extends ICacheObject {} + + /////////////////////////////////////////////////////////////////////////// + // SCEService + // see http://docs.angularjs.org/api/ng.$sce + /////////////////////////////////////////////////////////////////////////// + interface ISCEService { + getTrusted(type: string, mayBeTrusted: any): any; + getTrustedCss(value: any): any; + getTrustedHtml(value: any): any; + getTrustedJs(value: any): any; + getTrustedResourceUrl(value: any): any; + getTrustedUrl(value: any): any; + parse(type: string, expression: string): (context: any, locals: any) => any; + parseAsCss(expression: string): (context: any, locals: any) => any; + parseAsHtml(expression: string): (context: any, locals: any) => any; + parseAsJs(expression: string): (context: any, locals: any) => any; + parseAsResourceUrl(expression: string): (context: any, locals: any) => any; + parseAsUrl(expression: string): (context: any, locals: any) => any; + trustAs(type: string, value: any): any; + trustAsHtml(value: any): any; + trustAsJs(value: any): any; + trustAsResourceUrl(value: any): any; + trustAsUrl(value: any): any; + isEnabled(): boolean; + } + + /////////////////////////////////////////////////////////////////////////// + // SCEProvider + // see http://docs.angularjs.org/api/ng.$sceProvider + /////////////////////////////////////////////////////////////////////////// + interface ISCEProvider extends IServiceProvider { + enabled(value: boolean): void; + } + + /////////////////////////////////////////////////////////////////////////// + // SCEDelegateService + // see http://docs.angularjs.org/api/ng.$sceDelegate + /////////////////////////////////////////////////////////////////////////// + interface ISCEDelegateService { + getTrusted(type: string, mayBeTrusted: any): any; + trustAs(type: string, value: any): any; + valueOf(value: any): any; + } + + + /////////////////////////////////////////////////////////////////////////// + // SCEDelegateProvider + // see http://docs.angularjs.org/api/ng.$sceDelegateProvider + /////////////////////////////////////////////////////////////////////////// + interface ISCEDelegateProvider extends IServiceProvider { + resourceUrlBlacklist(blacklist: any[]): void; + resourceUrlWhitelist(whitelist: any[]): void; + } + + /////////////////////////////////////////////////////////////////////////// + // Directive + // see http://docs.angularjs.org/api/ng.$compileProvider#directive + // and http://docs.angularjs.org/guide/directive + /////////////////////////////////////////////////////////////////////////// + + interface IDirectiveFactory { + (...args: any[]): IDirective; + } + + interface IDirectiveLinkFn { + ( + scope: IScope, + instanceElement: IAugmentedJQuery, + instanceAttributes: IAttributes, + controller: any, + transclude: ITranscludeFunction + ): void; + } + + interface IDirectivePrePost { + pre?: IDirectiveLinkFn; + post?: IDirectiveLinkFn; + } + + interface IDirectiveCompileFn { + ( + templateElement: IAugmentedJQuery, + templateAttributes: IAttributes, + transclude: ITranscludeFunction + ): IDirectivePrePost; + } + + interface IDirective { + compile?: IDirectiveCompileFn; + controller?: any; + controllerAs?: string; + link?: IDirectiveLinkFn; + name?: string; + priority?: number; + replace?: boolean; + require?: any; + restrict?: string; + scope?: any; + template?: any; + templateUrl?: any; + terminal?: boolean; + transclude?: any; + } + + /////////////////////////////////////////////////////////////////////////// + // angular.element + // when calling angular.element, angular returns a jQuery object, + // augmented with additional methods like e.g. scope. + // see: http://docs.angularjs.org/api/angular.element + /////////////////////////////////////////////////////////////////////////// + interface IAugmentedJQueryStatic extends JQueryStatic { + (selector: string, context?: any): IAugmentedJQuery; + (element: Element): IAugmentedJQuery; + (object: {}): IAugmentedJQuery; + (elementArray: Element[]): IAugmentedJQuery; + (object: JQuery): IAugmentedJQuery; + (func: Function): IAugmentedJQuery; + (array: any[]): IAugmentedJQuery; + (): IAugmentedJQuery; + } + + interface IAugmentedJQuery extends JQuery { + // TODO: events, how to define? + //$destroy + + find(selector: string): IAugmentedJQuery; + find(element: any): IAugmentedJQuery; + find(obj: JQuery): IAugmentedJQuery; + + controller(name: string): any; + injector(): any; + scope(): IScope; + isolateScope(): IScope; + + inheritedData(key: string, value: any): JQuery; + inheritedData(obj: { [key: string]: any; }): JQuery; + inheritedData(key?: string): any; + } + + /////////////////////////////////////////////////////////////////////// + // AnimateService + // see http://docs.angularjs.org/api/ng.$animate + /////////////////////////////////////////////////////////////////////// + interface IAnimateService { + addClass(element: JQuery, className: string, done?: Function): void; + enter(element: JQuery, parent: JQuery, after: JQuery, done?: Function): void; + leave(element: JQuery, done?: Function): void; + move(element: JQuery, parent: JQuery, after: JQuery, done?: Function): void; + removeClass(element: JQuery, className: string, done?: Function): void; + } + + /////////////////////////////////////////////////////////////////////////// + // AUTO module (angular.js) + /////////////////////////////////////////////////////////////////////////// + export module auto { + + /////////////////////////////////////////////////////////////////////// + // InjectorService + // see http://docs.angularjs.org/api/AUTO.$injector + /////////////////////////////////////////////////////////////////////// + interface IInjectorService { + annotate(fn: Function): string[]; + annotate(inlineAnnotatedFunction: any[]): string[]; + get(name: string): any; + has(name: string): boolean; + instantiate(typeConstructor: Function, locals?: any): any; + invoke(inlineAnnotatedFunction: any[]): any; + invoke(func: Function, context?: any, locals?: any): any; + } + + /////////////////////////////////////////////////////////////////////// + // ProvideService + // see http://docs.angularjs.org/api/AUTO.$provide + /////////////////////////////////////////////////////////////////////// + interface IProvideService { + // Documentation says it returns the registered instance, but actual + // implementation does not return anything. + // constant(name: string, value: any): any; + /** + * Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator. + * + * @param name The name of the constant. + * @param value The constant value. + */ + constant(name: string, value: any): void; + + /** + * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. + * + * @param name The name of the service to decorate. + * @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: + * + * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. + */ + decorator(name: string, decorator: Function): void; + /** + * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. + * + * @param name The name of the service to decorate. + * @param inlineAnnotatedFunction This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: + * + * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. + */ + decorator(name: string, inlineAnnotatedFunction: any[]): void; + factory(name: string, serviceFactoryFunction: Function): ng.IServiceProvider; + factory(name: string, inlineAnnotatedFunction: any[]): ng.IServiceProvider; + provider(name: string, provider: ng.IServiceProvider): ng.IServiceProvider; + provider(name: string, serviceProviderConstructor: Function): ng.IServiceProvider; + service(name: string, constructor: Function): ng.IServiceProvider; + value(name: string, value: any): ng.IServiceProvider; + } + + } +} diff --git a/angularjs/legacy/angular-scenario-1.0.d.ts.tscparams b/angularjs/legacy/angular-scenario-1.0.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/angularjs/legacy/angular-scenario-1.0.d.ts.tscparams +++ b/angularjs/legacy/angular-scenario-1.0.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/asciify/asciify.ts.tscparams b/asciify/asciify.ts.tscparams index 64dbb84a5..d68b297cb 100644 --- a/asciify/asciify.ts.tscparams +++ b/asciify/asciify.ts.tscparams @@ -1 +1 @@ -"--noImplicitAny --module commonjs" \ No newline at end of file +--noImplicitAny --module commonjs diff --git a/async/async-tests.ts b/async/async-tests.ts index 9b0c8e7ee..9a563276a 100644 --- a/async/async-tests.ts +++ b/async/async-tests.ts @@ -26,10 +26,11 @@ async.map(data, asyncProcess, function (err, results) { var openFiles = ['file1', 'file2']; var saveFile = function () { } -async.forEach(openFiles, saveFile, function (err) { }); +async.each(openFiles, saveFile, function (err) { }); +async.eachSeries(openFiles, saveFile, function (err) { }); var documents, requestApi; -async.forEachLimit(documents, 20, requestApi, function (err) { }); +async.eachLimit(documents, 20, requestApi, function (err) { }); async.map(['file1', 'file2', 'file3'], fs.stat, function (err, results) { }); diff --git a/async/async-tests.ts.tscparams b/async/async-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/async/async-tests.ts.tscparams +++ b/async/async-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/async/async.d.ts b/async/async.d.ts index d1d592629..994ed1799 100644 --- a/async/async.d.ts +++ b/async/async.d.ts @@ -34,9 +34,9 @@ interface AsyncQueue { interface Async { // Collections - forEach(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): void; - forEachSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): void; - forEachLimit(arr: T[], limit: number, iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): void; + each(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): void; + eachSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): void; + eachLimit(arr: T[], limit: number, iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): void; map(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; mapSeries(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; filter(arr: T[], iterator: AsyncIterator, callback: AsyncMultipleResultsCallback): any; diff --git a/atom/atom-tests.ts.tscparams b/atom/atom-tests.ts.tscparams index 5f84b9777..6331805a5 100644 --- a/atom/atom-tests.ts.tscparams +++ b/atom/atom-tests.ts.tscparams @@ -1 +1 @@ ---noImplicitAny --module commonjs --target es5 +--noImplicitAny --module commonjs --target es5 diff --git a/atom/atom.d.ts b/atom/atom.d.ts index 00f55ef02..96b7c849d 100644 --- a/atom/atom.d.ts +++ b/atom/atom.d.ts @@ -497,6 +497,35 @@ declare module AtomCore { screenRangeChanged():any; } + interface IDecorationParams { + id?: number; + class: string; + type: any /* string or string[] */; + } + + interface IDecorationStatic { + isType(decorationParams:IDecorationParams, type:any /* string or string[] */):boolean; + new (marker:IDisplayBufferMarker, displayBuffer:IDisplayBuffer, params: IDecorationParams): IDecoration; + } + + interface IDecoration extends Emissary.IEmitter { + marker: IDisplayBufferMarker; + displayBuffer: IDisplayBuffer; + params: IDecorationParams + id: number; + flashQueue: any[]; + isDestroyed: boolean; + + destroy():void; + update(newParams:IDecorationParams):void; + getMarker():IDisplayBufferMarker; + getParams():IDecorationParams; + isType(type:string):boolean; + matchesPattern(decorationPattern:{[key:string]:IDecorationParams;}):boolean; + flash(klass:string, duration?:number):void; + consumeNextFlash():any; + } + interface IEditor { // Serializable.includeInto(Editor); // Delegator.includeInto(Editor); @@ -509,6 +538,8 @@ declare module AtomCore { cursors:ICursor[]; selections: ISelection[]; suppressSelectionMerging:boolean; + updateBatchDepth: number; + selectionFlashDuration: number; softTabs: boolean; displayBuffer: IDisplayBuffer; @@ -522,6 +553,8 @@ declare module AtomCore { subscriptionsByObject: any; /* WeakMap */ subscriptions: Emissary.ISubscription[]; + mini: any; + serializeParams():{id:number; softTabs:boolean; scrollTop:number; scrollLeft:number; displayBuffer:any;}; deserializeParams(params:any):any; subscribeToBuffer():void; @@ -532,10 +565,7 @@ declare module AtomCore { getTitle():string; getLongTitle():string; setVisible(visible:boolean):void; - setScrollTop(scrollTop:any):void; - getScrollTop():number; - setScrollLeft(scrollLeft:any):void; - getScrollLeft():number; + setMini(mini:any):void; setEditorWidthInChars(editorWidthInChars:any):void; getSoftWrapColumn():number; getSoftTabs():boolean; @@ -545,6 +575,7 @@ declare module AtomCore { getTabText():string; getTabLength():number; setTabLength(tabLength:any):void; + usesSoftTabs():boolean; clipBufferPosition(bufferPosition:any):void; clipBufferRange(range:any):void; indentationForBufferRow(bufferRow:any):void; @@ -553,6 +584,7 @@ declare module AtomCore { buildIndentString(number:any):string; save():void; saveAs(filePath:any):void; + copyPathToClipboard():void; getPath():string; getText():string; setText(text:any):void; @@ -572,6 +604,7 @@ declare module AtomCore { scanInBufferRange():any; backwardsScanInBufferRange():any; isModified():boolean; + isEmpty():boolean; shouldPromptToSave():boolean; screenPositionForBufferPosition(bufferPosition:any, options?:any):TextBuffer.IPoint; bufferPositionForScreenPosition(screenPosition:any, options?:any):TextBuffer.IPoint; @@ -589,15 +622,19 @@ declare module AtomCore { bufferRangeForScopeAtCursor(selector:string):any; tokenForBufferPosition(bufferPosition:any):IToken; getCursorScopes():string[]; + logCursorScope():void; insertText(text:string, options?:any):TextBuffer.IRange[]; insertNewline():TextBuffer.IRange[]; insertNewlineBelow():TextBuffer.IRange[]; insertNewlineAbove():any; indent(options?:any):any; backspace():any[]; - backspaceToBeginningOfWord():any[]; - backspaceToBeginningOfLine():any[]; + // deprecated backspaceToBeginningOfWord():any[]; + // deprecated backspaceToBeginningOfLine():any[]; + deleteToBeginningOfWord():any[]; + deleteToBeginningOfLine():any[]; delete():any[]; + deleteToEndOfLine():any[]; deleteToEndOfWord():any[]; deleteLine():TextBuffer.IRange[]; indentSelectedRows():TextBuffer.IRange[][]; @@ -620,6 +657,7 @@ declare module AtomCore { foldBufferRow(bufferRow:any):any; unfoldBufferRow(bufferRow:any):any; isFoldableAtBufferRow(bufferRow:any):boolean; + isFoldableAtScreenRow(screenRow:any):boolean; createFold(startRow:any, endRow:any):IFold; destroyFoldWithId(id:any):any; destroyFoldsIntersectingBufferRange(bufferRange:any):any; @@ -633,9 +671,12 @@ declare module AtomCore { moveLineUp():ISelection[]; moveLineDown():ISelection[]; duplicateLines():any[][]; - duplicateLine():any[][]; + // duprecated duplicateLine():any[][]; mutateSelectedText(fn:(selection:ISelection)=>any):any; replaceSelectedText(options:any, fn:(selection:string)=>any):any; + decorationsForScreenRowRange(startScreenRow:any, endScreenRow:any):{[id:number]: IDecoration[]}; + decorateMarker(marker:IDisplayBufferMarker, decorationParams: {type:string; class: string;}):IDecoration; + decorationForId(id:number):IDecoration; getMarker(id:number):IDisplayBufferMarker; getMarkers():IDisplayBufferMarker[]; findMarkers(...args:any[]):IDisplayBufferMarker[]; @@ -659,6 +700,7 @@ declare module AtomCore { removeSelection(selection:ISelection):any; clearSelections():boolean; consolidateSelections():boolean; + selectionScreenRangeChanged(selection:any):void; getSelections():ISelection[]; getSelection(index?:number):ISelection; getLastSelection():ISelection; @@ -694,7 +736,16 @@ declare module AtomCore { moveCursorToBeginningOfNextWord():void; moveCursorToPreviousWordBoundary():void; moveCursorToNextWordBoundary():void; + moveCursorToBeginningOfNextParagraph():void; + moveCursorToBeginningOfPreviousParagraph():void; + scrollToCursorPosition(options:any):any; + pageUp():void; + pageDown():void; + selectPageUp():void; + selectPageDown():void; + getRowsPerPage():number; moveCursors(fn:(cursor:ICursor)=>any):any; + cursorMoved(event:any):void; selectToScreenPosition(position:TextBuffer.IPoint):any; selectRight():ISelection[]; selectLeft():ISelection[]; @@ -720,6 +771,8 @@ declare module AtomCore { selectToEndOfWord():ISelection[]; selectToBeginningOfNextWord():ISelection[]; selectWord():ISelection[]; + selectToBeginningOfNextParagraph():ISelection[]; + selectToBeginningOfPreviousParagraph():ISelection[]; selectMarker(marker:any):any; mergeCursors():number[]; expandSelectionsForward():any; @@ -731,16 +784,63 @@ declare module AtomCore { setGrammar(grammer:IGrammar):void; reloadGrammar():any; shouldAutoIndent():boolean; + shouldShowInvisibles():boolean; + updateInvisibles():void; transact(fn:Function):any; beginTransaction():ITransaction; commitTransaction():any; abortTransaction():any[]; inspect():string; logScreenLines(start:number, end:number):any[]; + handleTokenization():void; handleGrammarChange():void; handleMarkerCreated(marker:any):any; getSelectionMarkerAttributes():{type: string; editorId: number; invalidate: string; }; - // joinLine():any; // deprecated + getVerticalScrollMargin():number; + setVerticalScrollMargin(verticalScrollMargin:number):void; + getHorizontalScrollMargin():number; + setHorizontalScrollMargin(horizontalScrollMargin:number):void; + getLineHeightInPixels():number; + setLineHeightInPixels(lineHeightInPixels:number):void; + batchCharacterMeasurement(fn:Function):void; + getScopedCharWidth(scopeNames:any, char:any):any; + setScopedCharWidth(scopeNames:any, char:any, width:any):any; + getScopedCharWidths(scopeNames:any):any; + clearScopedCharWidths():any; + getDefaultCharWidth():number; + setDefaultCharWidth(defaultCharWidth:number):void; + setHeight(height:number):void; + getHeight():number; + getClientHeight():number; + setWidth(width:number):void; + getWidth():number; + getScrollTop():number; + setScrollTop(scrollTop:number):void; + getScrollBottom():number; + setScrollBottom(scrollBottom:number):void; + getScrollLeft():number; + setScrollLeft(scrollLeft:number):void; + getScrollRight():number; + setScrollRight(scrollRight:number):void; + getScrollHeight():number; + getScrollWidth():number; + getVisibleRowRange():number; + intersectsVisibleRowRange(startRow:any, endRow:any):any; + selectionIntersectsVisibleRowRange(selection:any):any; + pixelPositionForScreenPosition(screenPosition:any):any; + pixelPositionForBufferPosition(bufferPosition:any):any; + screenPositionForPixelPosition(pixelPosition:any):any; + pixelRectForScreenRange(screenRange:any):any; + scrollToScreenRange(screenRange:any, options:any):any; + scrollToScreenPosition(screenPosition:any, options:any):any; + scrollToBufferPosition(bufferPosition:any, options:any):any; + horizontallyScrollable():any; + verticallyScrollable():any; + getHorizontalScrollbarHeight():any; + setHorizontalScrollbarHeight(height:any):any; + getVerticalScrollbarWidth():any; + setVerticalScrollbarWidth(width:any):any; + // deprecated joinLine():any; } interface IGrammar { diff --git a/azure-mobile-services-client/AzureMobileServicesClient-tests.ts.tscparams b/azure-mobile-services-client/AzureMobileServicesClient-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/azure-mobile-services-client/AzureMobileServicesClient-tests.ts.tscparams +++ b/azure-mobile-services-client/AzureMobileServicesClient-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/backbone-relational/backbone-relational-tests.ts.tscparams b/backbone-relational/backbone-relational-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/backbone-relational/backbone-relational-tests.ts.tscparams +++ b/backbone-relational/backbone-relational-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/backbone-relational/backbone-relational.d.ts.tscparams b/backbone-relational/backbone-relational.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/backbone-relational/backbone-relational.d.ts.tscparams +++ b/backbone-relational/backbone-relational.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/backbone/backbone.d.ts b/backbone/backbone.d.ts index 3aeeb7d90..270b949aa 100644 --- a/backbone/backbone.d.ts +++ b/backbone/backbone.d.ts @@ -215,12 +215,10 @@ declare module Backbone { any(iterator: (element: TModel, index: number) => boolean, context?: any): boolean; collect(iterator: (element: TModel, index: number, context?: any) => any[], context?: any): any[]; chain(): any; - compact(): TModel[]; contains(value: any): boolean; countBy(iterator: (element: TModel, index: number) => any): _.Dictionary; countBy(attribute: string): _.Dictionary; detect(iterator: (item: any) => boolean, context?: any): any; // ??? - difference(...model: TModel[]): TModel[]; drop(): TModel; drop(n: number): TModel[]; each(iterator: (element: TModel, index: number, list?: any) => void, context?: any): any; @@ -229,7 +227,6 @@ declare module Backbone { find(iterator: (element: TModel, index: number) => boolean, context?: any): TModel; first(): TModel; first(n: number): TModel[]; - flatten(shallow?: boolean): TModel[]; foldl(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any; forEach(iterator: (element: TModel, index: number, list?: any) => void, context?: any): any; groupBy(iterator: (element: TModel, index: number) => string, context?: any): _.Dictionary; @@ -239,7 +236,6 @@ declare module Backbone { initial(): TModel; initial(n: number): TModel[]; inject(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any; - intersection(...model: TModel[]): TModel[]; isEmpty(object: any): boolean; invoke(methodName: string, arguments?: any[]): any; last(): TModel; @@ -248,7 +244,6 @@ declare module Backbone { map(iterator: (element: TModel, index: number, context?: any) => any[], context?: any): any[]; max(iterator?: (element: TModel, index: number) => any, context?: any): TModel; min(iterator?: (element: TModel, index: number) => any, context?: any): TModel; - object(...values: any[]): any[]; reduce(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any; select(iterator: any, context?: any): any[]; size(): number; @@ -257,8 +252,6 @@ declare module Backbone { sortBy(iterator: (element: TModel, index: number) => number, context?: any): TModel[]; sortBy(attribute: string, context?: any): TModel[]; sortedIndex(element: TModel, iterator?: (element: TModel, index: number) => number): number; - range(stop: number, step?: number): any; - range(start: number, stop: number, step?: number): any; reduceRight(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any[]; reject(iterator: (element: TModel, index: number) => boolean, context?: any): TModel[]; rest(): TModel; @@ -266,10 +259,7 @@ declare module Backbone { tail(): TModel; tail(n: number): TModel[]; toArray(): any[]; - union(...model: TModel[]): TModel[]; - uniq(isSorted?: boolean, iterator?: (element: TModel, index: number) => boolean): TModel[]; without(...values: any[]): TModel[]; - zip(...model: TModel[]): TModel[]; } class Router extends Events { @@ -349,7 +339,6 @@ declare module Backbone { model: TModel; collection: Collection; //template: (json, options?) => string; - make(tagName: string, attrs?: any, opts?: any): View; setElement(element: HTMLElement, delegate?: boolean): View; setElement(element: JQuery, delegate?: boolean): View; id: string; diff --git a/backgrid/backgrid-tests.ts.tscparams b/backgrid/backgrid-tests.ts.tscparams index e85b4ac55..d45eb7650 100644 --- a/backgrid/backgrid-tests.ts.tscparams +++ b/backgrid/backgrid-tests.ts.tscparams @@ -1 +1 @@ ---target ES5 \ No newline at end of file +--target ES5 diff --git a/backgrid/backgrid.d.ts.tscparams b/backgrid/backgrid.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/backgrid/backgrid.d.ts.tscparams +++ b/backgrid/backgrid.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/bigint/bigint.d.ts b/bigint/bigint.d.ts index 61543b1c6..b70f20fa4 100644 --- a/bigint/bigint.d.ts +++ b/bigint/bigint.d.ts @@ -13,233 +13,359 @@ declare module BigInt { export function setRandom(random: IRandom): void; - // bigInt add(x,y) - // return (x+y) for bigInts x and y. + /** + * bigInt add(x,y) + * return (x+y) for bigInts x and y. + */ export function add(x: BigInt, y: BigInt): BigInt; - // bigInt addInt(x,n) - // return (x+n) where x is a bigInt and n is an integer. + /** + * bigInt addInt(x,n) + * return (x+n) where x is a bigInt and n is an integer. + */ export function addInt(x: BigInt, n: number): BigInt; - // string bigInt2str(x,base) - // return a string form of bigInt x in a given base, with 2 <= base <= 95 - export function bigInt2str(x: BigInt, base: number): string; - export function bigInt2str(x: BigInt, base: string): string; + interface bigInt2str_T { + /** + * string bigInt2str(x,base) + * return a string form of bigInt x in a given base, with 2 <= base <= 95 + */ + (x: BigInt, base: T): string; + } - // int bitSize(x) - // return how many bits long the bigInt x is, not counting leading zeros + interface bigInt2strSignature extends bigInt2str_T, bigInt2str_T{ + } + + export var bigInt2str: bigInt2strSignature; + + /** + * int bitSize(x) + * return how many bits long the bigInt x is, not counting leading zeros + */ export function bitSize(x: BigInt): number; - // bigInt dup(x) - // return a copy of bigInt x + /** + * bigInt dup(x) + * return a copy of bigInt x + */ export function dup(x: BigInt): BigInt; - // boolean equals(x,y) - // is the bigInt x equal to the bigint y? + /** + * boolean equals(x,y) + * is the bigInt x equal to the bigint y? + */ export function equals(x: BigInt, y: BigInt): boolean; - // boolean equalsInt(x,y) - // is bigint x equal to integer y? + /** + * boolean equalsInt(x,y) + * is bigint x equal to integer y? + */ export function equalsInt(x: BigInt, y: number): boolean; - // bigInt expand(x,n) - // return a copy of x with at least n elements, adding leading zeros if needed + /** + * bigInt expand(x,n) + * return a copy of x with at least n elements, adding leading zeros if needed + */ export function expand(value: BigInt, n: number): BigInt; - // Array findPrimes(n) - // return array of all primes less than integer n + /** + * Array findPrimes(n) + * return array of all primes less than integer n + */ export function findPrimes(n: number): number[]; - // bigInt GCD(x,y) - // return greatest common divisor of bigInts x and y (each with same number of elements). + /** + * bigInt GCD(x,y) + * return greatest common divisor of bigInts x and y (each with same number of elements). + */ export function GCD(x: BigInt, y: BigInt): BigInt; - // boolean greater(x,y) - // is x>y? (x and y are nonnegative bigInts) + /** + * boolean greater(x,y) + * is x>y? (x and y are nonnegative bigInts) + */ export function greater(x: BigInt, y: BigInt): boolean; - // boolean greaterShift(x,y,shift) - // is (x <<(shift*bpe)) > y? + /** + * boolean greaterShift(x,y,shift) + * is (x <<(shift*bpe)) > y? + */ export function greaterShift(x: BigInt, y: BigInt, shift: number): boolean; - // bigInt int2bigInt(t,n,m) - // return a bigInt equal to integer t, with at least n bits and m array elements + /** + * bigInt int2bigInt(t,n,m) + * return a bigInt equal to integer t, with at least n bits and m array elements + */ export function int2bigInt(t: number, n?: number, m?: number): BigInt; - // bigInt inverseMod(x,n) - // return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null + /** + * bigInt inverseMod(x,n) + * return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null + */ export function inverseMod(x: BigInt, n: BigInt): BigInt; - // int inverseModInt(x,n) - // return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse + /** + * int inverseModInt(x,n) + * return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse + */ export function inverseModInt(x: number, n: number): BigInt; - // boolean isZero(x) - // is the bigInt x equal to zero? + /** + * boolean isZero(x) + * is the bigInt x equal to zero? + */ export function isZero(x: BigInt): boolean; - // boolean millerRabin(x,b) - // does one round of Miller-Rabin base integer b say that bigInt x is possibly prime? (b is bigInt, 1=1). If s=1, then the most significant of those n bits is set to 1. + /** + * bigInt randBigInt(n,s) + * return an n-bit random BigInt (n>=1). If s=1, then the most significant of those n bits is set to 1. + */ export function randBigInt(n: number, s: number): BigInt; - // bigInt randTruePrime(k) - // return a new, random, k-bit, true prime bigInt using Maurer's algorithm. + /** + * bigInt randTruePrime(k) + * return a new, random, k-bit, true prime bigInt using Maurer's algorithm. + */ export function randTruePrime(k: number): BigInt; - // bigInt randProbPrime(k) - // return a new, random, k-bit, probable prime bigInt (probability it's composite less than 2^-80). + /** + * bigInt randProbPrime(k) + * return a new, random, k-bit, probable prime bigInt (probability it's composite less than 2^-80). + */ export function randProbPrime(k: number): BigInt; - // bigInt str2bigInt(s,b,n,m) - // return a bigInt for number represented in string s in base b with at least n bits and m array elements - export function str2bigInt(s: string, b: number, n?: number, m?: number): BigInt; - export function str2bigInt(s: string, b: string, n?: number, m?: number): BigInt; + interface str2bigInt_T { + /** + * bigInt str2bigInt(s,b,n,m) + * return a bigInt for number represented in string s in base b with at least n bits and m array elements + */ + (s: string, b: T, n?: number, m?: number): BigInt; + } - // bigInt sub(x,y) - // return (x-y) for bigInts x and y. Negative answers will be 2s complement + interface str2bigIntSignature extends str2bigInt_T, str2bigInt_T { + } + + export var str2bigInt: str2bigIntSignature; + + /** + * bigInt sub(x,y) + * return (x-y) for bigInts x and y. Negative answers will be 2s complement + */ export function sub(x: BigInt, y: BigInt): BigInt; - // bigInt trim(x,k) - // return a copy of x with exactly k leading zero elements + /** + * bigInt trim(x,k) + * return a copy of x with exactly k leading zero elements + */ export function trim(x: BigInt, k: number): BigInt; - // void addInt_(x,n) - // do x=x+n where x is a bigInt and n is an integer + /** + * void addInt_(x,n) + * do x=x+n where x is a bigInt and n is an integer + */ export function addInt_(x: BigInt, n: number): void; - // void add_(x,y) - // do x=x+y for bigInts x and y + /** + * void add_(x,y) + * do x=x+y for bigInts x and y + */ export function add_(x: BigInt, y: BigInt): void; - // void copy_(x,y) - // do x=y on bigInts x and y + /** + * void copy_(x,y) + * do x=y on bigInts x and y + */ export function copy_(x: BigInt, y: BigInt): void; - // void copyInt_(x,n) - // do x=n on bigInt x and integer n + /** + * void copyInt_(x,n) + * do x=n on bigInt x and integer n + */ export function copyInt_(x: BigInt, n: number): number; - // void GCD_(x,y) - // set x to the greatest common divisor of bigInts x and y, (y is destroyed). (This never overflows its array). + /** + * void GCD_(x,y) + * set x to the greatest common divisor of bigInts x and y, (y is destroyed). (This never overflows its array). + */ export function GCD_(x: BigInt, y: BigInt): void; - // boolean inverseMod_(x,n) - // do x=x**(-1) mod n, for bigInts x and n. Returns 1 (0) if inverse does (doesn't) exist + /** + * boolean inverseMod_(x,n) + * do x=x**(-1) mod n, for bigInts x and n. Returns 1 (0) if inverse does (doesn't) exist + */ export function inverseMod_(x: BigInt, n: BigInt): boolean; - // void mod_(x,n) - // do x=x mod n for bigInts x and n. (This never overflows its array). + /** + * void mod_(x,n) + * do x=x mod n for bigInts x and n. (This never overflows its array). + */ export function mod_(x: BigInt, n: BigInt): void; - // void mult_(x,y) - // do x=x*y for bigInts x and y. + /** + * void mult_(x,y) + * do x=x*y for bigInts x and y. + */ export function mult_(x: BigInt, y: BigInt): void; - // void multMod_(x,y,n) - // do x=x*y mod n for bigInts x,y,n. + /** + * void multMod_(x,y,n) + * do x=x*y mod n for bigInts x,y,n. + */ export function multMod_(x: BigInt, y: BigInt, n: BigInt): void; - // void powMod_(x,y,n) - // do x=x**y mod n, where x,y,n are bigInts (n is odd) and ** is exponentiation. 0**0=1. + /** + * void powMod_(x,y,n) + * do x=x**y mod n, where x,y,n are bigInts (n is odd) and ** is exponentiation. 0**0=1. + */ export function powMod_(x: BigInt, y: BigInt, n: BigInt): void; - // void randBigInt_(b,n,s) - // do b = an n-bit random BigInt. if s=1, then nth bit (most significant bit) is set to 1. n>=1. + /** + * void randBigInt_(b,n,s) + * do b = an n-bit random BigInt. if s=1, then nth bit (most significant bit) is set to 1. n>=1. + */ export function randBigInt_(b: BigInt, n: number, s: number): void; - // void randTruePrime_(ans,k) - // do ans = a random k-bit true random prime (not just probable prime) with 1 in the msb. + /** + * void randTruePrime_(ans,k) + * do ans = a random k-bit true random prime (not just probable prime) with 1 in the msb. + */ export function randTruePrime_(ans: BigInt, k: number): void; - // void sub_(x,y) - // do x=x-y for bigInts x and y. Negative answers will be 2s complement. + /** + * void sub_(x,y) + * do x=x-y for bigInts x and y. Negative answers will be 2s complement. + */ export function sub_(x: BigInt, y: BigInt): void; - // void addShift_(x,y,ys) - // do x=x+(y<<(ys*bpe)) + /** + * void addShift_(x,y,ys) + * do x=x+(y<<(ys*bpe)) + */ export function addShift_(x: BigInt, y: BigInt, ys: number): void; - // void carry_(x) - // do carries and borrows so each element of the bigInt x fits in bpe bits. + /** + * void carry_(x) + * do carries and borrows so each element of the bigInt x fits in bpe bits. + */ export function carry_(x: BigInt): void; - // void divide_(x,y,q,r) - // divide x by y giving quotient q and remainder r + /** + * void divide_(x,y,q,r) + * divide x by y giving quotient q and remainder r + */ export function divide_(x: BigInt, y: BigInt, q: BigInt, r: BigInt): void; - // int divInt_(x,n) - // do x=floor(x/n) for bigInt x and integer n, and return the remainder. (This never overflows its array). + /** + * int divInt_(x,n) + * do x=floor(x/n) for bigInt x and integer n, and return the remainder. (This never overflows its array). + */ export function divInt_(x: BigInt, n: number): number; - // void eGCD_(x,y,d,a,b) - // sets a,b,d to positive bigInts such that d = GCD_(x,y) = a*x-b*y + /** + * void eGCD_(x,y,d,a,b) + * sets a,b,d to positive bigInts such that d = GCD_(x,y) = a*x-b*y + */ export function eGCD_(x: BigInt, y: BigInt, d: BigInt, a: BigInt, b: BigInt): void; - // void halve_(x) - // do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement. (This never overflows its array). + /** + * void halve_(x) + * do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement. (This never overflows its array). + */ export function halve_(x: BigInt): void; - // void leftShift_(x,n) - // left shift bigInt x by n bits. n +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// +/// +/// +/// +declare module Validators { + class LettersOnlyValidator implements Validation.IStringValidator { + public isAcceptable(s: string): boolean; + public tagName: string; + } + class ZipCodeValidator implements Validation.IStringValidator { + public isAcceptable(s: string): boolean; + public tagName: string; + } + class EmailValidator implements Validation.IStringValidator { + public isAcceptable(s: string): boolean; + public tagName: string; + } + class UrlValidator implements Validation.IStringValidator { + public isAcceptable(s: string): boolean; + public tagName: string; + } + class RequiredValidator implements Validation.IStringValidator { + public isAcceptable(s: string): boolean; + public tagName: string; + } + class DateValidator implements Validation.IStringValidator { + public isAcceptable(s: string): boolean; + public tagName: string; + } + class DateISOValidator implements Validation.IStringValidator { + public isAcceptable(s: string): boolean; + public tagName: string; + } + class NumberValidator implements Validation.IStringValidator { + public isAcceptable(s: string): boolean; + public tagName: string; + } + class DigitValidator implements Validation.IStringValidator { + public isAcceptable(s: string): boolean; + public tagName: string; + } + class SignedDigitValidator implements Validation.IStringValidator { + public isAcceptable(s: string): boolean; + public tagName: string; + } + class MinLengthValidator implements Validation.IStringValidator { + public MinLength: number; + constructor(MinLength?: number); + public isAcceptable(s: string): boolean; + public tagName: string; + } + class MaxLengthValidator implements Validation.IStringValidator { + public MaxLength: number; + constructor(MaxLength?: number); + public isAcceptable(s: string): boolean; + public tagName: string; + } + class RangeLengthValidator implements Validation.IStringValidator { + public RangeLength: number[]; + constructor(RangeLength?: number[]); + public isAcceptable(s: string): boolean; + public MinLength : number; + public MaxLength : number; + public tagName: string; + } + class MinValidator implements Validation.IPropertyValidator { + public Min: number; + constructor(Min?: number); + public isAcceptable(s: any): boolean; + public tagName: string; + } + class MaxValidator implements Validation.IPropertyValidator { + public Max: number; + constructor(Max?: number); + public isAcceptable(s: any): boolean; + public tagName: string; + } + class RangeValidator implements Validation.IPropertyValidator { + public Range: number[]; + constructor(Range?: number[]); + public isAcceptable(s: any): boolean; + public Min : number; + public Max : number; + public tagName: string; + } + class StepValidator implements Validation.IPropertyValidator { + public Step: string; + constructor(Step?: string); + public isAcceptable(s: any): boolean; + public tagName: string; + } + class PatternValidator implements Validation.IStringValidator { + public Pattern: string; + constructor(Pattern?: string); + public isAcceptable(s: string): boolean; + public tagName: string; + } + class ContainsValidator implements Validation.IAsyncPropertyValidator { + public Options: Q.Promise; + constructor(Options: Q.Promise); + public isAcceptable(s: string): Q.Promise; + public isAsync: boolean; + public tagName: string; + } +} +declare module "node-validators" {export = Validators;} diff --git a/business-rules-engine/Utils.d.ts b/business-rules-engine/Utils.d.ts new file mode 100644 index 000000000..bea120c63 --- /dev/null +++ b/business-rules-engine/Utils.d.ts @@ -0,0 +1,15 @@ +// Type definitions for business-rules-engine - v1.0.20 +// Project: https://github.com/rsamec/form +// Definitions by: Roman Samec +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +declare module Utils { + class StringFce { + static format(s: string, args: any): string; + } + class NumberFce { + static GetNegDigits(value: string): number; + } +} +declare module "node-utils" {export = Utils;} diff --git a/business-rules-engine/Validation.d.ts b/business-rules-engine/Validation.d.ts new file mode 100644 index 000000000..dfd6e786f --- /dev/null +++ b/business-rules-engine/Validation.d.ts @@ -0,0 +1,241 @@ +// Type definitions for business-rules-engine - v1.0.20 +// Project: https://github.com/rsamec/form +// Definitions by: Roman Samec +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// +declare module Validation { + interface IErrorCustomMessage { + (config: any, args: any): string; + } + interface IPropertyValidator { + isAcceptable(s: any): boolean; + customMessage?: IErrorCustomMessage; + tagName?: string; + } + interface IStringValidator extends IPropertyValidator { + isAcceptable(s: string): boolean; + } + interface IAsyncPropertyValidator { + isAcceptable(s: any): Q.Promise; + customMessage?: IErrorCustomMessage; + isAsync: boolean; + tagName?: string; + } + interface IAsyncStringPropertyValidator extends IAsyncPropertyValidator { + isAcceptable(s: string): Q.Promise; + } + enum CompareOperator { + LessThan = 0, + LessThanEqual = 1, + Equal = 2, + NotEqual = 3, + GreaterThanEqual = 4, + GreaterThan = 5, + } + interface IError { + HasError: boolean; + ErrorMessage: string; + TranslateArgs?: IErrorTranslateArgs; + } + interface IErrorTranslateArgs { + TranslateId: string; + MessageArgs: any; + CustomMessage?: IErrorCustomMessage; + } + interface IOptional { + (): boolean; + } + interface IValidationFailure extends IError { + IsAsync: boolean; + Error: IError; + } + interface IValidationResult { + Name: string; + Add(validationResult: IValidationResult): void; + Remove(index: number): void; + Children: IValidationResult[]; + HasErrors: boolean; + HasErrorsDirty: boolean; + ErrorMessage: string; + ErrorCount: number; + Optional?: IOptional; + TranslateArgs?: IErrorTranslateArgs[]; + } + interface IValidate { + (args: IError): void; + } + interface IAsyncValidate { + (args: IError): Q.Promise; + } + interface IValidatorFce { + Name: string; + ValidationFce?: IValidate; + AsyncValidationFce?: IAsyncValidate; + } + interface IValidator { + Validate(context: any): IValidationFailure; + ValidateAsync(context: any): Q.Promise; + Error: IError; + } + interface IAbstractValidator { + RuleFor(prop: string, validator: IPropertyValidator): any; + ValidationFor(prop: string, validatorFce: IValidatorFce): any; + Validation(validatorFce: IValidatorFce): any; + ValidatorFor(prop: string, validator: IAbstractValidator): any; + CreateRule(name: string): IAbstractValidationRule; + CreateAbstractRule(name: string): IAbstractValidationRule; + CreateAbstractListRule(name: string): IAbstractValidationRule; + ForList: boolean; + } + interface IAbstractValidationRule { + Validate(context: T): IValidationResult; + ValidateAsync(context: T): Q.Promise; + ValidateAll(context: T): Q.Promise; + ValidateProperty(context: T, propName: string): void; + ValidationResult: IValidationResult; + Rules: { + [name: string]: IPropertyValidationRule; + }; + Validators: { + [name: string]: IValidator; + }; + Children: { + [name: string]: IAbstractValidationRule; + }; + } + interface IPropertyValidationRule { + Validators: { + [name: string]: any; + }; + Validate(context: IValidationContext): IValidationFailure[]; + ValidateAsync(context: IValidationContext): Q.Promise; + } + interface IValidationContext { + Value: string; + Key: string; + Data: T; + } + class Error implements IError { + public HasError: boolean; + public ErrorMessage: string; + constructor(); + } + class ValidationFailure implements IError { + public Error: IError; + public IsAsync: boolean; + constructor(Error: IError, IsAsync: boolean); + public HasError : boolean; + public ErrorMessage : string; + public TranslateArgs : IErrorTranslateArgs; + } + class ValidationResult implements IValidationResult { + public Name: string; + constructor(Name: string); + public IsDirty: boolean; + public Children : IValidationResult[]; + public Add(error: IValidationResult): void; + public Remove(index: number): void; + public Optional: IOptional; + public TranslateArgs: IErrorTranslateArgs[]; + public HasErrorsDirty : boolean; + public HasErrors : boolean; + public ErrorCount : number; + public ErrorMessage : string; + } + class CompositeValidationResult implements IValidationResult { + public Name: string; + public Children: IValidationResult[]; + constructor(Name: string); + public Optional: IOptional; + public AddFirst(error: IValidationResult): void; + public Add(error: IValidationResult): void; + public Remove(index: number): void; + public HasErrorsDirty : boolean; + public HasErrors : boolean; + public ErrorCount : number; + public ErrorMessage : string; + public TranslateArgs : IErrorTranslateArgs[]; + public LogErrors(headerMessage?: string): void; + public Errors : { + [name: string]: IValidationResult; + }; + private FlattenErros; + public SetDirty(): void; + public SetPristine(): void; + private SetDirtyEx(node, dirty); + private flattenErrors(node, errorCollection); + private traverse(node, indent); + } + class AbstractValidator implements IAbstractValidator { + public Validators: { + [name: string]: IPropertyValidator[]; + }; + public AbstractValidators: { + [name: string]: IAbstractValidator; + }; + public ValidationFunctions: { + [name: string]: IValidatorFce[]; + }; + public RuleFor(prop: string, validator: IPropertyValidator): void; + public ValidationFor(prop: string, fce: IValidatorFce): void; + public Validation(fce: IValidatorFce): void; + public ValidatorFor(prop: string, validator: IAbstractValidator, forList?: boolean): void; + public CreateAbstractRule(name: string): IAbstractValidationRule; + public CreateAbstractListRule(name: string): IAbstractValidationRule; + public CreateRule(name: string): IAbstractValidationRule; + public ForList: boolean; + } + class MessageLocalization { + static customMsg: string; + static defaultMessages: { + "required": string; + "remote": string; + "email": string; + "url": string; + "date": string; + "dateISO": string; + "number": string; + "digits": string; + "signedDigits": string; + "creditcard": string; + "equalTo": string; + "maxlength": string; + "minlength": string; + "rangelength": string; + "range": string; + "max": string; + "min": string; + "step": string; + "contains": string; + "mask": string; + "custom": string; + }; + static ValidationMessages: { + "required": string; + "remote": string; + "email": string; + "url": string; + "date": string; + "dateISO": string; + "number": string; + "digits": string; + "signedDigits": string; + "creditcard": string; + "equalTo": string; + "maxlength": string; + "minlength": string; + "rangelength": string; + "range": string; + "max": string; + "min": string; + "step": string; + "contains": string; + "mask": string; + "custom": string; + }; + static GetValidationMessage(validator: any): string; + } +} +declare module "node-validation" {export = Validation;} diff --git a/business-rules-engine/business-rules-engine-tests.ts b/business-rules-engine/business-rules-engine-tests.ts new file mode 100644 index 000000000..5695c3b7f --- /dev/null +++ b/business-rules-engine/business-rules-engine-tests.ts @@ -0,0 +1,32 @@ +/// +/// +/// +/// +/// + +export interface IPerson{ + Checked:boolean; + FirstName:string; + LastName:string; + Email:string; +} + + +//create custom composite validator +var personValidator = new Validation.AbstractValidator(); + +//create field validators +var required = new Validators.RequiredValidator(); +var email = new Validators.EmailValidator(); +var maxLength = new Validators.MaxLengthValidator(); +maxLength.MaxLength = 15; + + +personValidator.RuleFor("FirstName", required); +personValidator.RuleFor("FirstName", maxLength); + +personValidator.RuleFor("LastName", required); +personValidator.RuleFor("LastName", maxLength); + +personValidator.RuleFor("Email", required); +personValidator.RuleFor("Email", email); diff --git a/business-rules-engine/business-rules-engine.d.ts b/business-rules-engine/business-rules-engine.d.ts new file mode 100644 index 000000000..7c17714cc --- /dev/null +++ b/business-rules-engine/business-rules-engine.d.ts @@ -0,0 +1,242 @@ +// Type definitions for business-rules-engine - v1.0.20 +// Project: https://github.com/rsamec/form +// Definitions by: Roman Samec +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// Source: typings/business-rules-engine/Validation.d.ts +/// +/// +declare module Validation { + interface IErrorCustomMessage { + (config: any, args: any): string; + } + interface IPropertyValidator { + isAcceptable(s: any): boolean; + customMessage?: IErrorCustomMessage; + tagName?: string; + } + interface IStringValidator extends IPropertyValidator { + isAcceptable(s: string): boolean; + } + interface IAsyncPropertyValidator { + isAcceptable(s: any): Q.Promise; + customMessage?: IErrorCustomMessage; + isAsync: boolean; + tagName?: string; + } + interface IAsyncStringPropertyValidator extends IAsyncPropertyValidator { + isAcceptable(s: string): Q.Promise; + } + enum CompareOperator { + LessThan = 0, + LessThanEqual = 1, + Equal = 2, + NotEqual = 3, + GreaterThanEqual = 4, + GreaterThan = 5, + } + interface IError { + HasError: boolean; + ErrorMessage: string; + TranslateArgs?: IErrorTranslateArgs; + } + interface IErrorTranslateArgs { + TranslateId: string; + MessageArgs: any; + CustomMessage?: IErrorCustomMessage; + } + interface IOptional { + (): boolean; + } + interface IValidationFailure extends IError { + IsAsync: boolean; + Error: IError; + } + interface IValidationResult { + Name: string; + Add(validationResult: IValidationResult): void; + Remove(index: number): void; + Children: IValidationResult[]; + HasErrors: boolean; + HasErrorsDirty: boolean; + ErrorMessage: string; + ErrorCount: number; + Optional?: IOptional; + TranslateArgs?: IErrorTranslateArgs[]; + } + interface IValidate { + (args: IError): void; + } + interface IAsyncValidate { + (args: IError): Q.Promise; + } + interface IValidatorFce { + Name: string; + ValidationFce?: IValidate; + AsyncValidationFce?: IAsyncValidate; + } + interface IValidator { + Validate(context: any): IValidationFailure; + ValidateAsync(context: any): Q.Promise; + Error: IError; + } + interface IAbstractValidator { + RuleFor(prop: string, validator: IPropertyValidator): any; + ValidationFor(prop: string, validatorFce: IValidatorFce): any; + Validation(validatorFce: IValidatorFce): any; + ValidatorFor(prop: string, validator: IAbstractValidator): any; + CreateRule(name: string): IAbstractValidationRule; + CreateAbstractRule(name: string): IAbstractValidationRule; + CreateAbstractListRule(name: string): IAbstractValidationRule; + ForList: boolean; + } + interface IAbstractValidationRule { + Validate(context: T): IValidationResult; + ValidateAsync(context: T): Q.Promise; + ValidateAll(context: T): Q.Promise; + ValidateProperty(context: T, propName: string): void; + ValidationResult: IValidationResult; + Rules: { + [name: string]: IPropertyValidationRule; + }; + Validators: { + [name: string]: IValidator; + }; + Children: { + [name: string]: IAbstractValidationRule; + }; + } + interface IPropertyValidationRule { + Validators: { + [name: string]: any; + }; + Validate(context: IValidationContext): IValidationFailure[]; + ValidateAsync(context: IValidationContext): Q.Promise; + } + interface IValidationContext { + Value: string; + Key: string; + Data: T; + } + class Error implements IError { + public HasError: boolean; + public ErrorMessage: string; + constructor(); + } + class ValidationFailure implements IError { + public Error: IError; + public IsAsync: boolean; + constructor(Error: IError, IsAsync: boolean); + public HasError : boolean; + public ErrorMessage : string; + public TranslateArgs : IErrorTranslateArgs; + } + class ValidationResult implements IValidationResult { + public Name: string; + constructor(Name: string); + public IsDirty: boolean; + public Children : IValidationResult[]; + public Add(error: IValidationResult): void; + public Remove(index: number): void; + public Optional: IOptional; + public TranslateArgs: IErrorTranslateArgs[]; + public HasErrorsDirty : boolean; + public HasErrors : boolean; + public ErrorCount : number; + public ErrorMessage : string; + } + class CompositeValidationResult implements IValidationResult { + public Name: string; + public Children: IValidationResult[]; + constructor(Name: string); + public Optional: IOptional; + public AddFirst(error: IValidationResult): void; + public Add(error: IValidationResult): void; + public Remove(index: number): void; + public HasErrorsDirty : boolean; + public HasErrors : boolean; + public ErrorCount : number; + public ErrorMessage : string; + public TranslateArgs : IErrorTranslateArgs[]; + public LogErrors(headerMessage?: string): void; + public Errors : { + [name: string]: IValidationResult; + }; + private FlattenErros; + public SetDirty(): void; + public SetPristine(): void; + private SetDirtyEx(node, dirty); + private flattenErrors(node, errorCollection); + private traverse(node, indent); + } + class AbstractValidator implements IAbstractValidator { + public Validators: { + [name: string]: IPropertyValidator[]; + }; + public AbstractValidators: { + [name: string]: IAbstractValidator; + }; + public ValidationFunctions: { + [name: string]: IValidatorFce[]; + }; + public RuleFor(prop: string, validator: IPropertyValidator): void; + public ValidationFor(prop: string, fce: IValidatorFce): void; + public Validation(fce: IValidatorFce): void; + public ValidatorFor(prop: string, validator: IAbstractValidator, forList?: boolean): void; + public CreateAbstractRule(name: string): IAbstractValidationRule; + public CreateAbstractListRule(name: string): IAbstractValidationRule; + public CreateRule(name: string): IAbstractValidationRule; + public ForList: boolean; + } + class MessageLocalization { + static customMsg: string; + static defaultMessages: { + "required": string; + "remote": string; + "email": string; + "url": string; + "date": string; + "dateISO": string; + "number": string; + "digits": string; + "signedDigits": string; + "creditcard": string; + "equalTo": string; + "maxlength": string; + "minlength": string; + "rangelength": string; + "range": string; + "max": string; + "min": string; + "step": string; + "contains": string; + "mask": string; + "custom": string; + }; + static ValidationMessages: { + "required": string; + "remote": string; + "email": string; + "url": string; + "date": string; + "dateISO": string; + "number": string; + "digits": string; + "signedDigits": string; + "creditcard": string; + "equalTo": string; + "maxlength": string; + "minlength": string; + "rangelength": string; + "range": string; + "max": string; + "min": string; + "step": string; + "contains": string; + "mask": string; + "custom": string; + }; + static GetValidationMessage(validator: any): string; + } +} +declare module "business-rule-engine" {export = Validation;} diff --git a/camljs/camljs-tests.ts.tscparams b/camljs/camljs-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/camljs/camljs-tests.ts.tscparams +++ b/camljs/camljs-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/camljs/camljs.d.ts.tscparams b/camljs/camljs.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/camljs/camljs.d.ts.tscparams +++ b/camljs/camljs.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/chai-fuzzy/chai-fuzzy.d.ts.tscparams b/chai-fuzzy/chai-fuzzy.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/chai-fuzzy/chai-fuzzy.d.ts.tscparams +++ b/chai-fuzzy/chai-fuzzy.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/chai-jquery/chai-jquery-tests.ts.tscparams b/chai-jquery/chai-jquery-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/chai-jquery/chai-jquery-tests.ts.tscparams +++ b/chai-jquery/chai-jquery-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/chai/chai-tests.ts.tscparams b/chai/chai-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/chai/chai-tests.ts.tscparams +++ b/chai/chai-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/chroma-js/chroma-js-tests.ts b/chroma-js/chroma-js-tests.ts new file mode 100644 index 000000000..3240ac11f --- /dev/null +++ b/chroma-js/chroma-js-tests.ts @@ -0,0 +1,120 @@ +/// + +function test_chroma() { + chroma("red"); + chroma("#ff0000"); + chroma("#f00"); + chroma("FF0000"); + chroma(255, 0, 0); + chroma([255, 0, 0]); + chroma(0, 1, 0.5, 'hsl'); + chroma([0, 1, 0.5], 'hsl'); + chroma(0, 1, 1, 'hsv'); + chroma("rgb(255,0,0)"); + chroma("rgb(100%,0%,0%)"); + chroma("hsl(0,100%,50%)"); + chroma(53.24, 80.09, 67.20, 'lab'); + chroma(53.24, 104.55, 40, 'lch'); + chroma(1, 0, 0, 'gl'); + + chroma.hex("#ff0000"); + chroma.hex("red"); + chroma.hex("rgb(255, 0, 0)"); + + chroma.rgb(255, 0, 0); + chroma.hsl(0, 1, 0.5); + chroma.hsv(120, 0.5, 0.5); + chroma.lab(53.24, 80.09, 67.20); + chroma.lch(53.24, 104.55, 40); + chroma.gl(1, 0, 0); + + chroma.interpolate('white', 'black', 0) // #ffffff + chroma.interpolate('white', 'black', 1) // #000000 + chroma.interpolate('white', 'black', 0.5) // #7f7f7f + chroma.interpolate('white', 'black', 0.5, 'hsv') // #808080 + chroma.interpolate('white', 'black', 0.5, 'lab') // #777777 + + chroma.interpolate('rgba(0,0,0,0)', 'rgba(255,0,0,1)', 0.5).css() //"rgba(127.5,0,0,0.5)" + + var bezInterpolator = chroma.interpolate.bezier(['white', 'yellow', 'red', 'black']); + bezInterpolator(0).hex() // #ffffff + bezInterpolator(0.33).hex() // #ffcc67 + bezInterpolator(0.66).hex() // #b65f1a + bezInterpolator(1).hex() // #000000 + + chroma.luminance('black') // 0 + chroma.luminance('white') // 1 + chroma.luminance('#ff0000') // 0.2126 + + chroma.contrast('white', 'navy') // 16.00 – ok + chroma.contrast('white', 'yellow') // 1.07 – not ok! +} + +function test_color() { + chroma('red').hex() // "#FF0000"" + chroma('red').rgb() // [255, 0, 0] + chroma('red').hsv() // [0, 1, 1] + chroma('red').hsl() // [0, 1, 0.5] + chroma('red').lab() // [53.2407, 80.0924, 67.2031] + chroma('red').lch() // [53.2407, 104.5517, 39.9990] + chroma('red').rgba() // [255, 0, 0, 1] + chroma('red').css() // "rgb(255,0,0)" + chroma('red').alpha(0.7).css() // "rgba(255,0,0,0.7)" + chroma('red').css('hsl') // "hsl(0,100%,50%)" + chroma('red').alpha(0.7).css('hsl') // "hsla(0,100%,50%,0.7)" + chroma('blue').css('hsla') // "hsla(240,100%,50%,1)" + + var red = chroma('red'); + red.alpha(0.5); + red.css(); // rgba(255,0,0,0.5); + + chroma('red').darken().hex() // #BC0000 + chroma('red').brighten().hex() // #FF603B + chroma('#eecc99').saturate().hex() // #fcc973 + chroma('red').desaturate().hex() // #ec3d23 + + chroma('black').luminance() // 0 + chroma('white').luminance() // 1 + chroma('red').luminance() // 0.2126 +} + +function test_scale() { + var scale = chroma.scale(['lightyellow', 'navy']); + scale(0.5); // #7F7FB0 + + chroma.scale('RdYlBu'); + + var col = scale(0.5); + col.hex(); // #7F7FB0 + col.rgb(); // [127.5, 127.5, 176] + + scale = chroma.scale(['lightyellow', 'navy']).out('hex'); + scale(0.5); // "#7F7FB0" + + var scale = chroma.scale(['lightyellow', 'navy']); + scale.mode('hsv')(0.5); // #54C08A + scale.mode('hsl')(0.5); // #31FF98 + scale.mode('lab')(0.5); // #967CB2 + scale.mode('lch')(0.5); // #D26662 + + var scale = chroma.scale(['lightyellow', 'navy']).domain([0, 400]); + scale(200); // #7F7FB0 + + var scale = chroma.scale(['lightyellow', 'navy']).domain([0, 100, 200, 300, 400]); + scale(98); // #7F7FB0 + scale(99); // #7F7FB0 + scale(100); // #AAAAC0 + scale(101); // #AAAAC0 + + chroma.scale(['#eee', '#900']).domain([0, 400], 7); + chroma.scale(['#eee', '#900']).domain([1, 1000000], 7, 'log'); + chroma.scale(['#eee', '#900']).domain([1, 1000000], 5, 'quantiles'); + chroma.scale(['#eee', '#900']).domain([1, 1000000], 5, 'k-means'); + chroma.scale(['white', 'red']).domain([0, 100], 4).domain() // [0, 25, 50, 75, 100] + + chroma.scale().range(['lightyellow', 'navy']); + + chroma.scale(['lightyellow', 'navy']).correctLightness(true); + + chroma.scale('RdYlGn').domain([0,1], 5).colors() +} diff --git a/chroma-js/chroma-js.d.ts b/chroma-js/chroma-js.d.ts new file mode 100644 index 000000000..94b32ae81 --- /dev/null +++ b/chroma-js/chroma-js.d.ts @@ -0,0 +1,317 @@ +// Type definitions for Chroma.js v0.5.6 +// Project: https://github.com/gka/chroma.js +// Definitions by: Sebastian Brückner +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** + * Chroma.js is a tiny library for all kinds of color conversions and color scales. + */ +declare module Chroma { + + export interface ChromaStatic { + /** + * Creates a color from a string representation (as supported in CSS). + * + * @param color The string to convert to a color. + * @return the color object. + */ + (color: string): Color; + + /** + * Create a color in the specified color space using a, b and c as values. + * + * @param a + * @param b + * @param c + * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb". + * @return the color object. + */ + (a: number, b: number, c: number, colorSpace?: string): Color; + + /** + * Create a color in the specified color space using values. + * + * @param values An array of values (e.g. [r, g, b, a?]). + * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb". + * @return the color object. + */ + (values: number[], colorSpace?: string): Color; + + /** + * Create a color in the specified color space using a, b and c as values. + * + * @param a + * @param b + * @param c + * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb". + * @return the color object. + */ + color(a: number, b: number, c: number, colorSpace?: string): Color; + + /** + * Calculate the contrast ratio of two colors. + * + * @param color1 The first color. + * @param color2 The second color. + * @return the contrast ratio. + */ + contrast(color1: Color, color2: Color): number; + /** + * Calculate the contrast ratio of two colors. + * + * @param color1 The first color. + * @param color2 The second color. + * @return the contrast ratio. + */ + contrast(color1: Color, color2: string): number; + /** + * Calculate the contrast ratio of two colors. + * + * @param color1 The first color. + * @param color2 The second color. + * @return the contrast ratio. + */ + contrast(color1: string, color2: Color): number; + /** + * Calculate the contrast ratio of two colors. + * + * @param color1 The first color. + * @param color2 The second color. + * @return the contrast ratio. + */ + contrast(color1: string, color2: string): number; + + /** + * Create a color from a hex or string representation (as supported in CSS). + * + * This is an alias of chroma.hex(). + * + * @param color The string to convert to a color. + * @return the color object. + */ + css(color: string): Color; + + /** + * Create a color from a hex or string representation (as supported in CSS). + * + * This is an alias of chroma.css(). + * + * @param color The string to convert to a color. + * @return the color object. + */ + hex(color: string): Color; + + rgb(red: number, green: number, blue: number, alpha?: number): Color; + hsl(hue: number, saturation: number, lightness: number, alpha?: number): Color; + hsv(hue: number, saturation: number, value: number, alpha?: number): Color; + lab(lightness: number, a: number, b: number, alpha?: number): Color; + lch(lightness: number, chroma: number, hue: number, alpha?: number): Color; + gl(red: number, green: number, blue: number, alpha?: number): Color; + + interpolate: InterpolateFunction; + mix: InterpolateFunction; + + luminance(color: Color): number; + luminance(color: string): number; + + /** + * Creates a color scale using a pre-defined color scale. + * + * @param name The name of the color scale. + * @return the resulting color scale. + */ + scale(name: string): Scale; + + /** + * Creates a color scale function from the given set of colors. + * + * @param colors An Array of at least two color names or hex values. + * @return the resulting color scale. + */ + scale(colors?: string[]): Scale; + + scales: PredefinedScales; + } + + interface InterpolateFunction { + (color1: Color, color2: Color, f: number, mode?: string): Color; + (color1: Color, color2: string, f: number, mode?: string): Color; + (color1: string, color2: Color, f: number, mode?: string): Color; + (color1: string, color2: string, f: number, mode?: string): Color; + + bezier(colors: any[]): (t: number) => Color; + } + + interface PredefinedScales { + [key: string]: Scale; + + cool: Scale; + hot: Scale; + } + + export interface Color { + /** + * Creates a color from a string representation (as supported in CSS). + * + * @param color The string to convert to a color. + */ + new(color: string): Color; + + /** + * Create a color in the specified color space using a, b and c as values. + * + * @param a + * @param b + * @param c + * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb". + */ + new(a: number, b: number, c: number, colorSpace?: string): Color; + + /** + * Create a color in the specified color space using a, b and c as color values and alpha as the alpha value. + * + * @param a + * @param b + * @param c + * @param alpha The alpha value of the color. + * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb". + */ + new(a: number, b: number, c: number, alpha: number, colorSpace?: string): Color; + + /** + * Create a color in the specified color space using values. + * + * @param values An array of values (e.g. [r, g, b, a?]). + * @param colorSpace The color space to use (one of "rgb", "hsl", "hsv", "lab", "lch", "gl"). Defaults to "rgb". + */ + new(values: number[], colorSpace: string): Color; + + /** + * Convert this color to CSS hex representation. + * + * @return this color's hex representation. + */ + hex(): string; + + /** + * @return the relative luminance of the color, which is a value between 0 (black) and 1 (white). + */ + luminance(): number; + + /** + * @return the X11 name of this color or its hex value if it does not have a name. + */ + name(): string; + + /** + * @return the alpha value of the color. + */ + alpha(): number; + + /** + * Set the alpha value. + * + * @param alpha The alpha value. + * @return this + */ + alpha(alpha: number): Color; + + css(mode?: string): string; + + interpolate(color: Color, f: number, mode?: string): Color; + interpolate(color: string, f: number, mode?: string): Color; + + premultiply(): Color; + + rgb(): number[]; + rgba(): number[]; + hsl(): number[]; + hsv(): number[]; + lab(): number[]; + lch(): number[]; + hsi(): number[]; + gl(): number[]; + + darken(amount?: number): Color; + darker(amount: number): Color; + brighten(amount?: number): Color; + brighter(amount: number): Color; + saturate(amount?: number): Color; + desaturate(amount?: number): Color; + + toString(): string; + } + + export interface Scale { + /** + * Interpolate a color using the currently set range and domain. + * + * @param value The value to use for interpolation. + * @return the interpolated hex color OR a Color object (depending on the mode set on this Scale). + */ + (value: number): any; + + /** + * Retreive all possible colors generated by this scale if it has distinct classes. + * + * @param mode The output mode to use. Must be one of Color's getters. Defaults to "hex". + * @return an array of colors in the type specified by mode. + */ + colors(mode?: string): any[]; + + correctLightness(): boolean; + + /** + * Enable or disable automatic lightness correction of this scale. + * + * @param Whether to enable or disable automatic lightness correction. + * @return this + */ + correctLightness(enable: boolean): Scale; + + /** + * Get the current domain. + * + * @return The current domain. + */ + domain(): number[]; + + /** + * Set the domain. + * + * @param domain An Array of at least two numbers (min and max). + * @param classes The number of fixed classes to create between min and max. + * @param mode The scale to use. Examples: log, quantiles, k-means. + * @return this + */ + domain(domain: number[], classes?: number, mode?: string): Scale; + + /** + * Specify in which color space the colors should be interpolated. Defaults to "rgb". + * You can use any of the following spaces: rgb, hsv, hsl, lab, lch + * + * @param colorSpace The color space to use for interpolation. + * @return this + */ + mode(colorSpace: string): Scale; + + /** + * Set the output mode of this Scale. + * + * @param mode The output mode to use. Must be one of Color's getters. + * @return this + */ + out(mode: string): Scale; + + /** + * Set the color range after initialization. + * + * @param colors An Array of at least two color names or hex values. + * @return this + */ + range(colors: string[]): Scale; + } + +} + +declare var chroma: Chroma.ChromaStatic; diff --git a/chrome/chrome-app-tests.ts.tscparams b/chrome/chrome-app-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/chrome/chrome-app-tests.ts.tscparams +++ b/chrome/chrome-app-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/chrome/chrome-app.d.ts.tscparams b/chrome/chrome-app.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/chrome/chrome-app.d.ts.tscparams +++ b/chrome/chrome-app.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/chrome/chrome-tests.ts.tscparams b/chrome/chrome-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/chrome/chrome-tests.ts.tscparams +++ b/chrome/chrome-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index 23ee0d916..df655e2b8 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -3,6 +3,8 @@ // Definitions by: Matthew Kimber , otiai10 // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + //////////////////// // Alarms //////////////////// @@ -294,6 +296,7 @@ declare module chrome.contextMenus { pageUrl: string; linkUrl?: string; parentMenuItemId?: any; + srcUrl?: string; } interface CreateProperties { @@ -537,6 +540,14 @@ declare module chrome.declarativeWebRequest { var onRequest: RequestedEvent; } +//////////////////// +// DesktopCapture +//////////////////// +declare module chrome.desktopCapture { + export function chooseDesktopMedia(sources: string[], targetTab?: chrome.tabs.Tab, callback?: (streamId: string) => void): void; + export function cancelChooseDesktopMedia(desktopMediaRequestId: number): void; +} + //////////////////// // Dev Tools - Inspected Window //////////////////// @@ -1745,6 +1756,27 @@ declare module chrome.socket { export function getNetworkList(callback: (result: NetworkInterface[]) => void): void; } +//////////////////// +// TabCapture +//////////////////// +declare module chrome.tabCapture { + interface CaptureInfo { + tabId: number; + status: string; + fullscreen: boolean; + } + + interface CaptureOptions { + audio?: boolean; + video?: boolean; + audioConstraints?: MediaTrackConstraints; + videoConstraints?: MediaTrackConstraints; + } + + export function capture(options: CaptureOptions, callback: (stream: LocalMediaStream) => void): void; + export function getCapturedTabs(callback: (result: CaptureInfo[]) => void): void; +} + //////////////////// // Tabs //////////////////// @@ -2198,13 +2230,19 @@ declare module chrome.webRequest { username: string; password: string; } - + + interface HttpHeader { + name: string; + value?: string; + binaryValue?: ArrayBuffer; + } + interface BlockingResponse { cancel?: boolean; redirectUrl?: string; - responseHeaders?: Object; + responseHeaders?: HttpHeader[]; authCredentials?: AuthCredentials; - requestHeaders?: Object; + requestHeaders?: HttpHeader[]; } interface RequestFilter { @@ -2224,7 +2262,7 @@ declare module chrome.webRequest { ip?: string; statusLine?: string; frameId: number; - responseHeaders?: Object; + responseHeaders?: HttpHeader[]; parentFrameId: number; fromCache: boolean; url: string; @@ -2243,7 +2281,7 @@ declare module chrome.webRequest { statusLine?: string; frameId: number; requestId: string; - responseHeaders: Object; + responseHeaders?: HttpHeader[]; type: string; method: string; } @@ -2253,7 +2291,7 @@ declare module chrome.webRequest { ip?: string; statusLine?: string; frameId: number; - responseHeaders?: Object; + responseHeaders?: HttpHeader[]; parentFrameId: number; fromCache: boolean; url: string; @@ -2275,7 +2313,7 @@ declare module chrome.webRequest { statusLine?: string; frameId: number; challenger: Challenger; - responseHeaders: Object; + responseHeaders?: HttpHeader[]; isProxy: boolean; realm?: string; parentFrameId: number; @@ -2294,7 +2332,7 @@ declare module chrome.webRequest { timeStamp: number; frameId: number; requestId: number; - requestHeaders?: Object; + requestHeaders?: HttpHeader[]; type: string; method: string; } @@ -2318,7 +2356,7 @@ declare module chrome.webRequest { ip?: string; statusLine?: string; frameId: number; - responseHeaders?: Object; + responseHeaders?: HttpHeader[]; parentFrameId: number; fromCache: boolean; url: string; @@ -2336,7 +2374,7 @@ declare module chrome.webRequest { timeStamp: number; frameId: number; requestId: string; - requestHeaders: Object; + requestHeaders?: HttpHeader[]; type: string; method: string; } diff --git a/convert-source-map/convert-source-map-tests.ts.tscparams b/convert-source-map/convert-source-map-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/convert-source-map/convert-source-map-tests.ts.tscparams +++ b/convert-source-map/convert-source-map-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/convert-source-map/convert-source-map.d.ts.tscparams b/convert-source-map/convert-source-map.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/convert-source-map/convert-source-map.d.ts.tscparams +++ b/convert-source-map/convert-source-map.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/crossroads/crossroads-tests.ts.tscparams b/crossroads/crossroads-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/crossroads/crossroads-tests.ts.tscparams +++ b/crossroads/crossroads-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/crossroads/crossroads.d.ts.tscparams b/crossroads/crossroads.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/crossroads/crossroads.d.ts.tscparams +++ b/crossroads/crossroads.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/csurf/csurf.d.ts b/csurf/csurf.d.ts new file mode 100644 index 000000000..cc78f9599 --- /dev/null +++ b/csurf/csurf.d.ts @@ -0,0 +1,30 @@ +// Type definitions for csurf +// Project: https://www.npmjs.org/package/csurf +// Definitions by: Hiroki Horiuchi +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Express { + export interface Request { + csrfToken(): string; + } +} + +declare module "csurf" { + import express = require('express'); + + function csurf(options?: { + value?: (req: express.Request) => string; + cookie?: csurf.CookieOptions; + }): express.RequestHandler; + + module csurf { + export interface CookieOptions extends express.CookieOptions { + key: string; + } + } + + export = csurf; +} + diff --git a/d3/d3-tests.ts.tscparams b/d3/d3-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/d3/d3-tests.ts.tscparams +++ b/d3/d3-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/d3/d3.d.ts b/d3/d3.d.ts old mode 100755 new mode 100644 index 0354bc264..158462aa3 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -243,7 +243,7 @@ declare module D3 { * * @param map Array of objects to get the values from */ - values(map: any[]): any[]; + values(map: any): any[]; /** * List the key-value entries of an associative array. * @@ -417,7 +417,7 @@ declare module D3 { /* * The array of built-in interpolator factories */ - interpolators: Array; + interpolators: Transition.InterpolateFactory[]; /** * Layouts */ @@ -525,11 +525,11 @@ declare module D3 { /** * gets the mouse position relative to a specified container. */ - mouse(container: any): Array; + mouse(container: any): number[]; /** * gets the touch positions relative to a specified container. */ - touches(container: any): Array>; + touches(container: any): number[][]; /** * If the specified value is a function, returns the specified value. @@ -538,10 +538,12 @@ declare module D3 { functor(value: (p : R) => T): (p : R) => T; functor(value: T): (p : any) => T; - map(object?: any): Map; - set(array?: Array): Set; - dispatch(...types: Array): Dispatch; - rebind(target: any, source: any, ...names: Array): any; + map(): Map; + set(): Set; + map(object: {[key: string]: T; }): Map; + set(array: T[]): Set; + dispatch(...types: string[]): Dispatch; + rebind(target: any, source: any, ...names: any[]): any; requote(str: string): string; timer: { (funct: () => boolean, delay?: number, mark?: number): void; @@ -839,23 +841,27 @@ declare module D3 { entries(values: any[]): NestKeyValue[]; } - export interface Map { + export interface Map { has(key: string): boolean; - get(key: string): any; - set(key: string, value: T): T; + get(key: string): T; + set(key: string, value: T): T; remove(key: string): boolean; - keys(): Array; - values(): Array; - entries(): Array; - forEach(func: (key: string, value: any) => void ): void; + keys(): string[]; + values(): T[]; + entries(): any[][]; // Actually of form [key: string, val: T][], but this is inexpressible in Typescript + forEach(func: (key: string, value: T) => void ): void; + empty(): boolean; + size(): number; } - export interface Set{ - has(value: any): boolean; - add(value: any): any; - remove(value: any): boolean; - values(): Array; - forEach(func: (value: any) => void ): void; + export interface Set { + has(value: T): boolean; + add(value: T): T; + remove(value: T): boolean; + values(): string[]; + forEach(func: (value: string) => void ): void; + empty(): boolean; + size(): number; } export interface Random { @@ -1096,6 +1102,9 @@ declare module D3 { (layers: T[], index?: number): T[]; values(accessor?: (d: any) => any): StackLayout; offset(offset: string): StackLayout; + x(accessor: (d: any, i: number) => any): StackLayout; + y(accessor: (d: any, i: number) => any): StackLayout; + out(setter: (d: any, y0: number, y: number) => void): StackLayout; } export interface TreeLayout { @@ -1128,11 +1137,11 @@ declare module D3 { /** * Runs the tree layout */ - nodes(root: GraphNode): TreeLayout; + nodes(root: GraphNode): GraphNode[]; /** * Given the specified array of nodes, such as those returned by nodes, returns an array of objects representing the links from parent to child for each node */ - links(nodes: Array): Array; + links(nodes: GraphNode[]): GraphLink[]; /** * If separation is specified, uses the specified function to compute separation between neighboring nodes. If separation is not specified, returns the current separation function */ @@ -1153,11 +1162,24 @@ declare module D3 { /** * Gets the available layout size */ - (): Array; + (): number[]; /** * Sets the available layout size */ - (size: Array): TreeLayout; + (size: number[]): TreeLayout; + }; + /** + * Gets or sets the available node size + */ + nodeSize: { + /** + * Gets the available node size + */ + (): number[]; + /** + * Sets the available node size + */ + (size: number[]): TreeLayout; }; } @@ -1221,6 +1243,21 @@ declare module D3 { target: GraphNode; } + export interface GraphNodeForce { + index?: number; + x?: number; + y?: number; + px?: number; + py?: number; + fixed?: boolean; + weight?: number; + } + + export interface GraphLinkForce { + source: GraphNodeForce; + target: GraphNodeForce; + } + export interface ForceLayout { (): ForceLayout; size: { @@ -1270,14 +1307,14 @@ declare module D3 { }; links: { - (): GraphLink[]; - (arLinks: GraphLink[]): ForceLayout; + (): GraphLinkForce[]; + (arLinks: GraphLinkForce[]): ForceLayout; }; nodes: { - (): GraphNode[]; - (arNodes: GraphNode[]): ForceLayout; + (): GraphNodeForce[]; + (arNodes: GraphNodeForce[]): ForceLayout; }; start(): ForceLayout; @@ -1289,13 +1326,13 @@ declare module D3 { } export interface BundleLayout{ - (links: Array): Array>; + (links: GraphLink[]): GraphNode[][]; } export interface ChordLayout { matrix: { - (): Array>; - (matrix: Array>): ChordLayout; + (): number[][]; + (matrix: number[][]): ChordLayout; } padding: { (): number; @@ -1313,8 +1350,8 @@ declare module D3 { (): (a: number, b: number) => number; (comparator: (a: number, b: number) => number): ChordLayout; } - chords(): Array; - groups(): Array; + chords(): GraphLink[]; + groups(): ArcDescriptor[]; } export interface ClusterLayout{ @@ -1323,18 +1360,18 @@ declare module D3 { (comparator: (a: GraphNode, b: GraphNode) => number): ClusterLayout; } children: { - (): (d: any, i?: number) => Array; - (children: (d: any, i?: number) => Array): ClusterLayout; + (): (d: any, i?: number) => GraphNode[]; + (children: (d: any, i?: number) => GraphNode[]): ClusterLayout; } - nodes(root: GraphNode): Array; - links(nodes: Array): Array; + nodes(root: GraphNode): GraphNode[]; + links(nodes: GraphNode[]): GraphLink[]; seperation: { (): (a: GraphNode, b: GraphNode) => number; (seperation: (a: GraphNode, b: GraphNode) => number): ClusterLayout; } size: { - (): Array; - (size: Array): ClusterLayout; + (): number[]; + (size: number[]): ClusterLayout; } value: { (): (node: GraphNode) => number; @@ -1348,11 +1385,11 @@ declare module D3 { (comparator: (a: GraphNode, b: GraphNode) => number): HierarchyLayout; } children: { - (): (d: any, i?: number) => Array; - (children: (d: any, i?: number) => Array): HierarchyLayout; + (): (d: any, i?: number) => GraphNode[]; + (children: (d: any, i?: number) => GraphNode[]): HierarchyLayout; } - nodes(root: GraphNode): Array; - links(nodes: Array): Array; + nodes(root: GraphNode): GraphNode[]; + links(nodes: GraphNode[]): GraphLink[]; value: { (): (node: GraphNode) => number; (value: (node: GraphNode) => number): HierarchyLayout; @@ -1367,21 +1404,21 @@ declare module D3 { } export interface HistogramLayout { - (values: Array, index?: number): Array; + (values: any[], index?: number): Bin[]; value: { (): (value: any) => any; (accessor: (value: any) => any): HistogramLayout } range: { - (): (value: any, index: number) => Array; - (range: (value: any, index: number) => Array): HistogramLayout; - (range: Array): HistogramLayout; + (): (value: any, index: number) => number[]; + (range: (value: any, index: number) => number[]): HistogramLayout; + (range: number[]): HistogramLayout; } bins: { - (): (range: Array, index: number) => Array; - (bins: (range: Array, index: number) => Array): HistogramLayout; + (): (range: any[], index: number) => number[]; + (bins: (range: any[], index: number) => number[]): HistogramLayout; (bins: number): HistogramLayout; - (bins: Array): HistogramLayout; + (bins: number[]): HistogramLayout; } frequency: { (): boolean; @@ -1395,18 +1432,18 @@ declare module D3 { (comparator: (a: GraphNode, b: GraphNode) => number): PackLayout; } children: { - (): (d: any, i?: number) => Array; - (children: (d: any, i?: number) => Array): PackLayout; + (): (d: any, i?: number) => GraphNode[]; + (children: (d: any, i?: number) => GraphNode[]): PackLayout; } - nodes(root: GraphNode): Array; - links(nodes: Array): Array; + nodes(root: GraphNode): GraphNode[]; + links(nodes: GraphNode[]): GraphLink[]; value: { (): (node: GraphNode) => number; (value: (node: GraphNode) => number): PackLayout; } size: { - (): Array; - (size: Array): PackLayout; + (): number[]; + (size: number[]): PackLayout; } padding: { (): number; @@ -1420,18 +1457,18 @@ declare module D3 { (comparator: (a: GraphNode, b: GraphNode) => number): PackLayout; } children: { - (): (d: any, i?: number) => Array; - (children: (d: any, i?: number) => Array): PackLayout; + (): (d: any, i?: number) => GraphNode[]; + (children: (d: any, i?: number) => GraphNode[]): PackLayout; } - nodes(root: GraphNode): Array; - links(nodes: Array): Array; + nodes(root: GraphNode): GraphNode[]; + links(nodes: GraphNode[]): GraphLink[]; value: { (): (node: GraphNode) => number; (value: (node: GraphNode) => number): PackLayout; } size: { - (): Array; - (size: Array): PackLayout; + (): number[]; + (size: number[]): PackLayout; } } @@ -1441,18 +1478,18 @@ declare module D3 { (comparator: (a: GraphNode, b: GraphNode) => number): TreeMapLayout; } children: { - (): (d: any, i?: number) => Array; - (children: (d: any, i?: number) => Array): TreeMapLayout; + (): (d: any, i?: number) => GraphNode[]; + (children: (d: any, i?: number) => GraphNode[]): TreeMapLayout; } - nodes(root: GraphNode): Array; - links(nodes: Array): Array; + nodes(root: GraphNode): GraphNode[]; + links(nodes: GraphNode[]): GraphLink[]; value: { (): (node: GraphNode) => number; (value: (node: GraphNode) => number): TreeMapLayout; } size: { - (): Array; - (size: Array): TreeMapLayout; + (): number[]; + (size: number[]): TreeMapLayout; } padding: { (): number; @@ -1479,7 +1516,7 @@ declare module D3 { /** * increase lightness by some exponential factor (gamma) */ - brighter(k: number): Color; + brighter(k?: number): Color; /** * decrease lightness by some exponential factor (gamma) */ @@ -1614,7 +1651,7 @@ declare module D3 { /** * The array of supported symbol types. */ - symbolTypes: Array; + symbolTypes: string[]; } export interface Symbol { @@ -1720,10 +1757,21 @@ declare module D3 { (): any[]; (values: any[]): Axis; }; - tickSubdivide(count: number): Axis; - tickSize(major?: number, minor?: number, end?: number): Axis; + tickSize: { + (): number; + (inner: number, outer?: number): Axis; + } + innerTickSize: { + (): number; + (value: number): Axis; + } + outerTickSize: { + (): number; + (value: number): Axis; + } tickFormat(formatter: (value: any) => string): Axis; + nice(count?: number): Axis; } export interface Arc { @@ -2418,9 +2466,9 @@ declare module D3 { export interface Diagonal { (datum: any, index?: number): string; projection: { - (): (datum: any, index?: number) => Array; - (proj: (datum: any) => Array): Diagonal; - (proj: (datum: any, index: number) => Array): Diagonal; + (): (datum: any, index?: number) => number[]; + (proj: (datum: any) => number[]): Diagonal; + (proj: (datum: any, index: number) => number[]): Diagonal; }; source: { (): (datum: any, index?: number) => any; @@ -2494,21 +2542,23 @@ declare module D3 { threshold(): ThresholdScale; } - export interface Scale { + export interface GenericScale { (value: any): any; domain: { - (values: any[]): Scale; + (values: any[]): S; (): any[]; }; range: { - (values: any[]): Scale; + (values: any[]): S; (): any[]; }; invertExtent?(y: any): any[]; - copy(): Scale; + copy(): S; } - export interface QuantitativeScale extends Scale { + export interface Scale extends GenericScale { } + + export interface GenericQuantitativeScale extends GenericScale { /** * Get the range value corresponding to a given domain value. * @@ -2522,60 +2572,33 @@ declare module D3 { */ invert(value: number): number; /** - * Get or set the scale's input domain. - */ - domain: { - /** - * Set the scale's input domain. - * - * @param value The input domain - */ - (values: any[]): QuantitativeScale; - /** - * Get the scale's input domain. - */ - (): any[]; - }; - /** - * get or set the scale's output range. - */ - range: { - /** - * Set the scale's output range. - * - * @param value The output range. - */ - (values: any[]): QuantitativeScale; - /** - * Get the scale's output range. - */ - (): any[]; - }; - /** * Set the scale's output range, and enable rounding. * * @param value The output range. */ - rangeRound: (values: any[]) => QuantitativeScale; + rangeRound: (values: any[]) => S; /** * get or set the scale's output interpolator. */ interpolate: { (): D3.Transition.Interpolate; - (factory: D3.Transition.Interpolate): QuantitativeScale; + (factory: D3.Transition.Interpolate): S; }; /** * enable or disable clamping of the output range. * * @param clamp Enable or disable */ - clamp(clamp: boolean): QuantitativeScale; + clamp: { + (): boolean; + (clamp: boolean): S; + } /** * extend the scale domain to nice round numbers. * * @param count Optional number of ticks to exactly fit the domain */ - nice(count?: number): QuantitativeScale; + nice(count?: number): S; /** * get representative values from the input domain. * @@ -2587,23 +2610,14 @@ declare module D3 { * * @param count Aproximate representative values to return */ - tickFormat(count: number): (n: number) => string; - /** - * create a new scale from an existing scale.. - */ - copy(): QuantitativeScale; + tickFormat(count: number, format?: string): (n: number) => string; } - export interface LinearScale extends QuantitativeScale { - /** - * Get the range value corresponding to a given domain value. - * - * @param value Domain Value - */ - (value: number): number; - } + export interface QuantitativeScale extends GenericQuantitativeScale { } - export interface IdentityScale extends Scale { + export interface LinearScale extends GenericQuantitativeScale { } + + export interface IdentityScale extends GenericScale { /** * Get the range value corresponding to a given domain value. * @@ -2630,132 +2644,31 @@ declare module D3 { tickFormat(count: number): (n: number) => string; } - export interface SqrtScale extends QuantitativeScale { - /** - * Get the range value corresponding to a given domain value. - * - * @param value Domain Value - */ - (value: number): number; - } + export interface SqrtScale extends GenericQuantitativeScale { } - export interface PowScale extends QuantitativeScale { - /** - * Get the range value corresponding to a given domain value. - * - * @param value Domain Value - */ - (value: number): number; - } + export interface PowScale extends GenericQuantitativeScale { } - export interface LogScale extends QuantitativeScale { - /** - * Get the range value corresponding to a given domain value. - * - * @param value Domain Value - */ - (value: number): number; - } + export interface LogScale extends GenericQuantitativeScale { } - export interface OrdinalScale extends Scale { - /** - * Get the range value corresponding to a given domain value. - * - * @param value Domain Value - */ - (value: any): any; - /** - * Get or set the scale's input domain. - */ - domain: { - /** - * Set the scale's input domain. - * - * @param value The input domain - */ - (values: any[]): OrdinalScale; - /** - * Get the scale's input domain. - */ - (): any[]; - }; - /** - * get or set the scale's output range. - */ - range: { - /** - * Set the scale's output range. - * - * @param value The output range. - */ - (values: any[]): OrdinalScale; - /** - * Get the scale's output range. - */ - (): any[]; - }; + export interface OrdinalScale extends GenericScale { rangePoints(interval: any[], padding?: number): OrdinalScale; rangeBands(interval: any[], padding?: number, outerPadding?: number): OrdinalScale; rangeRoundBands(interval: any[], padding?: number, outerPadding?: number): OrdinalScale; rangeBand(): number; rangeExtent(): any[]; - /** - * create a new scale from an existing scale.. - */ - copy(): OrdinalScale; } - export interface QuantizeScale extends Scale { - (value: any): any; - domain: { - (values: number[]): QuantizeScale; - (): any[]; - }; - range: { - (values: any[]): QuantizeScale; - (): any[]; - }; - copy(): QuantizeScale; - } + export interface QuantizeScale extends GenericScale { } - export interface ThresholdScale extends Scale { - (value: any): any; - domain: { - (values: number[]): ThresholdScale; - (): any[]; - }; - range: { - (values: any[]): ThresholdScale; - (): any[]; - }; - copy(): ThresholdScale; - } + export interface ThresholdScale extends GenericScale { } - export interface QuantileScale extends Scale { - (value: any): any; - domain: { - (values: number[]): QuantileScale; - (): any[]; - }; - range: { - (values: any[]): QuantileScale; - (): any[]; - }; + export interface QuantileScale extends GenericScale { quantiles(): any[]; - copy(): QuantileScale; } - export interface TimeScale extends Scale { + export interface TimeScale extends GenericScale { (value: Date): number; invert(value: number): Date; - domain: { - (values: any[]): TimeScale; - (): any[]; - }; - range: { - (values: any[]): TimeScale; - (): any[]; - }; rangeRound: (values: any[]) => TimeScale; interpolate: { (): D3.Transition.Interpolate; @@ -2767,7 +2680,7 @@ declare module D3 { (range: D3.Time.Range, count: number): any[]; }; tickFormat(count: number): (n: number) => string; - copy(): TimeScale; + nice(count?: number): TimeScale; } } @@ -2932,19 +2845,19 @@ declare module D3 { /** * compute the latitude-longitude bounding box for a given feature. */ - bounds(feature: any): Array>; + bounds(feature: any): number[][]; /** * compute the spherical centroid of a given feature. */ - centroid(feature: any): Array; + centroid(feature: any): number[]; /** * compute the great-arc distance between two points. */ - distance(a: Array, b: Array): number; + distance(a: number[], b: number[]): number; /** * interpolate between two points along a great arc. */ - interpolate(a: Array, b: Array): (t: number) => Array; + interpolate(a: number[], b: number[]): (t: number) => number[]; /** * compute the length of a line string or the circumference of a polygon. */ @@ -3057,7 +2970,7 @@ declare module D3 { /** * */ - rotation(rotation: Array): Rotation; + rotation(rotation: number[]): Rotation; } export interface Path { @@ -3131,11 +3044,11 @@ declare module D3 { } export interface Circle { - (...args: Array): GeoJSON; + (...args: any[]): GeoJSON; origin: { - (): Array; - (origin: Array): Circle; - (origin: (...args: Array) => Array): Circle; + (): number[]; + (origin: number[]): Circle; + (origin: (...args: any[]) => number[]): Circle; } angle: { (): number; @@ -3149,31 +3062,31 @@ declare module D3 { export interface Graticule{ (): GeoJSON; - lines(): Array; + lines(): GeoJSON[]; outline(): GeoJSON; extent: { - (): Array>; - (extent: Array>): Graticule; + (): number[][]; + (extent: number[][]): Graticule; } minorExtent: { - (): Array>; - (extent: Array>): Graticule; + (): number[][]; + (extent: number[][]): Graticule; } majorExtent: { - (): Array>; - (extent: Array>): Graticule; + (): number[][]; + (extent: number[][]): Graticule; } step: { - (): Array>; - (extent: Array>): Graticule; + (): number[][]; + (extent: number[][]): Graticule; } minorStep: { - (): Array>; - (extent: Array>): Graticule; + (): number[][]; + (extent: number[][]): Graticule; } majorStep: { - (): Array>; - (extent: Array>): Graticule; + (): number[][]; + (extent: number[][]): Graticule; } precision: { (): number; @@ -3199,33 +3112,33 @@ declare module D3 { } export interface GeoJSON { - coordinates: Array>; + coordinates: number[][]; type: string; } export interface RawProjection { - (lambda: number, phi: number): Array; - invert?(x: number, y: number): Array; + (lambda: number, phi: number): number[]; + invert?(x: number, y: number): number[]; } export interface Projection { - (coordinates: Array): Array; - invert?(point: Array): Array; + (coordinates: number[]): number[]; + invert?(point: number[]): number[]; rotate: { - (): Array; - (rotation: Array): Projection; + (): number[]; + (rotation: number[]): Projection; }; center: { - (): Array; - (location: Array): Projection; + (): number[]; + (location: number[]): Projection; }; parallels: { - (): Array; - (location: Array): Projection; + (): number[]; + (location: number[]): Projection; }; translate: { - (): Array; - (point: Array): Projection; + (): number[]; + (point: number[]): Projection; }; scale: { (): number; @@ -3236,8 +3149,8 @@ declare module D3 { (angle: number): Projection; }; clipExtent: { - (): Array>; - (extent: Array>): Projection; + (): number[][]; + (extent: number[][]): Projection; }; precision: { (): number; @@ -3256,8 +3169,8 @@ declare module D3 { } export interface Rotation extends Array { - (location: Array): Rotation; - invert(location: Array): Rotation; + (location: number[]): Rotation; + invert(location: number[]): Rotation; } export interface ProjectionMutator { @@ -3272,11 +3185,11 @@ declare module D3 { /** * compute the Voronoi diagram for the specified points. */ - voronoi(vertices: Array): Array; + voronoi(vertices: Vertice[]): Polygon[]; /** * compute the Delaunay triangulation for the specified points. */ - delaunay(vertices?: Array): Array; + delaunay(vertices?: Vertice[]): Polygon[]; /** * constructs a quadtree for an array of points. */ @@ -3284,21 +3197,21 @@ declare module D3 { /** * Constructs a new quadtree for the specified array of points. */ - quadtree(points: Array, x1: number, y1: number, x2: number, y2: number): Quadtree; + quadtree(points: Point[], x1: number, y1: number, x2: number, y2: number): Quadtree; /** * Constructs a new quadtree for the specified array of points. */ - quadtree(points: Array, width: number, height: number): Quadtree; + quadtree(points: Point[], width: number, height: number): Quadtree; /** * Returns the input array of vertices with additional methods attached */ - polygon(vertices:Array): Polygon; + polygon(vertices:Vertice[]): Polygon; /** * creates a new hull layout with the default settings. */ hull(): Hull; - hull(vertices:Array): Array; + hull(vertices:Vertice[]): Vertice[]; } export interface Vertice extends Array { @@ -3316,7 +3229,7 @@ declare module D3 { /** * Returns a two-element array representing the centroid of this polygon. */ - centroid(): Array; + centroid(): number[]; /** * Clips the subject polygon against this polygon */ @@ -3331,11 +3244,11 @@ declare module D3 { /** * Constructs a new quadtree for the specified array of points. */ - (points: Array, x1: number, y1: number, x2: number, y2: number): Quadtree; + (points: Point[], x1: number, y1: number, x2: number, y2: number): Quadtree; /** * Constructs a new quadtree for the specified array of points. */ - (points: Array, width: number, height: number): Quadtree; + (points: Point[], width: number, height: number): Quadtree; x: { (): (d: any) => any; @@ -3347,10 +3260,10 @@ declare module D3 { (accesor: (d: any) => any): QuadtreeFactory; } - size(): Array; - size(size: Array): QuadtreeFactory; - extent(): Array>; - extent(points: Array>): QuadtreeFactory; + size(): number[]; + size(size: number[]): QuadtreeFactory; + extent(): number[][]; + extent(points: number[][]): QuadtreeFactory; } export interface Quadtree { @@ -3370,15 +3283,15 @@ declare module D3 { /** * Compute the Voronoi diagram for the specified data. */ - (data: Array): Array; + (data: T[]): Polygon[]; /** * Compute the graph links for the Voronoi diagram for the specified data. */ - links(data: Array): Array; + links(data: T[]): Layout.GraphLink[]; /** * Compute the triangles for the Voronoi diagram for the specified data. */ - triangles(data: Array): Array>; + triangles(data: T[]): number[][]; x: { /** * Get the x-coordinate accessor. @@ -3423,30 +3336,30 @@ declare module D3 { /** * Get the clip extent. */ - (): Array>; + (): number[][]; /** * Set the clip extent. * * @param extent The new clip extent. */ - (extent: Array>): Voronoi; + (extent: number[][]): Voronoi; } size: { /** * Get the size. */ - (): Array; + (): number[]; /** * Set the size, equivalent to a clip extent starting from (0,0). * * @param size The new size. */ - (size: Array): Voronoi; + (size: number[]): Voronoi; } } export interface Hull { - (vertices: Array): Array; + (vertices: Vertice[]): Vertice[]; x: { (): (d: any) => any; (accesor: (d: any) => any): any; @@ -3460,3 +3373,7 @@ declare module D3 { } declare var d3: D3.Base; + +declare module "d3" { + export = d3; +} diff --git a/d3/plugins/d3.superformula-tests.ts.tscparams b/d3/plugins/d3.superformula-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/d3/plugins/d3.superformula-tests.ts.tscparams +++ b/d3/plugins/d3.superformula-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/dhtmlxgantt/dhtmlxgantt-tests.ts.tscparams b/dhtmlxgantt/dhtmlxgantt-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/dhtmlxgantt/dhtmlxgantt-tests.ts.tscparams +++ b/dhtmlxgantt/dhtmlxgantt-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/dhtmlxgantt/dhtmlxgantt.d.ts.tscparams b/dhtmlxgantt/dhtmlxgantt.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/dhtmlxgantt/dhtmlxgantt.d.ts.tscparams +++ b/dhtmlxgantt/dhtmlxgantt.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/dhtmlxscheduler/dhtmlxscheduler-tests.ts.tscparams b/dhtmlxscheduler/dhtmlxscheduler-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/dhtmlxscheduler/dhtmlxscheduler-tests.ts.tscparams +++ b/dhtmlxscheduler/dhtmlxscheduler-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/dhtmlxscheduler/dhtmlxscheduler.d.ts.tscparams b/dhtmlxscheduler/dhtmlxscheduler.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/dhtmlxscheduler/dhtmlxscheduler.d.ts.tscparams +++ b/dhtmlxscheduler/dhtmlxscheduler.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/domo/domo-tests.ts.tscparams b/domo/domo-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/domo/domo-tests.ts.tscparams +++ b/domo/domo-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/dropboxjs/dropboxjs-tests.ts b/dropboxjs/dropboxjs-tests.ts index cf5fd3827..ad8e608a4 100644 --- a/dropboxjs/dropboxjs-tests.ts +++ b/dropboxjs/dropboxjs-tests.ts @@ -2,18 +2,18 @@ var browserClient = new Dropbox.Client({ key: "your-key-here" }); -browserClient.authenticate(function (error, client) { +browserClient.authenticate((error:any, client:Dropbox.Client) => { if (error) { alert(error); } - client.onError.addListener(function (error) { - if (window.console) { // Skip the "if" in node.js code. + client.onError.addListener((error:any) =>{ + if (window['console']) { // Skip the "if" in node.js code. console.error(error); } }); - client.getAccountInfo(function (error, accountInfo) { + client.getAccountInfo( (error:Dropbox.ApiError, accountInfo:Dropbox.AccountInfo) => { if (error) { alert(error); // Something went wrong. } @@ -21,7 +21,7 @@ browserClient.authenticate(function (error, client) { alert("Hello, " + accountInfo.name + "!"); }); - client.writeFile("hello_world.txt", "Hello, world!\n", function (error, stat) { + client.writeFile("hello_world.txt", "Hello, world!\n", (error:Dropbox.ApiError, stat:Dropbox.File.Stat ) => { if (error) { alert(error); // Something went wrong. } @@ -29,7 +29,7 @@ browserClient.authenticate(function (error, client) { alert("File saved as revision " + stat.versionTag); }); - client.readFile("hello_world.txt", function (error, data) { + client.readFile("hello_world.txt", (error:Dropbox.ApiError, data:string) => { if (error) { alert(error); // Something went wrong. } @@ -37,12 +37,12 @@ browserClient.authenticate(function (error, client) { alert(data); // data has the file's contents }); - client.readdir("/", function (error, entries) { + client.readdir("/", (err: Dropbox.ApiError, filenames: string[], stat: Dropbox.File.Stat, folderEntries: Dropbox.File.Stat[]) => { if (error) { alert(error); // Something went wrong. } - alert("Your Dropbox contains " + entries.join(", ")); + alert("Your Dropbox contains " + filenames.join(", ")); }); }); @@ -51,4 +51,4 @@ var serverClient = new Dropbox.Client({ secret: "your-secret-here" }); -serverClient.authDriver(new Dropbox.AuthDriver.NodeServer(8191)); \ No newline at end of file +serverClient.authDriver(new Dropbox.AuthDriver.NodeServer({port:8191})); \ No newline at end of file diff --git a/dropboxjs/dropboxjs.d.ts b/dropboxjs/dropboxjs.d.ts index a718fabaf..f9a2c9a40 100644 --- a/dropboxjs/dropboxjs.d.ts +++ b/dropboxjs/dropboxjs.d.ts @@ -1,15 +1,368 @@ // Type definitions for dropbox-js // Project: https://github.com/dropbox/dropbox-js -// Definitions by: Steve Fenton +// Definitions by: Steve Fenton , Pedro Casaubon // Definitions: https://github.com/borisyankov/DefinitelyTyped + declare module Dropbox { - export interface DropboxConfig { + + + interface QueryParams { + [key: string]: any; + } + interface Credentials { key: string; secret?: string; + token?: string; + uid?: string; } - export interface AccountInfoData { + + /* Callbacks */ + + interface AuthenticateCallback { + (err: ApiError, client: Client): void; + (err: AuthError, client: Client): void; + } + + interface QueryParamsCallback { + (queryParams: QueryParams): void; + } + + interface ClientFileReadCallback { + + (err: ApiError, fileContents: string, stat: File.Stat, rangeInfo: Http.RangeInfo): void; + } + + interface ClientFileWriteCallback { + + (err: ApiError, stat: File.Stat): void; + } + + interface ResumableUploadStepCallback { + (err: ApiError, uploadCursor: Http.UploadCursor): void; + } + + interface ReadThumbnailCallback { + (err: ApiError, imageData: string, stat: File.Stat): void; + (err: ApiError, imageData: Blob, stat: File.Stat): void; + } + + interface FileStatCallback { + (err: ApiError, stat: File.Stat): void; + } + + /* Options */ + + interface AuthenticateOptions { + interactive: boolean; + } + + interface SingOutOptions { + mustInvalidate: boolean; + } + + interface AccountInfoOptions { + httpCache: boolean; + } + + interface ClientFileReadOptions { + + versionTag?: string; + rev?: string; + arrayBuffer?: boolean; + blob?: boolean; + buffer?: boolean; + binary?: boolean; + length?: number; + start?: number; + httpCache?: boolean; + } + + interface ClientFileWriteOptions { + lastVersionTag?: string; + parentRev?: string; + noOverwrite?: boolean; + } + + interface ReadDirOptions { + removed?: boolean; + deleted?: boolean; + limit?: any; + versionTag?: string; + contentHash?: string; + httpCache?: boolean; + } + + interface MakeURLOptions { + download?: boolean; + downloadHack?: boolean; + long?: boolean; + longUrl?: boolean; + } + + interface HistoryOptions { + limit?: number; + httpCache?: boolean; + + } + + interface ThumbnailUrlOptions { + png?: boolean; + format?: string; + size?: string; + } + + interface ReadThumbnailOptions extends ThumbnailUrlOptions { + arrayBuffer?: boolean; + blob?: boolean; + buffer?: boolean; + } + + interface FindByNameOptions { + limit?: number; + removed?: boolean; + deleted?: boolean; + httpCache?: boolean; + + } + + interface RedirectOptions { + redirectUrl?: string; + redirectFile?: string; + scope?: string; + rememberUser?: boolean; + } + + module Util { + + class EventSource { + constructor(options: { cancelable: boolean }); + addListener(listener: (event: any) => void): EventSource; + removeListener(listener: (event: any) => void): EventSource; + dispatch(event: {}): boolean; + } + + class Oauth { + static queryParamsFromUrl(url: string): QueryParams; + static randomAuthStateParam(): string; + checkAuthStateParam(stateParam: string): boolean; + } + + class Xhr { + xhr: XMLHttpRequest; + onError: (error: ApiError, callBack: (error: ApiError) => void) => void; + + constructor(method: string, baseUrl: string); + static urlEncode(obj: {}): string; + static urlEncodeValue(obj: {}): string; + static urlDecode(string: {}): QueryParams; + + + setParams(params: QueryParams): Xhr; + setCallback(callback: (err: ApiError, responseType: string, metadataHeader: {}, headers: {}) => void): Xhr; + signWithOauth(oauth: Oauth, cacheFriendly: boolean): Xhr; + addOauthParams(oauth: Oauth): Xhr; + addOauthHeader(oauth: Oauth): Xhr; + + setBody(body: string): Xhr; + setBody(body: Blob): Xhr; + setBody(body: ArrayBuffer): Xhr; + + setResponseType(responseType: string): Xhr; + setHeader(headerName: string, value: string): Xhr; + reportResponseHeaders(): Xhr; + setFileField(fieldName: string, fileName: string, fileData: string, contentType?: string): void; + setFileField(fieldName: string, fileName: string, fileData: Blob, contentType?: string): void; + setFileField(fieldName: string, fileName: string, fileData: File, contentType?: string): void; + prepare(): Xhr; + send(callback: (err: ApiError, responseType: string, metadataHeader: {}) => void): Xhr; + onReadyStateChange(): void; + onXdrLoad(): void; + onXdrError(): void; + } + } + module Http { + class AppInfo { + static ICON_SMALL: number; + static ICON_LARGE: number; + static parse(appInfo: {}, appKey?: string): AppInfo; + name: string; + key: string; + canUseDatastores: boolean; + canUseFiles: boolean; + hasAppFolder: boolean; + canUseFullDropbox: boolean; + icon(width: number, height?: number): void; + } + + class PollResult { + static parse(response: {}): PollResult; + hasChanges: boolean; + retryAfter: number; + } + + class PulledChanges { + static parse(deltaInfo: {}): PulledChanges; + blankSlate: boolean; + cursorTag: string; + shouldPullAgain: boolean; + shouldBackOff: boolean; + cursor(): string; + } + + class PulledChange { + static parse(entry: {}): PulledChange; + path: string; + wasRemoved: boolean; + stat: File.Stat; + } + + class RangeInfo { + static parse(headerValue: string): RangeInfo; + start: number; + size: number; + end: number; + } + + class UploadCursor { + static parse(cursorData: string): UploadCursor; + static parse(cursorData: {}): UploadCursor; + constructor(cursorData: string); + constructor(cursorData: {}); + tag: string; + offset: number; + expiresAt: Date; + toJSON(): {}; + } + } + module File { + + interface StatOptions { + version: number; + removed: boolean; + deleted: boolean; + readDir: boolean; + versionTag: string; + rev: string; + contentHash: string; + hash: string; + httpCache: boolean; + } + + class ShareUrl { + static parse(urlData: string, isDirect: boolean): ShareUrl; + static parse(urlData: {}, isDirect: boolean): ShareUrl; + url: string; + expiresAt: Date; + isDirect: boolean; + isPreview: boolean; + toJSON(): {}; + } + + class CopyReference { + static parse(refData: string): CopyReference; + static parse(refData: {}): CopyReference; + tag: string; + expiresAt: Date; + toJSON(): {}; + } + + class Stat { + static parse(metadata: {}): Stat; + path: string; + name: string; + inAppFolder: boolean; + isFolder: boolean; + isFile: boolean; + isRemoved: boolean; + typeIcon: string; + versionTag: string; + contentHash: string; + mimeType: string; + size: number; + humanSize: string; + hasThumbnail: boolean; + modifiedAt: Date; + clientModifiedAt: Date; + toJSON(): {}; + } + } + module AuthDriver { + + /** Do not use class! TypeScript definition implementation detail : https://github.com/Microsoft/TypeScript/issues/371 */ + class IAuthDriver { + doAuthorize(authUrl: string, stateParam: string, client: Client, callback?: QueryParamsCallback): void; + } + + class BrowserBase { + static localStorage(): Storage; + static currentLocation(): string; + static cleanupLocation(): void; + + constructor(options: { scope: string; rememberUser: boolean }); + authType(): string; + onAuthStepChange(client: Client, callback: () => void): void; + locationStateParam(url: string): string; + } + + class Redirect { + constructor(options?: { redirectUrl: string; redirectFile: string; scope: string; rememberUser: boolean }); + url(): string; + doAuthorize(authUrl: string, stateParam: string, client: Client): void; + resumeAuthorize(stateParam: string, client: Client, callback: QueryParamsCallback): void; + + } + + class Popup extends IAuthDriver { + static locationOrigin(location: string): string; + static oauthReceiver(): void; + constructor(options?: RedirectOptions); + url(): string; + + } + + class ChromeApp extends IAuthDriver { + constructor(options?: { scope: string }); + } + + class ChromeExtension extends IAuthDriver { + static oauthReceiver(): void; + constructor(options?: { scope: string; receiverPath: string }); + } + + class Cordova extends IAuthDriver { + static oauthReceiver(): void; + constructor(options?: { scope: string; receiverPath: string }); + url(): string; + } + + class NodeServer extends IAuthDriver { + constructor(options?: { port: number; tls?: {} }); + authType(): string; + url(): string; + openBrowser(url: string): void; + createApp(): void; + closeServer(): void; + + // TODO check request response types + doRequest(request:any, response:any): void; + closeBrowser(response:any): void; + } + } + + + class AuthDriver { + authType(): string; + url(): string; + doAuthorize(authUrl: string, stateParam: string, client: Client, callback: QueryParamsCallback): void; + getStateParam(client: Client, callback: (state: string) => void): void; + resumeAuthorize(stateParam: string, client: Client, callback: QueryParamsCallback): void; + onAuthStepChange(client: Client, callback: () => void): void; + } + + class AccountInfo { + static parse(acountInfo: {}): AccountInfo; name: string; email: string; countryCode: string; @@ -20,82 +373,136 @@ declare module Dropbox { usedQuota: number; privateBytes: number; sharedBytes: number; + json(): {}; } - export interface AccountInfo extends AccountInfoData { - parse(accountInfo: string): AccountInfo; - json(): AccountInfoData; + class ApiError { + status: number; + method: string; + url: string; + responseText: string; + response: {}; + + constructor(xhr: XMLHttpRequest, method: string, url: string); + + static NETWORK_ERROR: number; + static NO_CONTENT: number; + static INVALID_PARAM: number; + static INVALID_TOKEN: number; + static OAUTH_ERROR: number; + static NOT_FOUND: number; + static INVALID_METHOD: number; + static NOT_ACCEPTABLE: number; + static CONFLICT: number; + static RATE_LIMITED: number; + static SERVER_ERROR: number; + static OVER_QUOTA: number; } - export interface ApiError { - INVALID_TOKEN: number; - NOT_FOUND: number; - OVER_QUOTA: number; - RATE_LIMITED: number; - NETWORK_ERROR: number; - INVALID_PARAM: number; - OAUTH_ERROR: number; - INVALID_METHOD: number; + class AuthError { + + code: string; + description: string; + uri: string; + constructor(queryString: QueryParams); + + static ACCESS_DENIED: string; + static INVALID_REQUEST: string; + static UNAUTHORIZED_CLIENT: string; + static INVALID_GRANT: string; + static INVALID_SCOPE: string; + static UNSUPPORTED_GRANT_TYPE: string; + static UNSUPPORTED_RESPONSE_TYPE: string; + static SERVER_ERROR: string; + static TEMPORARILY_UNAVAILABLE: string; } - export interface FileStatisticsData { - path: string; - name: string; - inAppFolder: boolean; - isFolder: boolean; - isFile: boolean; - isRemoved: boolean; - typeIcon: string; - versionTag: string; - contentHash: string; - mimeType: string; - size: number; - humanSize: string; - hasThumbnail: boolean; - modifiedAt: Date; - clientModifiedAt: Date; - } + class Client { + static ERROR: number; + static RESET: number; + static PARAM_SET: number; + static PARAM_LOADED: number; + static AUTHORIZED: number; + static DONE: number; + static SIGNED_OUT: number; - export interface FileStatistics extends FileStatisticsData { - parse(stats: string): FileStatistics; - json(): FileStatisticsData; - } + onXhr: Util.EventSource; + onError: Util.EventSource; + onAuthStepChange: Util.EventSource; + authStep: number; - export interface ClientOnError { - addListener(callback: (error: number) => any): void; - } - - export interface Client { - new (config: DropboxConfig): Client; - authDriver(authDriver: any): Client; - authenticate(callback: (error: number, client: Client) => any): Client; - credentials(): string; + constructor(options: Credentials); + authDriver(driver: AuthDriver.IAuthDriver): Client; dropboxUid(): string; + credentials(): Credentials; + + // TODO check the error interface + authenticate(): Client; + authenticate(callback: AuthenticateCallback): Client; + authenticate(options: AuthenticateOptions): Client; + authenticate(options: AuthenticateOptions, callback: AuthenticateCallback): Client; isAuthenticated(): boolean; - onError: ClientOnError; - getAccountInfo(callback: (error: number, accountInfo: AccountInfo) => any): XMLHttpRequest; - getUserInfo(callback: (error: number, accountInfo: AccountInfo) => any): XMLHttpRequest; - signOut(options: {}, callback: (error: number) => any): XMLHttpRequest; - signOff(options: {}, callback: (error: number) => any): XMLHttpRequest; - writeFile(fileName: string, contents: string, options: {}, callback: (error: number, stats: FileStatistics) => any): XMLHttpRequest; - writeFile(fileName: string, contents: string, callback: (error: number, stats: FileStatistics) => any): XMLHttpRequest; - readFile(fileName: string, options: {}, callback: (error: number, contents: string, stats: FileStatistics) => any): XMLHttpRequest; - readFile(fileName: string, callback: (error: number, contents: string, stats: FileStatistics) => any): XMLHttpRequest; - stat(path: string, options: {}, callback: (error: number, stats: FileStatistics) => any): XMLHttpRequest; - stat(path: string, callback: (error: number, stats: FileStatistics) => any): XMLHttpRequest; - metadata(path: string, options: {}, callback: (error: number, stats: FileStatistics) => any): XMLHttpRequest; - metadata(path: string, callback: (error: number, stats: FileStatistics) => any): XMLHttpRequest; - readdir(path: string, options: {}, callback: (error: number, entries: any[]) => any): XMLHttpRequest; - readdir(path: string, callback: (error: number, entries: any[]) => any): XMLHttpRequest; + signOut(callback: (err: ApiError) => void): XMLHttpRequest; + signOut(options: SingOutOptions, callback: (err: ApiError) => void): XMLHttpRequest; + signOff(callback: (err: ApiError) => void): void; + signOff(options: SingOutOptions, callback: (err: ApiError) => void): void; + getAccountInfo(callback: (err: ApiError, accountInfo: AccountInfo, AccountInfo: AccountInfo) => void): XMLHttpRequest; + getAccountInfo(options: AccountInfoOptions, callback: (err: ApiError, accountInfo: AccountInfo, AccountInfo: AccountInfo) => void): XMLHttpRequest; + readFile(path: string, callback: ClientFileReadCallback): XMLHttpRequest; + readFile(path: string, options: ClientFileReadOptions, callback: ClientFileReadCallback): XMLHttpRequest; + writeFile(path: string, data: any, callback: ClientFileWriteCallback): XMLHttpRequest; + writeFile(path: string, data: any, options: ClientFileWriteOptions, callback: ClientFileWriteCallback): XMLHttpRequest; + resumableUploadStep(data: any, callback: ResumableUploadStepCallback): XMLHttpRequest; + resumableUploadStep(data: any, cursor: Http.UploadCursor, callback: ResumableUploadStepCallback): XMLHttpRequest; + resumableUploadFinish(path: string, cursor: Http.UploadCursor, callback: ClientFileWriteCallback): XMLHttpRequest; + resumableUploadFinish(path: string, cursor: Http.UploadCursor, options: ClientFileWriteOptions, callback: ClientFileWriteCallback): XMLHttpRequest; + stat(path: string, callback: (err: ApiError, stat: File.Stat, folderEntries: File.Stat[]) => void): XMLHttpRequest; + stat(path: string, options: File.StatOptions, callback: (err: ApiError, stat: File.Stat, folderEntries: File.Stat[]) => void): XMLHttpRequest; + readdir(path: string, callback: (err: ApiError, filenames: string[], stat: File.Stat, folderEntries: File.Stat[]) => void): XMLHttpRequest; + readdir(path: string, options: ReadDirOptions, callback: (err: ApiError, filenames: string[], stat: File.Stat, folderEntries: File.Stat[]) => void): XMLHttpRequest; + metadata(path: string, callback: (err: ApiError, stat: File.Stat, folderEntries: File.Stat[]) => void): void; + metadata(path: string, options: File.StatOptions, callback: (err: ApiError, stat: File.Stat, folderEntries: File.Stat[]) => void): void; + makeUrl(path: string, callback: (err: ApiError, shareUrl: File.ShareUrl) => void): XMLHttpRequest; + makeUrl(path: string, options: MakeURLOptions, callback: (err: ApiError, shareUrl: File.ShareUrl) => void): XMLHttpRequest; + history(path: string, callback: (err: ApiError, fileVersions: File.Stat[]) => void): XMLHttpRequest; + history(path: string, options: HistoryOptions, callback: (err: ApiError, fileVersions: File.Stat[]) => void): XMLHttpRequest; + revisions(path: string, options: HistoryOptions, callback: (err: ApiError, fileVersions: File.Stat[]) => void): void; + thumbnailUrl(path: string, options?: ThumbnailUrlOptions): string; + readThumbnail(path: string, callback: ReadThumbnailCallback): XMLHttpRequest; + readThumbnail(path: string, options: ReadThumbnailOptions, callback: ReadThumbnailCallback): XMLHttpRequest; + revertFile(path: string, versionTag: string, callback: FileStatCallback): XMLHttpRequest; + restore(path: string, versionTag: string, callback: FileStatCallback): void; + findByName(path: string, namePattern: string, callback: (err: ApiError, resultStats: File.Stat[]) => void): XMLHttpRequest; + findByName(path: string, namePattern: string, options: FindByNameOptions, callback: (err: ApiError, resultStats: File.Stat[]) => void): XMLHttpRequest; + search(path: string, namePattern: string, options: FindByNameOptions, callback: (err: ApiError, resultStats: File.Stat[]) => void): void; + makeCopyReference(path: string, callback: (err: ApiError, copyReference: File.CopyReference) => void): XMLHttpRequest; + copyRef(path: string, callback: (err: ApiError, copyReference: File.CopyReference) => void): XMLHttpRequest; + pullChanges(callback: (err: ApiError, changes: Http.PulledChanges) => void): XMLHttpRequest; + pullChanges(cursor: string, callback: (err: ApiError, changes: Http.PulledChanges) => void): XMLHttpRequest; + pullChanges(cursor: Http.PulledChanges, callback: (err: ApiError, changes: Http.PulledChanges) => void): XMLHttpRequest; + delta(cursor: string, callback: (err: ApiError, changes: Http.PulledChanges) => void): void; + delta(cursor: Http.PulledChanges, callback: (err: ApiError, changes: Http.PulledChanges) => void): void; + pollForChanges(cursor: string, options: {}, callback: (err: ApiError, changes: Http.PollResult) => void): void; + pollForChanges(cursor: Http.PulledChanges, options: {}, callback: (err: ApiError, changes: Http.PollResult) => void): void; + mkdir(path: string, callback: FileStatCallback): XMLHttpRequest; + remove(path: string, callback: FileStatCallback): XMLHttpRequest; + unlink(path: string, callback: FileStatCallback): void; + delete(path: string, callback: FileStatCallback): void; + copy(from: string, toPath: string, callback: FileStatCallback): XMLHttpRequest; + copy(from: File.CopyReference, toPath: string, callback: FileStatCallback): XMLHttpRequest; + move(fromPath: string, toPath: string, callback: FileStatCallback): XMLHttpRequest; + appInfo(callback: (err: ApiError, changes: Http.AppInfo) => void): XMLHttpRequest; + appInfo(appKey: string, callback: (err: ApiError, changes: Http.AppInfo) => void): XMLHttpRequest; + + // TODO check if this can better be described + isAppDeveloper(userId:any, callbackcallback: (err: ApiError, isAppDeveloper: boolean) => void): XMLHttpRequest; + isAppDeveloper(userId:any, appKey:any, callbackcallback: (err: ApiError, isAppDeveloper: boolean) => void): XMLHttpRequest; + hasOauthRedirectUri(redirectUri: string, callback: (err: ApiError, hasOauthRedirectUri: boolean) => void): XMLHttpRequest; + hasOauthRedirectUri(redirectUri: string, appKey: string, callback: (err: ApiError, hasOauthRedirectUri: boolean) => void): XMLHttpRequest; + hasOauthRedirectUri(redirectUri: string, appKey: Http.AppInfo, callback: (err: ApiError, hasOauthRedirectUri: boolean) => void): XMLHttpRequest; + reset(): Client; + setCredentials(credentials: Credentials): Client; + appHash(): string; + } - - export module AuthDriver { - export interface NodeServer { - new (port: number): any; - } - - export var NodeServer: NodeServer; - } - - export var Client: Client; } diff --git a/dropzone/dropzone.d.ts b/dropzone/dropzone.d.ts index 81596d88a..5dca7e169 100644 --- a/dropzone/dropzone.d.ts +++ b/dropzone/dropzone.d.ts @@ -72,6 +72,22 @@ declare class Dropzone { getRejectedFiles(): DropzoneFile[]; getQueuedFiles(): DropzoneFile[]; getUploadingFiles(): DropzoneFile[]; + + emit(eventName: string, file: DropzoneFile, str?: string); + emit(eventName: "thumbnail", file: DropzoneFile, path: string); + emit(eventName: "addedfile", file: DropzoneFile); + emit(eventName: "removedfile", file: DropzoneFile); + emit(eventName: "processing", file: DropzoneFile); + emit(eventName: "canceled", file: DropzoneFile); + emit(eventName: "complete", file: DropzoneFile); + + emit(eventName: string, e: Event); + emit(eventName: "drop", e: Event); + emit(eventName: "dragstart", e: Event); + emit(eventName: "dragend", e: Event); + emit(eventName: "dragenter", e: Event); + emit(eventName: "dragover", e: Event); + emit(eventName: "dragleave", e: Event); } interface JQuery { diff --git a/dropzone/dropzone.d.ts.tscparams b/dropzone/dropzone.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/dropzone/dropzone.d.ts.tscparams +++ b/dropzone/dropzone.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/durandal/durandal-1.x.d.ts.tscparams b/durandal/durandal-1.x.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/durandal/durandal-1.x.d.ts.tscparams +++ b/durandal/durandal-1.x.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/durandal/durandal.d.ts.tscparams b/durandal/durandal.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/durandal/durandal.d.ts.tscparams +++ b/durandal/durandal.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/dustjs-linkedin/dustjs-linkedin-tests.ts.tscparams b/dustjs-linkedin/dustjs-linkedin-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/dustjs-linkedin/dustjs-linkedin-tests.ts.tscparams +++ b/dustjs-linkedin/dustjs-linkedin-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/dustjs-linkedin/dustjs-linkedin.d.ts.tscparams b/dustjs-linkedin/dustjs-linkedin.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/dustjs-linkedin/dustjs-linkedin.d.ts.tscparams +++ b/dustjs-linkedin/dustjs-linkedin.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ember/ember-tests.ts.tscparams b/ember/ember-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ember/ember-tests.ts.tscparams +++ b/ember/ember-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/ember/ember.d.ts b/ember/ember.d.ts index 2a0b35e42..878d8a49c 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -11,12 +11,15 @@ declare var Handlebars: HandlebarsStatic; declare module EmberStates { interface Transition { + abort(): void; addInitialStates(): void; matchContextsToStates(contexts: any[]): void; normalize(manager: Ember.StateManager, contexts: any[]): void; removeUnchangedContexts(manager: Ember.StateManager): void; + retry(): void; sendEvents(eventName: string, sendRecursiveArguments: boolean, isUnhandledPass: boolean): void; sendRecursively(event: string, currentState: Ember.State, isUnhandledPass: boolean): void; + targetName: string; } } @@ -38,10 +41,10 @@ declare module EmberTesting { } interface Function { - observes(...string): Function; - observesBefore(...string): Function; - on(...string): Function; - property(...string): Function; + observes(...args: string[]): Function; + observesBefore(...args: string[]): Function; + on(...args: string[]): Function; + property(...args: string[]): Function; } interface String { @@ -50,9 +53,9 @@ interface String { classify(): string; dasherize(): string; decamelize(): string; - fmt(...string): string; + fmt(...args: string[]): string; htmlSafe(): typeof Handlebars.SafeString; - loc(...string): string; + loc(...args: string[]): string; underscore(): string; w(): string[]; } @@ -70,14 +73,14 @@ interface Array { clear(): any[]; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Ember.Enumerable); - enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: Ember.Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Ember.Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Ember.Enumerable); - enumerableContentDidChange(removing: Ember.Enumerable, adding: Ember.Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Ember.Enumerable): any; + enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: Ember.Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Ember.Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Ember.Enumerable): any; + enumerableContentDidChange(removing: Ember.Enumerable, adding: Ember.Enumerable): any; enumerableContentWillChange(removing: number, adding: number): any[]; enumerableContentWillChange(removing: Ember.Enumerable, adding: number): any[]; enumerableContentWillChange(removing: number, adding: Ember.Enumerable): any[]; @@ -93,15 +96,15 @@ interface Array { getEach(key: string): any[]; indexOf(object: any, startAt: number): number; insertAt(idx: number, object: any): any[]; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; lastIndexOf(object: any, startAt: number): number; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; objectAt(idx: number): any; - objectsAt(...number): any[]; + objectsAt(...args: number[]): any[]; popObject(): any; pushObject(obj: any): any; - pushObjects(...any): any[]; + pushObjects(...args: any[]): any[]; reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; reject: ItemIndexEnumerableCallbackTarget; rejectBy(key: string, value?: string): any[]; @@ -136,7 +139,7 @@ interface Array { decrementProperty(keyName: string, decrement?: number): number; endPropertyChanges(): any[]; get(keyName: string): any; - getProperties(...string): {}; + getProperties(...args: string[]): {}; getProperties(keys: string[]): {}; getWithDefault(keyName: string, defaultValue: any): any; hasObserverFor(key: string): boolean; @@ -190,8 +193,8 @@ interface CoreObjectArguments { } interface EnumerableConfigurationOptions { - willChange? ; - didChange? ; + willChange?: boolean ; + didChange?: boolean ; } interface ItemIndexEnumerableCallbackTarget { @@ -365,14 +368,14 @@ declare module Ember { someProperty(key: string, value?: string): boolean; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Enumerable); - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Enumerable); - enumerableContentDidChange(removing: Enumerable, adding: Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; enumerableContentWillChange(removing: number, adding: number): Enumerable; enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; @@ -387,13 +390,13 @@ declare module Ember { forEach(callback: Function, target?: any): any; getEach(key: string): any[]; indexOf(object: any, startAt: number): number; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; lastIndexOf(object: any, startAt: number): number; map: ItemIndexEnumerableCallbackTarget; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; objectAt(idx: number): any; - objectsAt(...number): any[]; + objectsAt(...args: number[]): any[]; reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; reject: ItemIndexEnumerableCallbackTarget; rejectBy(key: string, value?: string): any[]; @@ -405,9 +408,9 @@ declare module Ember { toArray(): any[]; uniq(): Enumerable; without(value: any): Enumerable; - '@each': EachProxy; + '@each': EachProxy; Boolean: boolean; - '[]': any[]; + '[]': any[]; firstObject: any; hasEnumerableObservers: boolean; lastObject: any; @@ -438,8 +441,8 @@ declare module Ember { sortAscending: boolean; sortFunction: Comparable; sortProperties: any[]; - replaceRoute(name: string, ...any); - transitionToRoute(name: string, ...any); + replaceRoute(name: string, ...args: any[]): void; + transitionToRoute(name: string, ...args: any[]): void; controllers: {}; needs: string[]; target: any; @@ -482,14 +485,14 @@ declare module Ember { clear(): any[]; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Enumerable); - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Enumerable); - enumerableContentDidChange(removing: Enumerable, adding: Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; enumerableContentWillChange(removing: number, adding: number): any[]; enumerableContentWillChange(removing: Enumerable, adding: number): any[]; enumerableContentWillChange(removing: number, adding: Enumerable): any[]; @@ -505,24 +508,24 @@ declare module Ember { getEach(key: string): any[]; indexOf(object: any, startAt: number): number; insertAt(idx: number, object: any): any[]; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; lastIndexOf(object: any, startAt: number): number; map: ItemIndexEnumerableCallbackTarget; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; objectAt(idx: number): any; objectAtContent(idx: number): any; - objectsAt(...number): any[]; + objectsAt(...args: number[]): any[]; popObject(): any; pushObject(obj: any): any; - pushObjects(...any): any[]; + pushObjects(...args: any[]): any[]; reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; reject: ItemIndexEnumerableCallbackTarget; rejectBy(key: string, value?: string): any[]; removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[]; removeAt(start: number, len: number): any; removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): any[]; - replace(idx: number, amt: number, objects: any[]); + replace(idx: number, amt: number, objects: any[]): any; replaceContent(idx: number, amt: number, objects: any[]): void; reverseObjects(): any[]; setEach(key: string, value?: any): any; @@ -535,8 +538,8 @@ declare module Ember { unshiftObject(object: any): any; unshiftObjects(objects: any[]): any[]; without(value: any): any[]; - '[]': any[]; - '@each': EachProxy; + '[]': any[]; + '@each': EachProxy; Boolean: boolean; firstObject: any; hasEnumerableObservers: boolean; @@ -657,7 +660,7 @@ declare module Ember { cacheable(aFlag?: boolean): ComputedProperty; get(keyName: string): any; meta(meta: {}): ComputedProperty; - property(...string): ComputedProperty; + property(...args: string[]): ComputedProperty; readOnly(): ComputedProperty; set(keyName: string, newValue: any, oldValue: string): any; // ReSharper disable UsingOfReservedWord @@ -721,8 +724,8 @@ declare module Ember { Additional methods for the ControllerMixin. **/ class ControllerMixin { - replaceRoute(name: string, ...any): void; - transitionToRoute(name: string, ...any): void; + replaceRoute(name: string, ...args: any[]): void; + transitionToRoute(name: string, ...args: any[]): void; controllers: {}; needs: string[]; target: any; @@ -879,14 +882,14 @@ declare module Ember { someProperty(key: string, value?: string): boolean; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Enumerable); - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Enumerable); - enumerableContentDidChange(removing: Enumerable, adding: Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; enumerableContentWillChange(removing: number, adding: number): Enumerable; enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; @@ -900,7 +903,7 @@ declare module Ember { findBy(key: string, value?: string): any; forEach(callback: Function, target?: any): any; getEach(key: string): any[]; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; map: ItemIndexEnumerableCallbackTarget; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; @@ -913,7 +916,7 @@ declare module Ember { toArray(): any[]; uniq(): Enumerable; without(value: any): Enumerable; - '[]': any[]; + '[]': any[]; firstObject: any; hasEnumerableObservers: boolean; lastObject: any; @@ -954,7 +957,7 @@ declare module Ember { off(name: string, target: any, method: Function): Evented; on(name: string, target: any, method: Function): Evented; one(name: string, target: any, method: Function): Evented; - trigger(name: string, ...string): void; + trigger(name: string, ...args: string[]): void; } var FROZEN_ERROR: string; class Freezable { @@ -996,19 +999,19 @@ declare module Ember { class Compiler { } class JavaScriptCompiler { } function registerHelper(name: string, fn: Function, inverse?: boolean): void; - function registerPartial(name: string, str): void; - function K(); - function createFrame(object); + function registerPartial(name: string, str: any): void; + function K(): any; + function createFrame(objec: any): any; function Exception(message: string): void; class SafeString { constructor(str: string); static toString(): string; } - function parse(string: string); - function print(ast); - var logger; - function log(level, str): void; - function compile(environment, options?, context?, asObject?); + function parse(string: string): any; + function print(ast: any): void; + var logger: typeof Ember.Logger; + function log(level: string, str: string): void; + function compile(environment: any, options?: any, context?: any, asObject?: any): any; } class HashLocation extends Object { static detect(obj: any): boolean; @@ -1046,7 +1049,7 @@ declare module Ember { var IS_BINDING: RegExp; class Instrumentation { getProperties(obj: any, list: any[]): {}; - getProperties(obj: any, ...string): {}; + getProperties(obj: any, ...args: string[]): {}; instrument(name: string, payload: any, callback: Function, binding: any): void; reset(): void; subscribe(pattern: string, object: any): void; @@ -1094,11 +1097,11 @@ declare module Ember { } var Logger: { assert(param: any): void; - debug(...any): void; - error(...any): void; - info(...any): void; - log(...any): void; - warn(...any): void; + debug(...args: any[]): void; + error(...args: any[]): void; + info(...args: any[]): void; + log(...args: any[]): void; + warn(...args: any[]): void; }; function MANDATORY_SETTER_FUNCTION(value: string): void; var META_KEY: string; @@ -1137,14 +1140,14 @@ declare module Ember { clear(): any[]; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Enumerable); - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Enumerable); - enumerableContentDidChange(removing: Enumerable, adding: Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; enumerableContentWillChange(removing: number, adding: number): Enumerable; enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; @@ -1160,23 +1163,23 @@ declare module Ember { getEach(key: string): any[]; indexOf(object: any, startAt: number): number; insertAt(idx: number, object: any): any[]; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; lastIndexOf(object: any, startAt: number): number; map: ItemIndexEnumerableCallbackTarget; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; objectAt(idx: number): any; - objectsAt(...number): any[]; + objectsAt(...args: number[]): any[]; popObject(): any; pushObject(obj: any): any; - pushObjects(...any): any[]; + pushObjects(...args: any[]): any[]; reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; reject: ItemIndexEnumerableCallbackTarget; rejectBy(key: string, value?: string): any[]; removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[]; removeAt(start: number, len: number): any; removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; - replace(idx: number, amt: number, objects: any[]); + replace(idx: number, amt: number, objects: any[]): any; reverseObjects(): any[]; setEach(key: string, value?: any): any; setObjects(objects: any[]): any[]; @@ -1209,14 +1212,14 @@ declare module Ember { someProperty(key: string, value?: string): boolean; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Enumerable); - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Enumerable); - enumerableContentDidChange(removing: Enumerable, adding: Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; enumerableContentWillChange(removing: number, adding: number): Enumerable; enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; @@ -1230,7 +1233,7 @@ declare module Ember { findBy(key: string, value?: string): any; forEach(callback: Function, target?: any): any; getEach(key: string): any[]; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; map: ItemIndexEnumerableCallbackTarget; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; @@ -1245,7 +1248,7 @@ declare module Ember { toArray(): any[]; uniq(): Enumerable; without(value: any): Enumerable; - '[]': any[]; + '[]': any[]; firstObject: any; hasEnumerableObservers: boolean; lastObject: any; @@ -1280,14 +1283,14 @@ declare module Ember { clear(): any[]; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Enumerable); - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Enumerable); - enumerableContentDidChange(removing: Enumerable, adding: Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; enumerableContentWillChange(removing: number, adding: number): any[]; enumerableContentWillChange(removing: Enumerable, adding: number): any[]; enumerableContentWillChange(removing: number, adding: Enumerable): any[]; @@ -1303,23 +1306,23 @@ declare module Ember { getEach(key: string): any[]; indexOf(object: any, startAt: number): number; insertAt(idx: number, object: any): any[]; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; lastIndexOf(object: any, startAt: number): number; map: ItemIndexEnumerableCallbackTarget; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; objectAt(idx: number): any; - objectsAt(...number): any[]; + objectsAt(...args: number[]): any[]; popObject(): any; pushObject(obj: any): any; - pushObjects(...any): any[]; + pushObjects(...args: any[]): any[]; reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; reject: ItemIndexEnumerableCallbackTarget; rejectBy(key: string, value?: string): any[]; removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[]; removeAt(start: number, len: number): any; removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): any[]; - replace(idx: number, amt: number, objects: any[]); + replace(idx: number, amt: number, objects: any[]): any; reverseObjects(): any[]; setEach(key: string, value?: any): any; setObjects(objects: any[]): any[]; @@ -1348,7 +1351,7 @@ declare module Ember { decrementProperty(keyName: string, decrement?: number): number; endPropertyChanges(): any[]; get(keyName: string): any; - getProperties(...string): {}; + getProperties(...args: string[]): {}; getProperties(keys: string[]): {}; getWithDefault(keyName: string, defaultValue: any): any; hasObserverFor(key: string): boolean; @@ -1426,7 +1429,7 @@ declare module Ember { decrementProperty(keyName: string, decrement?: number): number; endPropertyChanges(): Observable; get(keyName: string): any; - getProperties(...string): {}; + getProperties(...args: string[]): {}; getProperties(keys: string[]): {}; getWithDefault(keyName: string, defaultValue: any): any; hasObserverFor(key: string): boolean; @@ -1441,8 +1444,8 @@ declare module Ember { toggleProperty(keyName: string): any; } class ObjectController extends ObjectProxy implements ControllerMixin { - replaceRoute(name: string, ...any): void; - transitionToRoute(name: string, ...any): void; + replaceRoute(name: string, ...args: any[]): void; + transitionToRoute(name: string, ...args: any[]): void; controllers: Object; needs: string[]; target: any; @@ -1474,7 +1477,7 @@ declare module Ember { decrementProperty(keyName: string, decrement?: number): number; endPropertyChanges(): Observable; get(keyName: string): any; - getProperties(...string): {}; + getProperties(...args: string[]): {}; getProperties(keys: string[]): {}; getWithDefault(keyName: string, defaultValue: any): any; hasObserverFor(key: string): boolean; @@ -1551,12 +1554,12 @@ declare module Ember { render(name: string, options?: RenderOptions): void; renderTemplate(controller: Controller, model: {}): void; // ReSharper disable once InconsistentNaming - replaceWith(name: string, ...Object): void; - send(name: string, ...any): void; + replaceWith(name: string, ...object: any[]): void; + send(name: string, ...args: any[]): void; serialize(model: {}, params: string[]): string; setupController(controller: Controller, model: {}): void; // ReSharper disable once InconsistentNaming - transitionTo(name: string, ...Object): void; + transitionTo(name: string, ...object: any[]): void; actions: ActionsHash; } class Router extends Object { @@ -1634,14 +1637,14 @@ declare module Ember { someProperty(key: string, value?: string): boolean; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Enumerable); - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Enumerable); - enumerableContentDidChange(removing: Enumerable, adding: Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; enumerableContentWillChange(removing: number, adding: number): Set; enumerableContentWillChange(removing: Enumerable, adding: number): Set; enumerableContentWillChange(removing: number, adding: Enumerable): Set; @@ -1655,7 +1658,7 @@ declare module Ember { findBy(key: string, value?: string): any; forEach(callback: Function, target?: any): any; getEach(key: string): any[]; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; map: ItemIndexEnumerableCallbackTarget; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; @@ -1679,13 +1682,13 @@ declare module Ember { freeze(): Set; isFrozen: boolean; add(obj: any): Set; - addEach(...any): Set; + addEach(...args: any[]): Set; clear(): Set; isEqual(obj: Set): boolean; pop(): any; push(obj: any): Set; remove(obj: any): Set; - removeEach(...any): Set; + removeEach(...args: any[]): Set; shift(): any; unshift(obj: any): Set; length: number; @@ -1699,14 +1702,14 @@ declare module Ember { someProperty(key: string, value?: string): boolean; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Enumerable); - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Enumerable); - enumerableContentDidChange(removing: Enumerable, adding: Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; enumerableContentWillChange(removing: number, adding: number): Enumerable; enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; @@ -1720,7 +1723,7 @@ declare module Ember { findBy(key: string, value?: string): any; forEach(callback: Function, target?: any): any; getEach(key: string): any[]; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; map: ItemIndexEnumerableCallbackTarget; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; @@ -1763,7 +1766,7 @@ declare module Ember { off(name: string, target: any, method: Function): State; on(name: string, target: any, method: Function): State; one(name: string, target: any, method: Function): State; - trigger(name: string, ...string): void; + trigger(name: string, ...args: string[]): void; getPathsCache(stateManager: {}, path: string): {}; init(): void; setPathsCache(stateManager: {}, path: string, transitions: any): void; @@ -1804,7 +1807,7 @@ declare module Ember { stateMetaFor(state: State): {}; transitionTo(path: string, context: any): void; triggerSetupContext(transitions: TransitionsHash): void; - unhandledEvent(manager: StateManager, event: string); + unhandledEvent(manager: StateManager, event: string): any; currentPath: string; currentState: State; errorOnUnhandledEvents: boolean; @@ -1816,9 +1819,9 @@ declare module Ember { function classify(str: string): string; function dasherize(str: string): string; function decamelize(str: string): string; - function fmt(...string): string; + function fmt(...args: string[]): string; function htmlSafe(str: string): void; // TODO: @returns Handlebars.SafeStringStatic; - function loc(...string): string; + function loc(...args: string[]): string; function underscore(str: string): string; function w(str: string): string[]; } @@ -2001,8 +2004,8 @@ declare module Ember { var computed: { (callback: Function): ComputedProperty; alias(dependentKey: string): ComputedProperty; - and(...string): ComputedProperty; - any(...string): ComputedProperty; + and(...args: string[]): ComputedProperty; + any(...args: string[]): ComputedProperty; bool(dependentKey: string): ComputedProperty; defaultTo(defaultPath: string): ComputedProperty; empty(dependentKey: string): ComputedProperty; @@ -2011,13 +2014,13 @@ declare module Ember { gte(dependentKey: string, value: number): ComputedProperty; lt(dependentKey: string, value: number): ComputedProperty; lte(dependentKey: string, value: number): ComputedProperty; - map(...string): ComputedProperty; + map(...args: string[]): ComputedProperty; match(dependentKey: string, regexp: RegExp): ComputedProperty; none(dependentKey: string): ComputedProperty; not(dependentKey: string): ComputedProperty; notEmpty(dependentKey: string): ComputedProperty; oneWay(dependentKey: string): ComputedProperty; - or(...string): ComputedProperty; + or(...args: string[]): ComputedProperty; }; // ReSharper disable DuplicatingLocalDeclaration var config: {}; @@ -2057,7 +2060,7 @@ declare module Ember { function handleErrors(func: Function, context: any): any; function hasListeners(context: any, name: string): boolean; function hasOwnProperty(prop: string): boolean; - function immediateObserver(func: Function, ...propertyNames): Function; + function immediateObserver(func: Function, ...propertyNames: any[]): Function; var imports: {}; function inspect(obj: any): string; function instrument(name: string, payload: any, callback: Function, binding: any): void; @@ -2079,13 +2082,13 @@ declare module Ember { function merge(original: any, updates: any): any; function meta(obj: any, writable?: boolean): {}; function metaPath(obj: any, path: string, writable?: boolean): any; - function mixin(obj: any, ...any): any; + function mixin(obj: any, ...args: any[]): any; /** Ember.none is deprecated. Please use Ember.isNone instead. **/ var none: typeof deprecateFunc; function normalizeTuple(target: any, path: string): any[]; - function observer(func: Function, ...string): Function; + function observer(func: Function, ...args: string[]): Function; function observersFor(obj: any, path: string): any[]; function onLoad(name: string, callback: Function): void; function oneWay(obj: any, to: string, from: string): Binding; @@ -2119,18 +2122,18 @@ declare module Ember { debounce(target: any, method: Function, ...args: any[]): void; debounce(target: any, method: string, ...args: any[]): void; end(): void; - join(target: any, method: Function, ...any): any; - join(target: any, method: string, ...any): any; + join(target: any, method: Function, ...args: any[]): any; + join(target: any, method: string, ...args: any[]): any; later(target: any, method: Function, ...args: any[]): string; later(target: any, method: string, ...args: any[]): string; - next(target: any, method: Function, ...any): number; - next(target: any, method: string, ...any): number; - once(target: any, method: Function, ...any): number; - once(target: any, method: string, ...any): number; - schedule(queue: string, target: any, method: Function, ...any): void; - schedule(queue: string, target: any, method: string, ...any): void; - scheduleOnce(queue: string, target: any, method: Function, ...any): void; - scheduleOnce(queue: string, target: any, method: string, ...any): void; + next(target: any, method: Function, ...args: any[]): number; + next(target: any, method: string, ...args: any[]): number; + once(target: any, method: Function, ...args: any[]): number; + once(target: any, method: string, ...args: any[]): number; + schedule(queue: string, target: any, method: Function, ...args: any[]): void; + schedule(queue: string, target: any, method: string, ...args: any[]): void; + scheduleOnce(queue: string, target: any, method: Function, ...args: any[]): void; + scheduleOnce(queue: string, target: any, method: string, ...args: any[]): void; sync(): void; throttle(target: any, method: Function, ...args: any[]): void; throttle(target: any, method: string, ...args: any[]): void; diff --git a/ember/ember.d.ts.tscparams b/ember/ember.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/ember/ember.d.ts.tscparams +++ b/ember/ember.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/emscripten/emscripten-tests.ts b/emscripten/emscripten-tests.ts new file mode 100644 index 000000000..2f3a2b09c --- /dev/null +++ b/emscripten/emscripten-tests.ts @@ -0,0 +1,69 @@ +/// + + +/// Module +function ModuleTest(): void { + Module.print = function(text) { alert('stdout: ' + text) }; + + var int_sqrt = Module.cwrap('int_sqrt', 'number', ['number']) + int_sqrt(12) + int_sqrt(28) + + var myTypedArray = new Uint8Array(10); + var buf = Module._malloc(myTypedArray.length*myTypedArray.BYTES_PER_ELEMENT); + Module.HEAPU8.set(myTypedArray, buf); + Module.ccall('my_function', 'number', ['number'], [buf]); + Module._free(buf); +} + +/// FS +function FSTest(): void { + FS.mkdir('/working'); + FS.mount(NODEFS, { root: '.' }, '/working'); + + function myAppStartup(): void { + FS.mkdir('/data'); + FS.mount(IDBFS, {}, '/data'); + + FS.syncfs(true, function (err) { + // handle callback + }); + } + + function myAppShutdown() { + FS.syncfs(function (err) { + // handle callback + }); + } + + var id = FS.makedev(64, 0); + FS.registerDevice(id, {}); + FS.mkdev('/dummy', id); + + FS.writeFile('file', 'foobar'); + FS.symlink('file', 'link'); + + FS.writeFile('/foobar.txt', 'Hello, world'); + FS.unlink('/foobar.txt'); + + FS.writeFile('file', 'foobar'); + FS.symlink('file', 'link'); + + FS.writeFile('forbidden', 'can\'t touch this'); + FS.chmod('forbidden', 0000); + + FS.writeFile('file', 'foobar'); + FS.truncate('file', 3); + + var stream = FS.open('abinaryfile', 'r'); + var buf = new Uint8Array(4); + FS.read(stream, buf, 0, 4, 0); + FS.close(stream); + + var data = new Uint8Array(32); + var stream = FS.open('dummy', 'w+'); + FS.write(stream, data, 0, data.length, 0); + FS.close(stream); + + var lookup = FS.lookupPath("path", { parent: true }); +} diff --git a/emscripten/emscripten.d.ts b/emscripten/emscripten.d.ts new file mode 100644 index 000000000..547f10c76 --- /dev/null +++ b/emscripten/emscripten.d.ts @@ -0,0 +1,185 @@ +// Type definitions for Emscripten +// Project: http://kripken.github.io/emscripten-site/index.html +// Definitions by: Kensuke Matsuzaki +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module Emscripten { + interface FileSystemType { + } +} + +declare module Module { + function print(str: string): void; + function printErr(str: string): void; + var arguments: string[]; + var preInit: { (): void }[]; + var preRun: { (): void }[]; + var postRun: { (): void }[]; + var noExitRuntime: boolean; + + var Runtime: any; + + function ccall(ident: string, returnType: string, argTypes: string[], args: any[]): any; + function cwrap(ident: string, returnType: string, argTypes: string[]): any; + + function setValue(ptr: number, value: any, type: string, noSafe: boolean): void; + function getValue(ptr: number, type: string, noSafe: boolean): any; + + var ALLOC_NORMAL: number; + var ALLOC_STACK: number; + var ALLOC_STATIC: number; + var ALLOC_DYNAMIC: number; + var ALLOC_NONE: number; + + function allocate(slab: any, types: string, allocator: number, ptr: number): number; + function allocate(slab: any, types: string[], allocator: number, ptr: number): number; + + function Pointer_stringify(ptr: number, length?: number): string; + function UTF16ToString(ptr: number): string; + function stringToUTF16(str: string, outPtr: number): void; + function UTF32ToString(ptr: number): string; + function stringToUTF32(str: string, outPtr: number): void; + + // USE_TYPED_ARRAYS == 1 + var HEAP: Int32Array; + var IHEAP: Int32Array; + var FHEAP: Float64Array; + + // USE_TYPED_ARRAYS == 2 + var HEAP8: Int8Array; + var HEAP16: Int16Array; + var HEAP32: Int32Array; + var HEAPU8: Uint8Array; + var HEAPU16: Uint16Array; + var HEAPU32: Uint32Array; + var HEAPF32: Float32Array; + var HEAPF64: Float64Array; + + var TOTAL_STACK: number; + var TOTAL_MEMORY: number; + var FAST_MEMORY: number; + + function addOnPreRun(cb: () => any): void; + function addOnInit(cb: () => any): void; + function addOnPreMain(cb: () => any): void; + function addOnExit(cb: () => any): void; + function addOnPostRun(cb: () => any): void; + + // Tools + function intArrayFromString(stringy: string, dontAddNull?: boolean, length?: number): number[]; + function intArrayToString(array: number[]): string; + function writeStringToMemory(str: string, buffer: number, dontAddNull: boolean): void; + function writeArrayToMemory(array: number[], buffer: number): void; + function writeAsciiToMemory(str: string, buffer: number, dontAddNull: boolean): void; + + function addRunDependency(id: any): void; + function removeRunDependency(id: any): void; + + + var preloadedImages: any; + var preloadedAudios: any; + + function _malloc(size: number): number; + function _free(ptr: number): void; +} + +declare module FS { + interface Lookup { + path: string; + node: FSNode; + } + + interface FSStream {} + interface FSNode {} + interface ErrnoError {} + + var ignorePermissions: boolean; + var trackingDelegate: any; + var tracking: any; + var genericErrors: any; + + // + // paths + // + function lookupPath(path: string, opts: any): Lookup; + function getPath(node: FSNode): string; + + // + // nodes + // + function isFile(mode: number): boolean; + function isDir(mode: number): boolean; + function isLink(mode: number): boolean; + function isChrdev(mode: number): boolean; + function isBlkdev(mode: number): boolean; + function isFIFO(mode: number): boolean; + function isSocket(mode: number): boolean; + + // + // devices + // + function major(dev: number): number; + function minor(dev: number): number; + function makedev(ma: number, mi: number): number; + function registerDevice(dev: number, ops: any): void; + + // + // core + // + function syncfs(populate: boolean, callback: (e: any) => any): void; + function syncfs( callback: (e: any) => any, populate?: boolean): void; + function mount(type: Emscripten.FileSystemType, opts: any, mountpoint: string): any; + function unmount(mountpoint: string): void; + + function mkdir(path: string, mode?: number): any; + function mkdev(path: string, mode?: number, dev?: number): any; + function symlink(oldpath: string, newpath: string): any; + function rename(old_path: string, new_path: string): void; + function rmdir(path: string): void; + function readdir(path: string): any; + function unlink(path: string): void; + function readlink(path: string): string; + function stat(path: string, dontFollow?: boolean): any; + function lstat(path: string): any; + function chmod(path: string, mode: number, dontFollow?: boolean): void; + function lchmod(path: string, mode: number): void; + function fchmod(fd: number, mode: number): void; + function chown(path: string, uid: number, gid: number, dontFollow?: boolean): void; + function lchown(path: string, uid: number, gid: number): void; + function fchown(fd: number, uid: number, gid: number): void; + function truncate(path: string, len: number): void; + function ftruncate(fd: number, len: number): void; + function utime(path: string, atime: number, mtime: number): void; + function open(path: string, flags: string, mode?: number, fd_start?: number, fd_end?: number): FSStream; + function close(stream: FSStream): void; + function llseek(stream: FSStream, offset: number, whence: number): any; + function read(stream: FSStream, buffer: ArrayBufferView, offset: number, length: number, position?: number): number; + function write(stream: FSStream, buffer: ArrayBufferView, offset: number, length: number, position?: number, canOwn?: boolean): number; + function allocate(stream: FSStream, offset: number, length: number): void; + function mmap(stream: FSStream, buffer: ArrayBufferView, offset: number, length: number, position: number, prot: number, flags: number): any; + function ioctl(stream: FSStream, cmd: any, arg: any): any; + function readFile(path: string, opts?: {encoding: string; flags: string}): any; + function writeFile(path: string, data: ArrayBufferView, opts?: {encoding: string; flags: string}): void; + function writeFile(path: string, data: string, opts?: {encoding: string; flags: string}): void; + + // + // module-level FS code + // + function cwd(): string; + function chdir(path: string): void; + function init(input: () => number, output: (c: number) => any, error: (c: number) => any): void; + + function createLazyFile(parent: string, name: string, url: string, canRead: boolean, canWrite: boolean): FSNode; + function createLazyFile(parent: FSNode, name: string, url: string, canRead: boolean, canWrite: boolean): FSNode; + + function createPreloadedFile(parent: string, name: string, url: string, canRead: boolean, canWrite: boolean, onload?: ()=> void, onerror?: ()=>void, dontCreateFile?:boolean, canOwn?: boolean): void; + function createPreloadedFile(parent: FSNode, name: string, url: string, canRead: boolean, canWrite: boolean, onload?: ()=> void, onerror?: ()=>void, dontCreateFile?:boolean, canOwn?: boolean): void; +} + +declare var MEMFS: Emscripten.FileSystemType; +declare var NODEFS: Emscripten.FileSystemType; +declare var IDBFS: Emscripten.FileSystemType; + +interface Math { + imul(a: number, b: number): number; +} diff --git a/epiceditor/epiceditor-tests.ts.tscparams b/epiceditor/epiceditor-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/epiceditor/epiceditor-tests.ts.tscparams +++ b/epiceditor/epiceditor-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/epiceditor/epiceditor.d.ts.tscparams b/epiceditor/epiceditor.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/epiceditor/epiceditor.d.ts.tscparams +++ b/epiceditor/epiceditor.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/express-session/express-session-tests.ts b/express-session/express-session-tests.ts new file mode 100644 index 000000000..1e1f909b1 --- /dev/null +++ b/express-session/express-session-tests.ts @@ -0,0 +1,41 @@ +/// + +import express = require('express'); +import session = require('express-session'); + +var app = express(); + +app.use(session({ + secret: 'keyboard cat' +})); +app.use(session({ + secret: 'keyboard cat', + name: 'connect.sid', + store: new session.MemoryStore(), + cookie: { path: '/', httpOnly: true, secure: false, maxAge: null }, + genid: (req: express.Request): string => { return ''; }, + rolling: false, + resave: true, + proxy: true, + saveUninitialized: true, + unset: 'keep' +})); + + +interface MySession extends Express.Session { + views: number; +} +app.use(function(req, res, next) { + var sess = req.session; + if (sess.views) { + sess.views++ + res.setHeader('Content-Type', 'text/html') + res.write('

views: ' + sess.views + '

') + res.write('

expires in: ' + (sess.cookie.maxAge / 1000) + 's

') + res.end() + } else { + sess.views = 1 + res.end('welcome to the session demo. refresh!') + } +}); + diff --git a/express-session/express-session.d.ts b/express-session/express-session.d.ts new file mode 100644 index 000000000..5e32e3b7e --- /dev/null +++ b/express-session/express-session.d.ts @@ -0,0 +1,75 @@ +// Type definitions for express-session +// Project: https://www.npmjs.org/package/express-session +// Definitions by: Hiroki Horiuchi +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Express { + + export interface Request { + session?: Session; + } + + export interface Session { + [key: string]: any; + + regenerate: (callback: (err: any) => void) => void; + destroy: (callback: (err: any) => void) => void; + reload: (callback: (err: any) => void) => void; + save: (callback: (err: any) => void) => void; + touch: (callback: (err: any) => void) => void; + + cookie: SessionCookie; + } + export interface SessionCookie { + originalMaxAge: number; + path: string; + maxAge: number; + secure?: boolean; + httpOnly: boolean; + domain?: string; + expires: Date; + serialize: (name: string, value: string) => string; + } +} + +declare module "express-session" { + import express = require('express'); + + function session(options?: session.SessionOptions): express.RequestHandler; + + module session { + export interface SessionOptions { + secret: string; + name?: string; + store?: Store; + cookie?: express.CookieOptions; + genid?: (req: express.Request) => string; + rolling?: boolean; + resave?: boolean; + proxy?: boolean; + saveUninitialized?: boolean; + unset?: string; + } + + export interface Store { + get: (sid: string, callback: (err: any, session: Express.Session) => void) => void; + set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; + destroy: (sid: string, callback: (err: any) => void) => void; + length?: (callback: (err: any, length: number) => void) => void; + clear?: (callback: (err: any) => void) => void; + } + export class MemoryStore implements Store { + get: (sid: string, callback: (err: any, session: Express.Session) => void) => void; + set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; + destroy: (sid: string, callback: (err: any) => void) => void; + all: (callback: (err: any, obj: { [sid: string]: Express.Session; }) => void) => void; + length: (callback: (err: any, length: number) => void) => void; + clear: (callback: (err: any) => void) => void; + } + } + + export = session; +} + diff --git a/express-validator/express-validator.d.ts b/express-validator/express-validator.d.ts index b18b17e96..5a5df2fa0 100644 --- a/express-validator/express-validator.d.ts +++ b/express-validator/express-validator.d.ts @@ -1,161 +1,173 @@ // Type definitions for express-validator // Project: https://github.com/ctavan/express-validator -// Definitions by: Nathan Ridley +// Definitions by: Nathan Ridley , Jonathan Häberle // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module ExpressValidator { - export interface ValidationError { - msg: string; - param: string; - } +/// - export interface RequestValidation { - check(field: string, message: string): Validator; - assert(field: string, message: string): Validator; - sanitize(field: string): Sanitizer; - onValidationError(func: (msg: string) => void): void; - } - - export interface Validator { - /** - * Alias for regex() - */ - is(): Validator; - /** - * Alias for notRegex() - */ - not(): Validator; - isEmail(): Validator; - /** - * Accepts http, https, ftp - */ - isUrl(): Validator; - /** - * Combines isIPv4 and isIPv6 - */ - isIP(): Validator; - isIPv4(): Validator; - isIPv6(): Validator; - isAlpha(): Validator; - isAlphanumeric(): Validator; - isNumeric(): Validator; - isHexadecimal(): Validator; - /** - * Accepts valid hexcolors with or without # prefix - */ - isHexColor(): Validator; - /** - * isNumeric accepts zero padded numbers, e.g. '001', isInt doesn't - */ - isInt(): Validator; - isLowercase(): Validator; - isUppercase(): Validator; - isDecimal(): Validator; - /** - * Alias for isDecimal - */ - isFloat(): Validator; - /** - * Check if length is 0 - */ - notNull(): Validator; - isNull(): Validator; - /** - * Not just whitespace (input.trim().length !== 0) - */ - notEmpty(): Validator; - equals(equals: any): Validator; - contains(str: string): Validator; - notContains(str: string): Validator; - /** - * Usage: regex(/[a-z]/i) or regex('[a-z]','i') - */ - regex(pattern: string, modifiers: string): Validator; - notRegex(pattern: string, modifiers: string): Validator; - /** - * max is optional - */ - len(min: number, max?: number): Validator; - /** - * Version can be 3, 4 or 5 or empty, see http://en.wikipedia.org/wiki/Universally_unique_identifier - */ - isUUID(version: number): Validator; - /** - * Alias for isUUID(3) - */ - isUUIDv3(): Validator; - /** - * Alias for isUUID(4) - */ - isUUIDv4(): Validator; - /** - * Alias for isUUID(5) - */ - isUUIDv5(): Validator; - /** - * Uses Date.parse() - regex is probably a better choice - */ - isDate(): Validator; - /** - * Argument is optional and defaults to today. Comparison is non-inclusive - */ - isAfter(date: Date): Validator; - /** - * Argument is optional and defaults to today. Comparison is non-inclusive - */ - isBefore(date: Date): Validator; - isIn(options: string): Validator; - isIn(options: string[]): Validator; - notIn(options: string): Validator; - notIn(options: string[]): Validator; - max(val: string): Validator; - min(val: string): Validator; - /** - * Will work against Visa, MasterCard, American Express, Discover, Diners Club, and JCB card numbering formats - */ - isCreditCard(): Validator; - } - - interface Sanitizer { - /** - * Trim optional `chars`, default is to trim whitespace (\r\n\t ) - */ - trim(...chars: string[]): Sanitizer; - ltrim(...chars: string[]): Sanitizer; - rtrim(...chars: string[]): Sanitizer; - ifNull(replace: any): Sanitizer; - toFloat(): Sanitizer; - toInt(): Sanitizer; - /** - * True unless str = '0', 'false', or str.length == 0 - */ - toBoolean(): Sanitizer; - /** - * False unless str = '1' or 'true' - */ - toBooleanStrict(): Sanitizer; - /** - * Decode HTML entities - */ - entityDecode(): Sanitizer; - entityEncode(): Sanitizer; - /** - * Escape &, <, >, and " - */ - escape(): Sanitizer; - /** - * Remove common XSS attack vectors from user-supplied HTML - */ - xss(): Sanitizer; - /** - * Remove common XSS attack vectors from images - */ - xss(fromImages: boolean): Sanitizer; - } -} - -declare function ExpressValidator(): void; declare module "express-validator" { - export = ExpressValidator; + import express = require('express'); + + module ExpressValidator { + + export interface ValidationError { + msg: string; + param: string; + } + + export interface RequestValidation { + check(field:string, message:string): Validator; + assert(field:string, message:string): Validator; + sanitize(field:string): Sanitizer; + onValidationError(func:(msg:string) => void): void; + validationErrors() : any; + } + + export interface Validator { + /** + * Alias for regex() + */ + is(): Validator; + /** + * Alias for notRegex() + */ + not(): Validator; + isEmail(): Validator; + /** + * Accepts http, https, ftp + */ + isUrl(): Validator; + /** + * Combines isIPv4 and isIPv6 + */ + isIP(): Validator; + isIPv4(): Validator; + isIPv6(): Validator; + isAlpha(): Validator; + isAlphanumeric(): Validator; + isNumeric(): Validator; + isHexadecimal(): Validator; + /** + * Accepts valid hexcolors with or without # prefix + */ + isHexColor(): Validator; + /** + * isNumeric accepts zero padded numbers, e.g. '001', isInt doesn't + */ + isInt(): Validator; + isLowercase(): Validator; + isUppercase(): Validator; + isDecimal(): Validator; + /** + * Alias for isDecimal + */ + isFloat(): Validator; + /** + * Check if length is 0 + */ + notNull(): Validator; + isNull(): Validator; + /** + * Not just whitespace (input.trim().length !== 0) + */ + notEmpty(): Validator; + equals(equals:any): Validator; + contains(str:string): Validator; + notContains(str:string): Validator; + /** + * Usage: regex(/[a-z]/i) or regex('[a-z]','i') + */ + regex(pattern:string, modifiers:string): Validator; + notRegex(pattern:string, modifiers:string): Validator; + /** + * max is optional + */ + len(min:number, max?:number): Validator; + /** + * Version can be 3, 4 or 5 or empty, see http://en.wikipedia.org/wiki/Universally_unique_identifier + */ + isUUID(version:number): Validator; + /** + * Alias for isUUID(3) + */ + isUUIDv3(): Validator; + /** + * Alias for isUUID(4) + */ + isUUIDv4(): Validator; + /** + * Alias for isUUID(5) + */ + isUUIDv5(): Validator; + /** + * Uses Date.parse() - regex is probably a better choice + */ + isDate(): Validator; + /** + * Argument is optional and defaults to today. Comparison is non-inclusive + */ + isAfter(date:Date): Validator; + /** + * Argument is optional and defaults to today. Comparison is non-inclusive + */ + isBefore(date:Date): Validator; + isIn(options:string): Validator; + isIn(options:string[]): Validator; + notIn(options:string): Validator; + notIn(options:string[]): Validator; + max(val:string): Validator; + min(val:string): Validator; + /** + * Will work against Visa, MasterCard, American Express, Discover, Diners Club, and JCB card numbering formats + */ + isCreditCard(): Validator; + } + + interface Sanitizer { + /** + * Trim optional `chars`, default is to trim whitespace (\r\n\t ) + */ + trim(...chars:string[]): Sanitizer; + ltrim(...chars:string[]): Sanitizer; + rtrim(...chars:string[]): Sanitizer; + ifNull(replace:any): Sanitizer; + toFloat(): Sanitizer; + toInt(): Sanitizer; + /** + * True unless str = '0', 'false', or str.length == 0 + */ + toBoolean(): Sanitizer; + /** + * False unless str = '1' or 'true' + */ + toBooleanStrict(): Sanitizer; + /** + * Decode HTML entities + */ + entityDecode(): Sanitizer; + entityEncode(): Sanitizer; + /** + * Escape &, <, >, and " + */ + escape(): Sanitizer; + /** + * Remove common XSS attack vectors from user-supplied HTML + */ + xss(): Sanitizer; + /** + * Remove common XSS attack vectors from images + */ + xss(fromImages:boolean): Sanitizer; + } + } + + /** + * + * @middlewareOptions see: https://github.com/ctavan/express-validator#middleware-options + */ + function ExpressValidator(middlewareOptions?:any):express.RequestHandler; + + + export = ExpressValidator; } diff --git a/express/express-tests.ts.tscparams b/express/express-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/express/express-tests.ts.tscparams +++ b/express/express-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/express/express.d.ts b/express/express.d.ts index d9551e22b..d5d48308f 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -3,7 +3,7 @@ // Definitions by: Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped -/* =================== USAGE =================== +/* =================== USAGE =================== import express = require('express'); var app = express(); @@ -485,14 +485,18 @@ declare module "express" { * * Options: * - * - `maxAge` defaulting to 0 - * - `root` root directory for relative filenames + * - `maxAge` defaulting to 0 (can be string converted by `ms`) + * - `root` root directory for relative filenames + * - `headers` object of headers to serve with file + * - `dotfiles` serve dotfiles, defaulting to false; can be `"allow"` to send them + * + * Other options are passed along to `send`. * * Examples: * - * The following example illustrates how `res.sendfile()` may + * The following example illustrates how `res.sendFile()` may * be used as an alternative for the `static()` middleware for - * dynamic situations. The code backing `res.sendfile()` is actually + * dynamic situations. The code backing `res.sendFile()` is actually * the same code, so HTTP cache support etc is identical. * * app.get('/user/:uid/photos/:file', function(req, res){ @@ -501,16 +505,35 @@ declare module "express" { * * req.user.mayViewFilesFrom(uid, function(yes){ * if (yes) { - * res.sendfile('/uploads/' + uid + '/' + file); + * res.sendFile('/uploads/' + uid + '/' + file); * } else { * res.send(403, 'Sorry! you cant see that.'); * } * }); * }); + * + * @api public + */ + sendFile(path: string): void; + sendFile(path: string, options: any): void; + sendFile(path: string, fn: Errback): void; + sendFile(path: string, options: any, fn: Errback): void; + + /** + * deprecated, use sendFile instead. */ sendfile(path: string): void; + /** + * deprecated, use sendFile instead. + */ sendfile(path: string, options: any): void; + /** + * deprecated, use sendFile instead. + */ sendfile(path: string, fn: Errback): void; + /** + * deprecated, use sendFile instead. + */ sendfile(path: string, options: any, fn: Errback): void; /** @@ -821,7 +844,7 @@ declare module "express" { (name: string): string; // Getter (name: string, ...handlers: RequestHandler[]): Application; (name: RegExp, ...handlers: RequestHandler[]): Application; - } + }; /** * Return the app's absolute pathname @@ -1045,4 +1068,3 @@ declare module "express" { export = e; } - diff --git a/extjs/ExtJS-tests.ts.tscparams b/extjs/ExtJS-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/extjs/ExtJS-tests.ts.tscparams +++ b/extjs/ExtJS-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/fabricjs/fabricjs-tests.ts.tscparams b/fabricjs/fabricjs-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/fabricjs/fabricjs-tests.ts.tscparams +++ b/fabricjs/fabricjs-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index eec70c8f6..d532b1c56 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -324,7 +324,7 @@ declare module fabric { setWidth(value: number): IObject; // methods - bringForward(): IObject; + bringForward(intersecting?: boolean): IObject; bringToFront(): IObject; center(): IObject; centerH(): IObject; @@ -335,6 +335,7 @@ declare module fabric { drawBorders(context: CanvasRenderingContext2D): IObject; drawCorners(context: CanvasRenderingContext2D): IObject; get (property: string): any; + getBoundingRect(): {left:number; top:number; width:number; height:number}; getBoundingRectHeight(): number; getBoundingRectWidth(): number; getSvgStyles(): string; @@ -354,7 +355,7 @@ declare module fabric { scale(value: number): IObject; scaleToHeight(value: number): IObject; scaleToWidth(value: number): IObject; - sendBackwards(): IObject; + sendBackwards(intersecting?: boolean): IObject; sendToBack(): IObject; set (properties: IObjectOptions): IObject; diff --git a/fabricjs/fabricjs.d.ts.tscparams b/fabricjs/fabricjs.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/fabricjs/fabricjs.d.ts.tscparams +++ b/fabricjs/fabricjs.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/fancybox/fancybox-tests.ts.tscparams b/fancybox/fancybox-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/fancybox/fancybox-tests.ts.tscparams +++ b/fancybox/fancybox-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/fancybox/fancybox.d.ts.tscparams b/fancybox/fancybox.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/fancybox/fancybox.d.ts.tscparams +++ b/fancybox/fancybox.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/flexSlider/flexSlider-tests.ts.tscparams b/flexSlider/flexSlider-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/flexSlider/flexSlider-tests.ts.tscparams +++ b/flexSlider/flexSlider-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/flexSlider/flexSlider.d.ts.tscparams b/flexSlider/flexSlider.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/flexSlider/flexSlider.d.ts.tscparams +++ b/flexSlider/flexSlider.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/flot/jquery.flot.d.ts.tscparams b/flot/jquery.flot.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/flot/jquery.flot.d.ts.tscparams +++ b/flot/jquery.flot.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/foundation/foundation-tests.ts.tscparams b/foundation/foundation-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/foundation/foundation-tests.ts.tscparams +++ b/foundation/foundation-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/foundation/foundation.d.ts.tscparams b/foundation/foundation.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/foundation/foundation.d.ts.tscparams +++ b/foundation/foundation.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/fullCalendar/fullCalendar-tests.ts.tscparams b/fullCalendar/fullCalendar-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/fullCalendar/fullCalendar-tests.ts.tscparams +++ b/fullCalendar/fullCalendar-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/gamequery/gamequery-tests.ts.tscparams b/gamequery/gamequery-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/gamequery/gamequery-tests.ts.tscparams +++ b/gamequery/gamequery-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/gapi/gapi.d.ts b/gapi/gapi.d.ts index 8a9206663..d9d6fb90b 100644 --- a/gapi/gapi.d.ts +++ b/gapi/gapi.d.ts @@ -141,6 +141,23 @@ declare module gapi.client { statusText: string; } ) => any):void; + /** + * HttpRequest supports promises. + */ + then(success:(response:{ + result:T; + body:string; + headers?: any[]; + status?: number; + statusText?: string + })=>void, + failure:(response:{ + result:T; + body:string; + headers?: any[]; + status?: number; + statusText?: string + })=>void): void; } /** * Represents an HTTP Batch operation. Individual HTTP requests are added with the add method and the batch is executed using execute. diff --git a/giraffe/giraffe-tests.ts.tscparams b/giraffe/giraffe-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/giraffe/giraffe-tests.ts.tscparams +++ b/giraffe/giraffe-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/giraffe/giraffe.d.ts.tscparams b/giraffe/giraffe.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/giraffe/giraffe.d.ts.tscparams +++ b/giraffe/giraffe.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/globalize/globalize-tests.ts.tscparams b/globalize/globalize-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/globalize/globalize-tests.ts.tscparams +++ b/globalize/globalize-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/goJS/goJS-tests.ts.tscparams b/goJS/goJS-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/goJS/goJS-tests.ts.tscparams +++ b/goJS/goJS-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/goJS/goJS.d.ts.tscparams b/goJS/goJS.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/goJS/goJS.d.ts.tscparams +++ b/goJS/goJS.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/google.visualization/google.visualization.d.ts b/google.visualization/google.visualization.d.ts index f45f3f6a3..2657d8274 100644 --- a/google.visualization/google.visualization.d.ts +++ b/google.visualization/google.visualization.d.ts @@ -58,7 +58,7 @@ declare module google { setRefreshInterval(interval: number): void; setOption(key: string, value: any): void; setOptions(options: Object): void; - setView(view_spec: DataView): void; + setView(view_spec: string): void; } //#endregion @@ -71,17 +71,68 @@ declare module google { addColumn(descriptionObject: DataTableColumnDescription): number; addRow(cellObject: DataObjectCell): number; addRow(cellArray?: any[]): number; - addRows(count: number): number; - addRows(array: DataObjectCell[][]): number; - addRows(array: any[]): number; + addRows(numberOfEmptyRows: number): number; + addRows(rows: DataObjectCell[][]): number; + addRows(rows: any[][]): number; + clone(): DataTable; + getColumnId(columnIndex: number): String; + getColumnLabel(columnIndex: number): string; + getColumnPattern(columnIndex: number): string; + getColumnProperties(columnIndex: number): Properties; + getColumnProperty(columnIndex: number, name: string): any; + getColumnRange(columnIndex: number): { min: any; max: any }; + getColumnRole(columnIndex: string): string; + getColumnType(columnIndex: number): string; + getDistinctValues(columnIndex: number): any[]; getFilteredRows(filters: DataTableCellFilter[]): number[]; getFormattedValue(rowIndex: number, columnIndex: number): string; - getValue(rowIndex: number, columnIndex: number): any; getNumberOfColumns(): number; getNumberOfRows(): number; + getProperty(rowIndex: number, columnIndex: number, name: string): any; + getProperties(rowIndex: number, columnIndex: number): Properties; + getRowProperties(rowIndex: number): Properties; + getRowProperty(rowIndex: number, name: string): Properties; + getSortedRows(sortColumn: number): number[]; + getSortedRows(sortColumn: SortByColumn): number[]; + getSortedRows(sortColumns: number[]): number[]; + getSortedRows(sortColumns: SortByColumn[]): number[]; + getTableProperties(): Properties; + getTableProperty(name: string): any; + getValue(rowIndex: number, columnIndex: number): any; + insertColumn(columnIndex: number, type: string, label?: string, id?: string): void; + insertRows(rowIndex: number, numberOfEmptyRows: number): void; + insertRows(rowIndex: number, rows: DataObjectCell[][]): void; + insertRows(rowIndex: number, rows: any[][]): void; + removeColumn(columnIndex: number): void; + removeColumns(columnIndex: number, numberOfColumns: number): void; removeRow(rowIndex: number): void; removeRows(rowIndex: number, numberOfRows: number): void; + setCell(rowIndex: number, columnIndex: number, value?: any, formattedValue?: string, properties?: Properties): void; setColumnLabel(columnIndex: number, label: string): void; + setColumnProperty(columnIndex: number, name: string, value: any): void; + setColumnProperties(columnIndex: number, properties: Properties): void; + setFormattedValue(rowIndex: number, columnIndex: number, formattedValue: string): void; + setProperty(rowIndex: number, columnIndex: number, name: string, value: any): void; + setProperties(rowIndex: number, columnIndex: number, properties: Properties): void; + setRowProperty(rowIndex: number, name: string, value: any): void; + setRowProperties(rowIndex: number, properties: Properties): void; + setTableProperty(name: string, value: any): void; + setTableProperties(properties: Properties): void; + setValue(rowIndex: number, columnIndex: number, value: any): void; + sort(sortColumn: number): number[]; + sort(sortColumn: SortByColumn): number[]; + sort(sortColumns: number[]): number[]; + sort(sortColumns: SortByColumn[]): number[]; + toJSON(): string; + } + + export interface Properties { + [property: string]: any + } + + export interface SortByColumn { + column: number; + desc: boolean; } export interface DataTableColumnDescription { @@ -113,6 +164,9 @@ declare module google { export interface DataTableCellFilter { column: number; + value?: any; + minValue?: any; + maxValue?: any; } export interface DataObjectCell { @@ -139,7 +193,56 @@ declare module google { export class DataView { constructor(data: DataTable); constructor(data: DataView); + + getColumnId(columnIndex: number): String; + getColumnLabel(columnIndex: number): string; + getColumnPattern(columnIndex: number): string; + getColumnProperty(columnIndex: number, name: string): any; + getColumnRange(columnIndex: number): { min: any; max: any }; + getColumnType(columnIndex: number): string; + getDistinctValues(columnIndex: number): any[]; + getFilteredRows(filters: DataTableCellFilter[]): number[]; + getFormattedValue(rowIndex: number, columnIndex: number): string; + getNumberOfColumns(): number; + getNumberOfRows(): number; + getProperty(rowIndex: number, columnIndex: number, name: string): any; + getProperties(rowIndex: number, columnIndex: number): Properties; + getRowProperty(rowIndex: number, name: string): Properties; + getSortedRows(sortColumn: number): number[]; + getSortedRows(sortColumn: SortByColumn): number[]; + getSortedRows(sortColumns: number[]): number[]; + getSortedRows(sortColumns: SortByColumn[]): number[]; + getTableProperty(name: string): any; + getValue(rowIndex: number, columnIndex: number): any; + getTableColumnIndex(viewColumnIndex: number): number; + getTableRowIndex(viewRowIndex: number): number; + getViewColumnIndex(tableColumnIndex: number): number; + getViewColumns(): number[]; + getViewRowIndex(tableRowIndex: number): number; + getViewRows(): number[]; + + hideColumns(columnIndexes: number[]): void; + hideRows(min: number, max: number): void; + hideRows(rowIndexes: number[]): void; + + setColumns(columnIndexes: number[]): void; + setColumns(columnIndexes: ColumnSpec[]): void; setColumns(columnIndexes: any[]): void; + setRows(min: number, max: number): void; + setRows(rowIndexes: number[]): void; + + toDataTable(): DataTable; + toJSON(): string; + } + + export interface ColumnSpec { + calc: (dataTable: DataTable, row: number) => any; + type: string; + label?: string; + id?: string; + sourceColumn?: number; + properties?: Properties; + role?: string; } //#endregion diff --git a/gruntjs/gruntjs-tests.ts b/gruntjs/gruntjs-tests.ts index 853cac370..6b8607329 100644 --- a/gruntjs/gruntjs-tests.ts +++ b/gruntjs/gruntjs-tests.ts @@ -73,3 +73,46 @@ exports = (grunt: IGrunt) => { fileMaps[0].src.length; fileMaps[0].dest; }; + +// Official grunt task template from +// https://github.com/gruntjs/grunt-init-gruntplugin/blob/master/root/tasks/name.js +exports.exports = function(grunt: IGrunt) { + + // Please see the Grunt documentation for more information regarding task + // creation: http://gruntjs.com/creating-tasks + + grunt.registerMultiTask('taskName', 'task description', function() { + // Merge task-specific and/or target-specific options with these defaults. + var options = this.options({ + punctuation: '.', + separator: ', ' + }); + + // Iterate over all specified file groups. + this.files.forEach(function(f: grunt.file.IFilesConfig) { + // Concat specified files. + var src = f.src.filter(function(filepath: string) { + // Warn on and remove invalid source files (if nonull was set). + if (!grunt.file.exists(filepath)) { + grunt.log.warn('Source file "' + filepath + '" not found.'); + return false; + } else { + return true; + } + }).map(function(filepath) { + // Read file source. + return grunt.file.read(filepath); + }).join(grunt.util.normalizelf(options.separator)); + + // Handle options. + src += options.punctuation; + + // Write the destination file. + grunt.file.write(f.dest, src); + + // Print a success message. + grunt.log.writeln('File "' + f.dest + '" created.'); + }); + }); + +}; \ No newline at end of file diff --git a/gruntjs/gruntjs.d.ts b/gruntjs/gruntjs.d.ts index 86923c56e..8efa08ef6 100644 --- a/gruntjs/gruntjs.d.ts +++ b/gruntjs/gruntjs.d.ts @@ -690,6 +690,11 @@ declare module grunt { * Log a list of obj properties (good for debugging flags). */ writeflags(obj: any): T + + /** + * Log an warning with grunt.log.warn + */ + warn(msg: string): T } /** diff --git a/hapi/hapi-tests.ts b/hapi/hapi-tests.ts new file mode 100644 index 000000000..fcc870af6 --- /dev/null +++ b/hapi/hapi-tests.ts @@ -0,0 +1,26 @@ +/// + +import Hapi = require('hapi'); + +// Create a server with a host and port +var server = Hapi.createServer('localhost', 8000); + +// Add the route +server.route({ + method: 'GET', + path: '/hello', + handler: function (request: Hapi.Request, reply: Function) { + reply('hello world'); + } +}); + +server.route([{ + method: 'GET', + path: '/hello2', + handler: function (request: Hapi.Request, reply: Function) { + reply('hello world2'); + } +}]); + +// Start the server +server.start(); diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts new file mode 100644 index 000000000..68b366d6d --- /dev/null +++ b/hapi/hapi.d.ts @@ -0,0 +1,457 @@ +// Type definitions for hapi +// Project: http://github.com/spumko/hapi +// Definitions by: Hakubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Hapi { + export interface ServerOptions { + app?: any; +// cache?: string; +// cache?: { +// engine: any; +// }; + cache?: any; +// cors?: boolean; +// cors?: { +// origin?: Array; +// isOriginExposed?: boolean; +// matchOrigin?: boolean; +// maxAge?: number; +// headers?: Array; +// additionalHeaders?: Array; +// methods?: Array; +// additionalMethods?: Array; +// exposedHeaders?: Array; +// additionalExposedHeaders?: Array; +// credentials?: boolean; +// }; + cors?: any; +// security?: boolean; +// security?: { +// hsts?: boolean; +// hsts?: { +// maxAge: number; +// includeSubdomains: boolean; +// }; +// xframe?: boolean; +// xframe?: string; +// xframe?: { +// rule: string; +// source: any; +// }; +// xss?: boolean; +// noOpen?: boolean; +// noSniff?: boolean; +// }; + security?: any; + debug?: { + request: Array; + }; + files?: { + relativeTo: string; + etagsCacheMaxSize: number; + }; + json?: { +// replacer?: () => void; +// replacer?: Array<() => void>; + replacer?: any; + space?: number; + }; + labels?: Array; + load?: { + maxHeapUsedBytes?: number; + maxRssBytes?: number; + maxEventLoopDelay?: number; + sampleInterval?: number; + }; + location?: string; + payload?: { + maxBytes: number; + uploads: string; + }; + plugins?: any; + router?: { + isCaseSensitive?: boolean; + stripTrailingSlash?: boolean; + }; + state?: { + cookies: { + parse?: boolean; + failAction?: string; + clearInvalid?: boolean; + strictHeader?: boolean; + } + }; + timeout?: { +// server?: boolean; +// server?: number; + server?: any; +// client?: boolean; +// client?: number; + client?: any; +// socket?: boolean; +// socket?: number; + socket?: any; + }; + tls?: any; //This should be Node.tls + maxSockets?: number; + validation?: any; + views?: ServerView; + } + + export class Pack { + require(name: string, options: {}, callback: Function): void; + } + + export interface ServerView { + engines: { + [extension: string]: string; + module?: string; +// compile: ( +// template: string, +// options: any +// ) => void; +// compile: ( +// template: string, +// options: any, +// callback: ( +// err: any, +// compiled: ( +// context: any, +// options: any, +// callback: ( +// err: any, +// rendered: boolean +// ) => void +// ) => void +// ) => void +// ) => void; + compile?: any; + }; + defaultExtension?: string; + path?: string; + partialsPath?: string; + helpersPath?: string; + basePath?: string; + layout?: boolean; + layoutPath?: string; + layoutKeyword?: string; + encoding?: string; + isCached?: boolean; + allowAbsolutePaths?: boolean; + allowInsecureAccess?: boolean; + compileOptions?: any; + runtimeOptions?: any; + contentType?: string; + compileMode?: string; + } + + export interface RouteOptions { + path: string; + method: string; +// vhost?: string; +// vhost?: Array; + vhost?: any; +// handler: string; +// handler: (request: Request, reply: Function) => void; +// handler: { +// file: string; +// file: (request: Request) => void; +// file: { +// path: string; +// filename?: string; +// mode?: boolean; +// mode?: string; +// lookupCompressed: boolean; +// }; +// directory: { +// path: string; +// path: Array; +// path: (request: Request) => string; +// path: (request: Request) => Array; +// index?: boolean; +// listing?: boolean; +// showHidden?: boolean; +// redirectToSlash?: boolean; +// lookupCompressed?: boolean; +// defaultExtension?: string; +// }; +// proxy?: { +// host?: string; +// port?: number; +// protocol?: string; +// uri?: string; +// passThrough?: boolean; +// rejectUnauthorized?: boolean; +// xforward?: boolean; +// redirects?: boolean; +// redirects?: number; +// timeout?: number; +// +// mapUri?: (request: Request, callback: (err: any, uri: string, headers: {[key: string]: string}) => void) => void; +// onResponse: ( +// err: any, +// res: any,//Node Response +// req: any,//Node Request +// reply: () => void, +// settings: any, +// ttl: number +// ) => void; +// ttl: number; +// }; +// view: string; +// view: { +// template: string; +// context: { +// payload: any; +// params: any; +// query: any; +// pre: any; +// } +// }; +// config: { +// handler: any; +// bind: any; +// app: any; +// plugins: { +// [name: string]: any; +// }; +// pre: Array<() => void>; +// validate: { +// headers: any; +// params: any; +// query: any; +// payload: any; +// errorFields?: any; +// failAction?: string; +// failAction?: (source: string, error: any, next: () => void) => void; +// }; +// payload: { +// output: { +// data: any; +// stream: any; +// file: any; +// }; +// parse?: any; +// allow?: string; +// allow?: Array; +// override?: string; +// maxBytes?: number; +// uploads?: number; +// failAction?: string; +// }; +// response: { +// schema: any; +// sample: number; +// failAction: string; +// }; +// cache: { +// privacy: string; +// expiresIn: number; +// expiresAt: number; +// }; +// auth: string; +// auth: boolean; +// auth: { +// mode: string; +// strategies: Array; +// payload?: boolean; +// payload?: string; +// tos?: boolean; +// tos?: string; +// scope?: string; +// scope?: Array; +// entity: string; +// }; +// cors?: boolean; +// jsonp?: string; +// description?: string; +// notes?: string; +// notes?: Array; +// tags?: Array; +// } +// }; + handler: any; + } + + export class Server { + app: any; + methods: Array<() => void>; + info: { + port: number; + host?: string; + protocol?: string; + uri?: string; + }; + listener: any;// Node Http server + load: { + eventLoopDelay: number; + heapUsed: number; + rss: number; + }; + pack: Pack; + plugins: { + [pluginName: string]: any; + }; + + start(callback?: () => void): void; + stop(options?: {timeout: number;}, callback?: () => void): void; + route(options: RouteOptions): void; + route(routes: Array): void; + table(host?: string): Array; + log(tags: string, data?: string, timestamp?: number): void; + log(tags: Array, data?: string, timestamp?: number): void; + log(tags: string, data?: any, timestamp?: number): void; + log(tags: Array, data?: any, timestamp?: number): void; + state(name: string, options?: { + ttl: number; + isSecure: boolean; + isHttpOnly: boolean; + path: string; + domain: string; + autoValue: (request: Request, next: (err: any, value: any) => void) => void; + encoding?: string; + sign: any; + password: string; + iron: any; + }): void; + views(options: ServerView): void; + cache(name: string, options: { + expiresIn: number; + expiresAt: number; + staleIn: number; + staleTimeout: number; + cache: string; + }): void; + + auth: { + scheme(name: string, scheme: { + name: string; + scheme: (server: Server, options: any) => (authenticate: any, payload: any, response: any) => void; + }): void; + strategy: any; + }; + 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; + inject(options: any, callback: any): void; + handler(name: string, method: (name: string, options: any) => void): void; + } + + export interface Request { + app: any; + auth: { + isAuthenticated: boolean; + credentials: Object; + artifacts: Object; + session: Object + }; + domain: any; + headers: Object; + id: number; + info: { + received: number; + remoteAddress: string; + remotePort: number; + referrer: string; + host: string; + }; + method: string; + mime?: string; + params: any; + path: string; + payload: any; + plugins: Object; + pre: Object; + response: Object; + responses: Object; + query: Object; + raw: { + req: any; //http.ClientRequest + res: any; //http.ClientResponse + }; + route: string; + server: Server; + session: any; + state: Object; + url: Object; + + setUrl? (url: string): void; + setMethod? (method: string): void; + log (tags: string, data?: string, timestamp?: number): void; + log (tags: string, data?: Object, timestamp?: number): void; + log (tags: string[], data?: string, timestamp?: number): void; + log (tags: string[], data?: Object, timestamp?: number): void; + getLog(): string[]; + getLog(tag: string): string[]; + getLog(tags: string[]): string[]; + tail(name?: string): Function; + } + + export interface Response { + statusCode: number; + headers: Object; + source: any; + variety: string; + app: any; + plugins: Object; + settings: { + encoding: string; + charset: string; + location: string; + ttl: number; + stringify: any; + passThrough: boolean; + } + + code (statusCode: number): void; + header (name: string, value: string, options?: { + append: boolean; + separator: string; + override: boolean; + }): void; + type (mimeType: string): void; + bytes (length: number): void; + vary (header: string): void; + location (location: string): void; + created (location: string): void; + redirect (location: string): void; + encoding (encoding: string): void; + charset (charset: string): void; + ttl (ttl: number): void; + state (name: string, value: string, options?: any): void; + unstate (name: string): void; + + replacer (method: Function): void; + replacer (method: Array): void; + spaces (count: number): void; + + temporary (isTemporary: boolean): void; + permanent (isPermanent: boolean): void; + rewritable (isRewritable: boolean): void; + } + + export module reply { + function file(path: string, options: { + filePath: string; + options: { + filename: string; + mode: string + } + }): void; + + function view(template: string, context?: Object, options?: Object): Response; + function close(options?: Object): void; + function proxy(options: Object): void; + + export function reply(result: any): any; + } + + export function createServer (host: string, port: number, options?: ServerOptions): Server; +} + +declare module "hapi" { + export = Hapi; +} diff --git a/history/history-tests.ts.tscparams b/history/history-tests.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/history/history-tests.ts.tscparams +++ b/history/history-tests.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/history/history.d.ts b/history/history.d.ts index a8a3c4004..07a31d011 100644 --- a/history/history.d.ts +++ b/history/history.d.ts @@ -1,13 +1,13 @@ -// Type definitions for History.js -// Project: https://github.com/balupton/History.js -// Definitions by: Boris Yankov +// Type definitions for History.js 1.8.0 +// Project: https://github.com/browserstate/history.js +// Definitions by: Boris Yankov , Gidon Junge // Definitions: https://github.com/borisyankov/DefinitelyTyped interface HistoryAdapter { - bind(element, event, callback); - trigger(element, event); - onDomLoad(callback); + bind(element: any, event: string, callback: () => void); + trigger(element: any, event: string); + onDomLoad(callback: () => void); } // Since History is defined in lib.d.ts as well @@ -17,15 +17,45 @@ interface HistoryAdapter { // var Historyjs: Historyjs = History; interface Historyjs { + enabled: boolean; - pushState(data, title, url); - replaceState(data, title, url); - getState(); - getHash(); + + pushState(data: any, title: string, url: string); + replaceState(data: any, title: string, url: string); + getState(): HistoryState; + getStateByIndex(index: number): HistoryState; + getCurrentIndex(): number; + getHash(): string; + Adapter: HistoryAdapter; - back(); - forward(); - go(X); - log(...messages: any[]); - debug(...messages: any[]); + + back(): void; + forward(): void; + go(x: Number): void; + + log(...messages: any[]): void; + debug(...messages: any[]): void; + + options: HistoryOptions; } + +interface HistoryState { + data?: any; + title?: string; + url: string; +} + +interface HistoryOptions { + hashChangeInterval?: number; + safariPollInterval?: number; + doubleCheckInterval?: number; + disableSuid?: boolean; + storeInterval?: number; + busyDelay?: number; + debug?: boolean; + initialTitle?: string; + html4Mode?: boolean; + delayInit?: number; + + +} \ No newline at end of file diff --git a/history/history.d.ts.tscparams b/history/history.d.ts.tscparams index e16c76dff..d3f5a12fa 100644 --- a/history/history.d.ts.tscparams +++ b/history/history.d.ts.tscparams @@ -1 +1 @@ -"" + diff --git a/htmlparser2/htmlparser2-tests.ts b/htmlparser2/htmlparser2-tests.ts new file mode 100644 index 000000000..53f6ee2aa --- /dev/null +++ b/htmlparser2/htmlparser2-tests.ts @@ -0,0 +1,24 @@ +/// +/** + * Created by staticfunction on 8/4/14. + */ +import htmlparser = require("htmlparser2"); + +var parser = new htmlparser.Parser({ + onopentag: (name:string, attribs:{[s:string]:string}) => { + if(name === "script" && attribs['type'] === "text/javascript"){ + console.log("JS! Hooray!"); + } + }, + ontext: (text: string) => { + console.log("-->", text); + }, + onclosetag: (tagname:string) => { + if(tagname === "script"){ + console.log("That's it?!"); + } + } +}); + +parser.write("Xyz "); +parser.end(); diff --git a/htmlparser2/htmlparser2.d.ts b/htmlparser2/htmlparser2.d.ts new file mode 100644 index 000000000..77fb0b983 --- /dev/null +++ b/htmlparser2/htmlparser2.d.ts @@ -0,0 +1,89 @@ +// Type definitions for htmlparser2 v3.7.x +// Project: https://github.com/fb55/htmlparser2/ +// Definitions by: James Roland Cabresos +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module "htmlparser2" { + + export interface Handler { + onopentag?:(name:string, attribs:{[type:string]: string}) => void; + onopentagname?:(name:string) => void; + onattribute?:(name:string, value:string) => void; + ontext?:(text:string) => void; + onclosetag?: (text:string) => void; + onprocessinginstruction?:(name:string, data:string) => void; + oncomment?:(data:string) => void; + oncommentend?:() => void; + oncdatastart?:() => void; + oncdataend?:() => void; + onerror?:(error:Error) => void; + onreset?:() => void; + onend?:() => void; + } + + export interface Options { + + /*** + * Indicates whether special tags (