diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index e9d91ae10..2c07fac20 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -2,6 +2,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakame/dt-contributors-generator). (but run scripts are manual operation. please wait :P) +* [:link:](abs/abs.d.ts) [abs](https://github.com/IonicaBizau/node-abs) by [Aya Morisawa](https://github.com/AyaMorisawa) +* [:link:](absolute/absolute.d.ts) [absolute](https://github.com/bahamas10/node-absolute) by [Aya Morisawa](https://github.com/AyaMorisawa) * [:link:](acc-wizard/acc-wizard.d.ts) [acc-wizard](https://github.com/sathomas/acc-wizard) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](accounting/accounting.d.ts) [accounting.js](http://josscrowcroft.github.io/accounting.js) by [Sergey Gerasimov](https://github.com/gerich-home) * [:link:](ace/ace.d.ts) [Ace Ajax.org Cloud9 Editor](http://ace.ajax.org) by [Diullei Gomes](https://github.com/Diullei) @@ -58,6 +60,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](angular-signalr-hub/angular-signalr-hub.d.ts) [angular-signalr-hub](https://github.com/JustMaier/angular-signalr-hub) by [Adam Santaniello](https://github.com/AdamSantaniello) * [:link:](angular-spinner/angular-spinner.d.ts) [angular-spinner.js](https://github.com/urish/angular-spinner) by [Marcin Biegała](https://github.com/Biegal) * [:link:](angular-storage/angular-storage.d.ts) [angular-storage](https://github.com/auth0/angular-storage) by [Matthew DeKrey](https://github.com/mdekrey) +* [:link:](angular-strap/angular-strap.d.ts) [angular-strap v2.2.x](http://mgcrea.github.io/angular-strap) by [Sam Herrmann](https://github.com/samherrmann) * [:link:](angular-ui-tree/angular-ui-tree.d.ts) [angular-ui-tree](https://github.com/angular-ui-tree/angular-ui-tree) by [Calvin Fernandez](https://github.com/CalvinFernandez) * [:link:](angular.throttle/angular.throttle.d.ts) [angular.throttle](https://github.com/BaggersIO/angular.throttle) by [Stefan Steinhart](https://github.com/reppners) * [:link:](angular-ui-sortable/angular-ui-sortable.d.ts) [angular.ui.sortable module](https://github.com/angular-ui/ui-sortable) by [Thodoris Greasidis](https://github.com/thgreasi) @@ -91,6 +94,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](assertion-error/assertion-error.d.ts) [assertion-error](https://github.com/chaijs/assertion-error) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](assertsharp/assertsharp.d.ts) [assertsharp](https://www.npmjs.com/package/assertsharp) by [Bruno Leonardo Michels](https://github.com/brunolm) * [:link:](async/async.d.ts) [Async](https://github.com/caolan/async) by [Boris Yankov](https://github.com/borisyankov), [Arseniy Maximov](https://github.com/kern0), [Joe Herman](https://github.com/Penryn) +* [:link:](async-writer/async-writer.d.ts) [async-writer](https://github.com/marko-js/async-writer) by [Yuce Tekol](http://yuce.me) * [:link:](asyncblock/asyncblock.d.ts) [asyncblock](https://github.com/scriby/asyncblock) by [Hiroki Horiuchi](https://github.com/horiuchi) * [:link:](atmosphere/atmosphere.d.ts) [Atmosphere](https://github.com/Atmosphere/atmosphere-javascript) by [Kai Toedter](https://github.com/toedter) * [:link:](atom/atom.d.ts) [Atom](https://atom.io) by [vvakame](https://github.com/vvakame) @@ -98,19 +102,21 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](atom-keymap/atom-keymap.d.ts) [atom-keymap](https://github.com/atom/atom-keymap) by [Vadim Macagon](https://github.com/enlight) * [:link:](atpl/atpl.d.ts) [atpl](https://github.com/soywiz/atpl.js) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](auth0/auth0.d.ts) [Auth0.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) -* [:link:](auth0.widget/auth0.widget.d.ts) [Auth0Widget.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) * [:link:](auth0.lock/auth0.lock.d.ts) [Auth0Widget.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) +* [:link:](auth0.widget/auth0.widget.d.ts) [Auth0Widget.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) * [:link:](auto-launch/auto-launch.d.ts) [auto-launch](https://github.com/Teamwork/node-auto-launch) by [rhysd](https://github.com/rhysd) * [:link:](autobahn/autobahn.d.ts) [AutobahnJS](http://autobahn.ws/js) by [Elad Zelingher](https://github.com/darkl), [Andy Hawkins](https://github.com/a904guy/,http://a904guy.com/,http://www.bmbsqd.com) * [:link:](autoprefixer-core/autoprefixer-core.d.ts) [Autoprefixer Core](https://github.com/postcss/autoprefixer-core) by [Asana](https://asana.com) * [:link:](aws-sdk/aws-sdk.d.ts) [aws-sdk](https://github.com/aws/aws-sdk-js) by [midknight41](https://github.com/midknight41) * [:link:](axios/axios.d.ts) [axios](https://github.com/mzabriskie/axios) by [Marcel Buesing](https://github.com/marcelbuesing) * [:link:](node-azure/azure.d.ts) [Azure SDK for Node](https://github.com/WindowsAzure/azure-sdk-for-node) by [Andrew Gaspar](https://github.com/AndrewGaspar), [Anti Veeranna](https://github.com/antiveeranna), [Maxime LUCE](https://github.com/SomaticIT) +* [:link:](babylonjs/babylon.d.ts) [BabylonJS](http://www.babylonjs.com) by [David Catuhe](https://github.com/deltakosh) * [:link:](backbone/backbone-global.d.ts) [Backbone](http://backbonejs.org) by [Boris Yankov](https://github.com/borisyankov), [Natan Vivo](https://github.com/nvivo) * [:link:](backbone/backbone.d.ts) [Backbone](http://backbonejs.org) by [Boris Yankov](https://github.com/borisyankov), [Natan Vivo](https://github.com/nvivo) * [:link:](backbone-associations/backbone-associations.d.ts) [Backbone-associations](https://github.com/dhruvaray/backbone-associations) by [Craig Brett](https://github.com/craigbrett17) * [:link:](backbone-relational/backbone-relational.d.ts) [Backbone-relational](http://backbonerelational.org) by [Eirik Hoem](https://github.com/eirikhm) * [:link:](backbone.layoutmanager/backbone.layoutmanager.d.ts) [Backbone.LayoutManager](http://layoutmanager.org) by [He Jiang](https://github.com/hejiang2000) +* [:link:](backbone.localstorage/backbone.localstorage.d.ts) [backbone.localStorage](https://github.com/jeromegn/Backbone.localStorage) by [Louis Grignon](https://github.com/lgrignon) * [:link:](backbone.paginator/backbone.paginator.d.ts) [backbone.paginator](https://github.com/backbone-paginator/backbone.paginator) by [Nyamazing](https://github.com/Nyamazing) * [:link:](backbone.radio/backbone.radio.d.ts) [Backbone.Radio](https://github.com/marionettejs/backbone.radio) by [Peter Palotas](https://github.com/alphaleonis) * [:link:](backgrid/backgrid.d.ts) [Backgrid](http://backgridjs.com) by [Jeremy Lujan](https://github.com/jlujan) @@ -120,8 +126,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](basic-auth/basic-auth.d.ts) [basic-auth](https://github.com/jshttp/basic-auth) by [Clément Bourgeois](https://github.com/moonpyk) * [:link:](batch-stream/batch-stream.d.ts) [batch-stream](https://github.com/segmentio/batch-stream) by [Nicholas Penree](http://github.com/drudge) * [:link:](bcrypt/bcrypt.d.ts) [bcrypt](https://www.npmjs.org/package/bcrypt) by [Peter Harris](https://github.com/codeanimal) +* [:link:](bcrypt-nodejs/bcrypt-nodejs.d.ts) [bcrypt-nodejs](https://github.com/shaneGirish/bcrypt-nodejs) by [David Broder-Rodgers](https://github.com/DavidBR-SW) +* [:link:](bcryptjs/bcryptjs.d.ts) [bcryptjs](https://github.com/dcodeIO/bcrypt.js) by [Joshua Filby](https://github.com/Joshua-F) * [:link:](benchmark/benchmark.d.ts) [Benchmark](http://benchmarkjs.com) by [Asana](https://asana.com) * [:link:](better-curry/better-curry.d.ts) [better-curry](https://github.com/pocesar/js-bettercurry) by [Paulo Cesar](https://github.com/pocesar) +* [:link:](bezier-easing/bezier-easing.d.ts) [bezier-easing](https://github.com/gre/bezier-easing) by [brian ridley](https://github.com/ptlis) * [:link:](bgiframe/typescript.bgiframe.d.ts) [bgiframe](https://github.com/sumegizoltan/BgiFrame) by [Zoltan Sumegi](https://github.com/sumegizoltan) * [:link:](big.js/big.js.d.ts) [big.js](https://github.com/MikeMcl/big.js) by [Steve Ognibene](https://github.com/nycdotnet) * [:link:](bigint/bigint.d.ts) [BigInt](https://github.com/Evgenus/BigInt) by [Eugene Chernyshov](https://github.com/Evgenus) @@ -130,7 +139,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](bigscreen/bigscreen.d.ts) [BigScreen](http://brad.is/coding/BigScreen) by [Douglas Eichelberger](https://github.com/dduugg) * [:link:](bitwise-xor/bitwise-xor.d.ts) [bitwise-xor](https://github.com/czzarr/node-bitwise-xor) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](blob-stream/blob-stream.d.ts) [blob-stream](https://github.com/devongovett/blob-stream) by [Eric Hillah](https://github.com/erichillah) -* [:link:](bluebird/bluebird.d.ts) [bluebird](https://github.com/petkaantonov/bluebird) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](blue-tape/blue-tape.d.ts) [blue-tape](https://github.com/spion/blue-tape) by [Haoqun Jiang](https://github.com/sodatea) +* [:link:](bluebird/bluebird.d.ts) [bluebird](https://github.com/petkaantonov/bluebird) by [Bart van der Schoor](https://github.com/Bartvds), [falsandtru](https://github.com/falsandtru) * [:link:](bluebird-retry/bluebird-retry.d.ts) [bluebird-retry](https://github.com/jut-io/bluebird-retry) by [Pascal Vomhoff](https://github.com/pvomhoff) * [:link:](blueimp-md5/blueimp-md5.d.ts) [blueimp-md5](https://github.com/blueimp/JavaScript-MD5) by [Ray Martone](https://github.com/rmartone) * [:link:](body-parser/body-parser.d.ts) [body-parser](http://expressjs.com) by [Santi Albo](https://github.com/santialbo), [VILIC VANE](https://vilic.info), [Jonathan Häberle](https://github.com/dreampulse) @@ -154,30 +164,36 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](breeze/breeze.d.ts) [Breeze 1.5.x](http://www.breezejs.com) by [Boris Yankov](https://github.com/borisyankov), [IdeaBlade](https://github.com/IdeaBlade/Breeze) * [:link:](browser-harness/browser-harness.d.ts) [Browser Harness](https://github.com/scriby/browser-harness) by [Chris Scribner](https://github.com/scriby) * [:link:](browser-sync/browser-sync.d.ts) [browser-sync](http://www.browsersync.io) by [Asana](https://asana.com), [Joe Skeen](http://github.com/joeskeen) -* [:link:](browserify/browserify.d.ts) [Browserify](http://browserify.org) by [Andrew Gaspar](https://github.com/AndrewGaspar) +* [:link:](browserify/browserify.d.ts) [Browserify](http://browserify.org) by [Andrew Gaspar](https://github.com/AndrewGaspar), [John Vilk](https://github.com/jvilk) * [:link:](bucks/bucks.d.ts) [bucks.js](https://github.com/CyberAgent/bucks.js) by [Shunsuke Ohtani](https://github.com/zaneli) +* [:link:](buffer-compare/buffer-compare.d.ts) [buffer-compare](https://github.com/soldair/node-buffer-compare) by [Ilya Mochalov](https://github.com/chrootsu) * [:link:](buffer-equal/buffer-equal.d.ts) [buffer-equal](https://github.com/substack/node-buffer-equal) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](bl/bl.d.ts) [BufferList](https://github.com/rvagg/bl) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](buffers/buffers.d.ts) [buffers](https://github.com/substack/node-buffers) by [Robert Hencke](https://github.com/rhencke) * [:link:](bufferstream/bufferstream.d.ts) [bufferstream](https://github.com/dodo/node-bufferstream) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](bull/bull.d.ts) [bull](https://github.com/OptimalBits/bull) by [Bruno Grieder](https://github.com/bgrieder) * [:link:](bunyan-prettystream/bunyan-prettystream.d.ts) [bunyan-prettystream](https://www.npmjs.com/package/bunyan-prettystream) by [Jason Swearingen](https://github.com/jasonswearingen), [Vadim Macagon](https://github.com/enlight) * [:link:](business-rules-engine/business-rules-engine.d.ts) [business-rules-engine](https://github.com/rsamec/form) by [Roman Samec](https://github.com/rsamec) * [:link:](dw-bxslider-4/dw-bxslider-4.d.ts) [bxSlider](https://github.com/stevenwanderski/bxslider-4) by [Piotr Sałkowski](https://github.com/namerci) * [:link:](byline/byline.d.ts) [byline](https://github.com/jahewson/node-byline) by [Stefan Steinhart](https://github.com/reppners) +* [:link:](bytebuffer/bytebuffer.d.ts) [bytebuffer.js](https://github.com/dcodeIO/bytebuffer.js) by [Denis Cappellin](http://github.com/cappellin) * [:link:](bytes/bytes.d.ts) [bytes](https://github.com/visionmedia/bytes.js) by [Zhiyuan Wang](https://github.com/danny8002) * [:link:](c3/c3.d.ts) [C3js](http://c3js.org) by [Marc Climent](https://github.com/mcliment) +* [:link:](cal-heatmap/cal-heatmap.d.ts) [cal-heatmap](https://github.com/wa0x6e/cal-heatmap) by [Chris Baker](https://github.com/RetroChrisB) * [:link:](calq/calq.d.ts) [calq](https://calq.io/docs/client/javascript/reference) by [Eirik Hoem](https://github.com/eirikhm) * [:link:](camel-case/camel-case.d.ts) [camel-case](https://github.com/blakeembrey/camel-case) by [Sam Saint-Pettersen](https://github.com/stpettersens) * [:link:](camljs/camljs.d.ts) [camljs](http://camljs.codeplex.com) by [Andrey Markeev](http://markeev.com) * [:link:](canvasjs/canvasjs.d.ts) [CanvasJS](http://canvasjs.com) by [Mark Overholt](https://github.com/mover5) * [:link:](casperjs/casperjs.d.ts) [CasperJS](http://casperjs.org) by [Jed Mao](https://github.com/jedmao) -* [:link:](chai/chai.d.ts) [chai](http://chaijs.com) by [Jed Mao](https://github.com/jedmao), [Bart van der Schoor](https://github.com/Bartvds), [Andrew Brown](https://github.com/AGBrown), [Olivier Chevet](https://github.com/olivr70) +* [:link:](chai/chai.d.ts) [chai](http://chaijs.com) by [Jed Mao](https://github.com/jedmao), [Bart van der Schoor](https://github.com/Bartvds), [Andrew Brown](https://github.com/AGBrown), [Olivier Chevet](https://github.com/olivr70), [Matt Wistrand](https://github.com/mwistrand) * [:link:](chai-as-promised/chai-as-promised.d.ts) [chai-as-promised](https://github.com/domenic/chai-as-promised) by [jt000](https://github.com/jt000), [Yuki Kokubun](https://github.com/Kuniwak) * [:link:](chai-datetime/chai-datetime.d.ts) [chai-datetime](https://github.com/gaslight/chai-datetime.git) by [Cliff Burger](https://github.com/cliffburger) * [:link:](chai-fuzzy/chai-fuzzy.d.ts) [chai-fuzzy](http://chaijs.com/plugins/chai-fuzzy) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](chai-http/chai-http.d.ts) [chai-http](https://github.com/chaijs/chai-http) by [Wim Looman](https://github.com/Nemo157) * [:link:](chai-jquery/chai-jquery.d.ts) [chai-jquery](https://github.com/chaijs/chai-jquery) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid) +* [:link:](chai-string/chai-string.d.ts) [chai-string](https://github.com/onechiporenko/chai-string) by [Nick Malaguti](https://github.com/nmalaguti) * [:link:](chai-subset/chai-subset.d.ts) [chai-subset](https://github.com/e-conomic/chai-subset) by [Sam Noedel](https://github.com/delta62), [Andrew Brown](https://github.com/AGBrown) +* [:link:](chai-things/chai-things.d.ts) [chai-things](https://github.com/chaijs/chai-things) by [David Broder-Rodgers](https://github.com/DavidBR-SW) * [:link:](chalk/chalk.d.ts) [chalk](https://github.com/sindresorhus/chalk) by [Diullei Gomes](https://github.com/Diullei), [Bart van der Schoor](https://github.com/Bartvds) * [:link:](chance/chance.d.ts) [Chance](http://chancejs.com) by [Chris Bowdon](https://github.com/cbowdon) * [:link:](change-case/change-case.d.ts) [change-case](https://github.com/blakeembrey/change-case) by [Asana](https://asana.com) @@ -190,7 +206,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](chosen/chosen.jquery.d.ts) [Chosen.JQuery](http://harvesthq.github.com/chosen) by [Boris Yankov](https://github.com/borisyankov) * [:link:](chroma-js/chroma-js.d.ts) [Chroma.js](https://github.com/gka/chroma.js) by [Sebastian Brückner](https://github.com/invliD) * [:link:](chrome/chrome-cast.d.ts) [Chrome Cast application development](https://developers.google.com/cast) by [Thomas Stig Jacobsen](https://github.com/eXeDK) -* [:link:](chrome/chrome.d.ts) [Chrome extension development](http://developer.chrome.com/extensions) by [Matthew Kimber](https://github.com/matthewkimber), [otiai10](https://github.com/otiai10), [couven92](https://gitbus.com/couven92) +* [:link:](chrome/chrome.d.ts) [Chrome extension development](http://developer.chrome.com/extensions) by [Matthew Kimber](https://github.com/matthewkimber), [otiai10](https://github.com/otiai10), [couven92](https://github.com/couven92) * [:link:](chrome/chrome-app.d.ts) [Chrome packaged application development](http://developer.chrome.com/apps) by [Adam Lay](https://github.com/AdamLay), [MIZUNE Pine](https://github.com/pine613), [MIZUSHIMA Junki](https://github.com/mzsm) * [:link:](chui/chui.d.ts) [chui](https://github.com/chocolatechipui/chocolatechip-ui) by [Robert Biggs](http://chocolatechip-ui.com) * [:link:](circular-json/circular-json.d.ts) [circular-json](https://github.com/WebReflection/circular-json) by [Jonathan Pevarnek](https://github.com/jpevarnek) @@ -199,16 +215,20 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](cli-color/cli-color.d.ts) [cli-color](https://github.com/medikoo/cli-color) by [Joel Spadin](https://github.com/ChaosinaCan) * [:link:](clone/clone.d.ts) [clone](https://github.com/pvorb/node-clone) by [Kieran Simpson](https://github.com/kierans/DefinitelyTyped) * [:link:](closure-compiler/closure-compiler.d.ts) [closure-compiler](https://github.com/tim-smart/node-closure) by [Martin Probst](https://github.com/mprobst) -* [:link:](codemirror/codemirror-showhint.d.ts) [CodeMirror](https://github.com/marijnh/CodeMirror) by [jacqt](https://github.com/jacqt), [basarat](https://github.com/basarat) -* [:link:](codemirror/codemirror-matchbrackets.d.ts) [CodeMirror](https://github.com/marijnh/CodeMirror) by [Sixin Li](https://github.com/sixinli) * [:link:](codemirror/codemirror.d.ts) [CodeMirror](https://github.com/marijnh/CodeMirror) by [mihailik](https://github.com/mihailik) * [:link:](codemirror/searchcursor.d.ts) [CodeMirror](https://github.com/marijnh/CodeMirror) by [jacqt](https://github.com/jacqt) +* [:link:](codemirror/codemirror-showhint.d.ts) [CodeMirror](https://github.com/marijnh/CodeMirror) by [jacqt](https://github.com/jacqt), [basarat](https://github.com/basarat) +* [:link:](codemirror/codemirror-matchbrackets.d.ts) [CodeMirror](https://github.com/marijnh/CodeMirror) by [Sixin Li](https://github.com/sixinli) * [:link:](coffeeify/coffeeify.d.ts) [coffeeify](https://github.com/jnordberg/coffeeify) by [Qubo](https://github.com/tkQubo) * [:link:](colorbrewer/colorbrewer.d.ts) [colorbrewer](https://github.com/jeanlauliac/colorbrewer) by [Matt Traynham](https://github.com/mtraynham) * [:link:](colors/colors.d.ts) [Colors.js 0.6.0-1](https://github.com/Marak/colors.js) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](cometd/cometd.d.ts) [CometD](http://cometd.org) by [Derek Cicerone](https://github.com/derekcicerone) * [:link:](commander/commander.d.ts) [commanderjs](https://github.com/visionmedia/commander.js) by [Marcelo Dezem](http://github.com/mdezem), [vvakame](http://github.com/vvakame) +* [:link:](commonmark/commonmark.d.ts) [commonmark.js](https://github.com/jgm/commonmark.js) by [Nico Jansen](https://github.com/nicojs) * [:link:](compare-version/compare-version.d.ts) [compare-version](https://www.npmjs.com/package/compare-version) by [Jonathan Pevarnek](https://github.com/jpevarnek) +* [:link:](complex/complex.d.ts) [Complex](https://github.com/arian/Complex) by [Aya Morisawa](https://github.com/AyaMorisawa) +* [:link:](debounce/debounce.d.ts) [compose-function](https://github.com/component/debounce) by [Denis Sokolov](https://github.com/denis-sokolov) +* [:link:](compose-function/compose-function.d.ts) [compose-function](https://github.com/stoeffel/compose-function) by [Denis Sokolov](https://github.com/denis-sokolov) * [:link:](compression/compression.d.ts) [compression](https://github.com/expressjs/compression) by [Santi Albo](https://github.com/santialbo) * [:link:](configstore/configstore.d.ts) [configstore](https://github.com/yeoman/configstore) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](connect/connect.d.ts) [connect](https://github.com/senchalabs/connect) by [Maxime LUCE](https://github.com/SomaticIT) @@ -217,23 +237,31 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](connect-modrewrite/connect-modrewrite.d.ts) [connect-modrewrite](https://github.com/tinganho/connect-modrewrite) by [Tingan Ho](https://github.com/tinganho) * [:link:](connect-mongo/connect-mongo.d.ts) [connect-mongo](https://github.com/kcbanner/connect-mongo) by [Mizuki Yamamoto](https://github.com/Syati) * [:link:](connect-slashes/connect-slashes.d.ts) [connect-slashes](https://github.com/avinoamr/connect-slashes) by [Sam Herrmann](https://github.com/samherrmann) +* [:link:](connect-timeout/connect-timeout.d.ts) [connect-timeout](https://github.com/expressjs/timeout) by [Cyril Schumacher](https://github.com/cyrilschumacher) +* [:link:](console-stamp/console-stamp.d.ts) [console-stamp](https://github.com/starak/node-console-stamp) by [Eric Byers](https://github.com/ericbyers) * [:link:](consolidate/consolidate.d.ts) [consolidate](https://github.com/visionmedia/consolidate.js) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](constant-case/constant-case.d.ts) [constant-case](https://github.com/blakeembrey/constant-case) by [Sam Saint-Pettersen](https://github.com/stpettersens) * [:link:](content-type/content-type.d.ts) [content-type](https://github.com/deoxxa/content-type) by [Pine Mizune](https://github.com/pine613) +* [:link:](contentful-resolve-response/contentful-resolve-response.d.ts) [contentful-resolve-response](https://github.com/contentful/contentful-resolve-response) by [Anton Karsten](https://github.com/antonkarsten) * [:link:](contextjs/contextjs.d.ts) [contextjs](https://github.com/jakiestfu/Context.js) by [Kern Handa](https://github.com/kernhanda) * [:link:](convert-source-map/convert-source-map.d.ts) [convert-source-map](https://github.com/thlorenz/convert-source-map) by [Andrew Gaspar](https://github.com/AndrewGaspar) * [:link:](cookie/cookie.d.ts) [cookie](https://github.com/jshttp/cookie) by [Pine Mizune](https://github.com/pine613) * [:link:](cookie-parser/cookie-parser.d.ts) [cookie-parser](https://github.com/expressjs/cookie-parser) by [Santi Albo](https://github.com/santialbo) +* [:link:](cookies/cookies.d.ts) [cookie-parser](https://github.com/pillarjs/cookies) by [Wang Zishi](https://github.com/WangZishi) * [:link:](cookiejs/cookiejs.d.ts) [cookie.js](https://github.com/js-coder/cookie.js) by [Boltmade](https://github.com/Boltmade) * [:link:](cordova-ionic/plugins/keyboard.d.ts) [Cordova Keyboard plugin](https://github.com/driftyco/ionic-plugins-keyboard) by [Hendrik Maus](https://github.com/hendrikmaus) * [:link:](cordova-plugin-app-version/cordova-plugin-app-version.d.ts) [cordova-plugin-app-version](https://github.com/whiteoctober/cordova-plugin-app-version) by [Markus Wagner](https://github.com/Ritzlgrmft) * [:link:](cordova-plugin-ibeacon/cordova-plugin-ibeacon.d.ts) [cordova-plugin-ibeacon](https://github.com/petermetz/cordova-plugin-ibeacon) by [Markus Wagner](https://github.com/Ritzlgrmft) +* [:link:](cordova-plugin-mapsforge/cordova-plugin-mapsforge.d.ts) [cordova-plugin-mapsforge](https://github.com/afsuarez/mapsforge-cordova-plugin) by [rafw87](https://github.com/rafw87) * [:link:](cordova-plugin-ouralabs/cordova-plugin-ouralabs.d.ts) [cordova-plugin-ouralabs](https://github.com/Justin-Credible/cordova-plugin-ouralabs) by [Justin Unterreiner](https://github.com/Justin-Credible) +* [:link:](cordova-plugin-spinner/cordova-plugin-spinner.d.ts) [cordova-plugin-spinner](https://github.com/Justin-Credible/cordova-plugin-spinner) by [Justin Unterreiner](https://github.com/Justin-Credible) * [:link:](cordovarduino/cordovarduino.d.ts) [Cordovarduino plugin](https://github.com/stereolux/cordovarduino) by [Hendrik Maus](https://github.com/hendrikmaus) * [:link:](core-decorators/core-decorators.d.ts) [core-decorators.js](https://github.com/jayphelps/core-decorators.js) by [Qubo](https://github.com/tkqubo) * [:link:](core-js/core-js.d.ts) [core-js](https://github.com/zloirock/core-js) by [Ron Buckton](http://github.com/rbuckton) * [:link:](cors/cors.d.ts) [cors](https://github.com/troygoode/node-cors) by [Mihhail Lapushkin](https://github.com/mihhail-lapushkin) -* [:link:](couchbase/couchbase.d.ts) [Couchbase Couchnode](https://github.com/couchbase/couchnode) by [Basarat Ali Syed](https://github.com/basarat) +* [:link:](couchbase/couchbase.d.ts) [Couchbase Node.js SDK](https://github.com/couchbase/couchnode) by [Marwan Aouida](https://github.com/maouida) +* [:link:](cradle/cradle.d.ts) [cradle](https://github.com/flatiron/cradle) by [Panu Horsmalahti](https://github.com/panuhorsmalahti) +* [:link:](create-error/create-error.d.ts) [create-error.js](https://github.com/tgriesser/create-error) by [Tanguy Krotoff](https://github.com/tkrotoff) * [:link:](createjs/createjs.d.ts) [CreateJS](http://www.createjs.com) by [Pedro Ferreira](https://bitbucket.org/drk4), [Chris Smith](https://github.com/evilangelist), [Satoru Kimura](https://github.com/gyohk) * [:link:](credential/credential.d.ts) [credential](https://github.com/ericelliott/credential) by [Phú](https://github.com/phuvo) * [:link:](cron/cron.d.ts) [cron](https://www.npmjs.com/package/cron) by [Hiroki Horiuchi](https://github.com/horiuchi) @@ -246,6 +274,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](googlemaps.infobubble/google.maps.infobubble.d.ts) [CSS3 InfoBubble with tabs for Google Maps API V3](http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/src) by [Johan Nilsson](https://github.com/Dashue) * [:link:](csurf/csurf.d.ts) [csurf](https://www.npmjs.org/package/csurf) by [Hiroki Horiuchi](https://github.com/horiuchi) * [:link:](csv-stringify/csv-stringify.d.ts) [csv-stringify](https://github.com/wdavidw/node-csv-stringify) by [Rogier Schouten](https://github.com/rogierschouten) +* [:link:](cucumber/cucumber.d.ts) [cucumber-js](https://github.com/cucumber/cucumber-js) by [Abraão Alves](https://github.com/abraaoalves) * [:link:](cuid/cuid.d.ts) [cuid](https://github.com/ericelliott/cuid) by [Dave Keen](http://www.keendevelopment.ch) * [:link:](custom-error-generator/custom-error-generator.d.ts) [custom-error-generator](https://github.com/jproulx/node-custom-error) by [Thierry Miceli](https://github.com/thmiceli) * [:link:](md5/md5.d.ts) [CybozuLabs.MD5](http://labs.cybozu.co.jp/blog/mitsunari/2007/07/md5js_1.html) by [MIZUNE Pine](https://github.com/pine613) @@ -259,7 +288,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](date.format.js/date.format.d.ts) [Date Format](http://blog.stevenlevithan.com/archives/date-time-format) by [Rob Stutton](https://github.com/balrob) * [:link:](datejs/datejs.d.ts) [DateJS](http://www.datejs.com) by [David Khristepher Santos](http://github.com/rupertavery) * [:link:](dcjs/dc.d.ts) [DCJS](https://github.com/dc-js/dc.js) by [hans windhoff](https://github.com/hansrwindhoff), [matt traynham](https://github.com/mtraynham) -* [:link:](debug/debug.d.ts) [debug](https://github.com/visionmedia/debug) by [Seon-Wook Park](https://github.com/swook) +* [:link:](debug/debug.d.ts) [debug](https://github.com/visionmedia/debug) by [Seon-Wook Park](https://github.com/swook), [Gal Talmor](https://github.com/galtalmor) * [:link:](decimal.js/decimal.js.d.ts) [decimal.js](http://mikemcl.github.io/decimal.js) by [Joseph Rossi](http://github.com/musicist288) * [:link:](decorum/decorum.d.ts) [Decorum JS](https://github.com/dflor003/decorum) by [Danil Flores](https://github.com/dflor003) * [:link:](deep-diff/deep-diff.d.ts) [deep-diff](https://github.com/flitbit/diff) by [ZauberNerd](https://github.com/ZauberNerd) @@ -284,8 +313,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](dojo/dojo.d.ts) [Dojo](http://dojotoolkit.org) by [Michael Van Sickle](https://github.com/vansimke) * [:link:](dompurify/dompurify.d.ts) [DOM Purify](https://github.com/cure53/DOMPurify) by [Dave Taylor](http://davetayls.me), [Samira Bazuzi](https://github.com/bazuzi) * [:link:](domo/domo.d.ts) [Domo](http://domo-js.com) by [Steve Fenton](https://github.com/Steve-Fenton) -* [:link:](requirejs-domready/domready.d.ts) [domReady](https://github.com/requirejs/domReady) by [Nobuhiro Nakamura](https://github.com/lefb766) * [:link:](domready/domready.d.ts) [domready](https://github.com/ded/domready) by [Christian Holm Nielsen](https://github.com/dotnetnerd) +* [:link:](requirejs-domready/domready.d.ts) [domReady](https://github.com/requirejs/domReady) by [Nobuhiro Nakamura](https://github.com/lefb766) * [:link:](donna/donna.d.ts) [donna](https://github.com/atom/donna) by [vvakame](https://github.com/vvakame) * [:link:](dot/dot.d.ts) [doT](https://github.com/olado/doT) by [ZombieHunter](https://github.com/ZombieHunter) * [:link:](dot-case/dot-case.d.ts) [dot-case](https://github.com/blakeembrey/dot-case) by [Sam Saint-Pettersen](https://github.com/stpettersens) @@ -305,8 +334,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](easy-jsend/easy-jsend.d.ts) [easy-jsend](https://github.com/DeadAlready/easy-jsend) by [Karl Düüna](https://github.com/DeadAlready) * [:link:](easy-session/easy-session.d.ts) [easy-session](https://github.com/DeadAlready/node-easy-session) by [Karl Düüna](https://github.com/DeadAlready) * [:link:](easy-table/easy-table.d.ts) [easy-table](https://github.com/eldargab/easy-table) by [Niklas Mollenhauer](https://github.com/nikeee) -* [:link:](easy-xapi-supertest/easy-xapi-supertest.d.ts) [easy-x-headers](https://github.com/DeadAlready/easy-x-headers) by [Karl Düüna](https://github.com/DeadAlready) * [:link:](easy-x-headers/easy-x-headers.d.ts) [easy-x-headers](https://github.com/DeadAlready/easy-x-headers) by [Karl Düüna](https://github.com/DeadAlready) +* [:link:](easy-xapi-supertest/easy-xapi-supertest.d.ts) [easy-x-headers](https://github.com/DeadAlready/easy-x-headers) by [Karl Düüna](https://github.com/DeadAlready) * [:link:](easy-xapi/easy-xapi.d.ts) [easy-xapi](https://github.com/DeadAlready/easy-xapi) by [Karl Düüna](https://github.com/DeadAlready) * [:link:](easy-xapi-utils/easy-xapi-utils.d.ts) [easy-xapi-utils](https://github.com/DeadAlready/easy-xapi-utils) by [Karl Düüna](https://github.com/DeadAlready) * [:link:](easystarjs/easystarjs.d.ts) [EasyStar.js](http://easystarjs.com) by [Magnus Gustafsson](https://github.com/borundin) @@ -314,17 +343,20 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](ejs-locals/ejs-locals.d.ts) [ejs-locals](https://github.com/randometc/ejs-locals) by [jt000](https://github.com/jt000) * [:link:](ejs/ejs.d.ts) [ejs.js](http://ejs.co) by [Ben Liddicott](https://github.com/benliddicott/DefinitelyTyped) * [:link:](jquery.elang/jquery.elang.d.ts) [eLang](https://github.com/sumegizoltan/ELang) by [Zoltan Sumegi](https://github.com/sumegizoltan) -* [:link:](github-electron/github-electron.d.ts) [Electron (shared between main and rederer processes)](http://electron.atom.io) by [jedmao](https://github.com/jedmao) +* [:link:](github-electron/github-electron.d.ts) [Electron](http://electron.atom.io) by [jedmao](https://github.com/jedmao), [rhysd](https://rhysd.github.io) * [:link:](electron-builder/electron-builder.d.ts) [electron-builder](https://github.com/loopline-systems/electron-builder) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](electron-packager/electron-packager.d.ts) [electron-packager](https://github.com/maxogden/electron-packager) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](github-electron/electron-prebuilt.d.ts) [electron-prebuilt](https://github.com/mafintosh/electron-prebuilt) by [rhysd](https://github.com/rhysd) * [:link:](element-resize-event/element-resize-event.d.ts) [element-resize-event](https://github.com/KyleAMathews/element-resize-event) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](elm/elm.d.ts) [Elm](http://elm-lang.org) by [Dénes Harmath](https://github.com/thSoft) +* [:link:](email-addresses/email-addresses.d.ts) [email-addresses](https://github.com/jackbowman/email-addresses) by [John Grimsey](https://github.com/johngrimsey) +* [:link:](email-validator/email-validator.d.ts) [email-validator](https://github.com/Sembiance/email-validator) by [Paul Lessing](https://github.com/paullessing) * [:link:](ember/ember.d.ts) [Ember.js](http://emberjs.com) by [Jed Mao](https://github.com/jedmao) * [:link:](emissary/emissary.d.ts) [emissary](https://github.com/atom/emissary) by [vvakame](https://github.com/vvakame) * [:link:](empower/empower.d.ts) [empower](https://github.com/twada/empower) by [vvakame](https://github.com/vvakame) * [:link:](emscripten/emscripten.d.ts) [Emscripten](http://kripken.github.io/emscripten-site/index.html) by [Kensuke Matsuzaki](https://github.com/zakki) * [:link:](envify/envify.d.ts) [envify](https://github.com/hughsk/envify) by [Qubo](https://github.com/tkQubo) +* [:link:](enzyme/enzyme.d.ts) [Enzyme](https://github.com/airbnb/enzyme) by [Marian Palkus](https://github.com/MarianPalkus), [Cap3](http://www.cap3.de) * [:link:](epiceditor/epiceditor.d.ts) [EpicEditor](http://epiceditor.com) by [Boris Yankov](https://github.com/borisyankov) * [:link:](eq.js/eq.js.d.ts) [eq.js](https://github.com/Snugug/eq.js) by [Stephen Lautier](https://github.com/stephenlautier) * [:link:](errorhandler/errorhandler.d.ts) [errorhandler](https://github.com/expressjs/errorhandler) by [Santi Albo](https://github.com/santialbo) @@ -338,12 +370,14 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](event-kit/event-kit.d.ts) [event-kit](https://github.com/atom/event-kit) by [Vadim Macagon](https://github.com/enlight) * [:link:](event-loop-lag/event-loop-lag.d.ts) [event-loop-lag](https://github.com/pebble/event-loop-lag) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](eventemitter2/eventemitter2.d.ts) [EventEmitter2](https://github.com/asyncly/EventEmitter2) by [ryiwamoto](https://github.com/ryiwamoto) -* [:link:](eventemitter3/eventemitter3.d.ts) [EventEmitter3](https://github.com/primus/eventemitter3) by [Yuichi Murata](https://github.com/mrk21) +* [:link:](eventemitter3/eventemitter3.d.ts) [EventEmitter3](https://github.com/primus/eventemitter3) by [Yuichi Murata](https://github.com/mrk21), [Leon Yu](https://github.com/leonyu) * [:link:](evernote/evernote.d.ts) [evernote v](https://www.npmjs.com/package/evernote) by [Zachary Collins](https://github.com/corps) * [:link:](exit/exit.d.ts) [exit](https://github.com/cowboy/node-exit) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](expect.js/expect.js.d.ts) [expect.js](https://github.com/Automattic/expect.js) by [Teppei Sato](https://github.com/teppeis) * [:link:](expectations/expectations.d.ts) [expectations.js](https://github.com/spmason/expectations) by [vvakame](https://github.com/vvakame) * [:link:](express/express.d.ts) [Express 4.x](http://expressjs.com) by [Boris Yankov](https://github.com/borisyankov) +* [:link:](express-brute/express-brute.d.ts) [express-brute](https://github.com/AdamPflug/express-brute) by [Cyril Schumacher](https://github.com/cyrilschumacher) +* [:link:](express-brute-mongo/express-brute-mongo.d.ts) [express-brute-mongo](https://github.com/auth0/express-brute-mongo) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](express-debug/express-debug.d.ts) [express-debug](https://github.com/devoidfury/express-debug) by [Federico Bond](https://github.com/federicobond) * [:link:](express-handlebars/express-handlebars.d.ts) [express-handlebars](https://github.com/ericf/express-handlebars) by [Sam Saint-Pettersen](https://github.com/stpettersens) * [:link:](express-jwt/express-jwt.d.ts) [express-jwt](https://www.npmjs.org/package/express-jwt) by [Wonshik Kim](https://github.com/wokim) @@ -359,6 +393,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](eyes/eyes.d.ts) [eyes](https://github.com/cloudhead/eyes.js) by [bryn austin bellomy](https://github.com/brynbellomy) * [:link:](fabricjs/fabricjs.d.ts) [FabricJS](http://fabricjs.com) by [Oliver Klemencic](https://github.com/oklemencic), [Joseph Livecchi](https://github.com/joewashear007), [Michael Randolph](https://github.com/mrand01) * [:link:](fbsdk/fbsdk.d.ts) [Facebook Javascript SDK](https://developers.facebook.com/docs/javascript) by [Joshua Strobl](https://github.com/JoshStrobl) +* [:link:](fbemitter/fbemitter.d.ts) [Facebook's EventEmitter](https://github.com/facebook/emitter) by [kmxz](https://github.com/kmxz) * [:link:](faker/faker.d.ts) [faker](http://marak.com/faker.js) by [Bas Pennings](https://github.com/basp), [Yuki Kokubun](https://github.com/Kuniwak) * [:link:](famous/famous.d.ts) [Famous Engine](http://famous.org) by [Boris Vasilenko](https://github.com/borisvasilenko) * [:link:](fancybox/fancybox.d.ts) [fancyBox](https://github.com/fancyapps/fancyBox) by [Boris Yankov](https://github.com/borisyankov) @@ -370,6 +405,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](whatwg-fetch/whatwg-fetch.d.ts) [fetch API](https://github.com/github/fetch) by [Ryan Graham](https://github.com/ryan-codingintrigue) * [:link:](fhir/fhir.d.ts) [FHIR DSTU2](http://www.hl7.org/fhir/2015Sep/index.html) by [Artifact Health](http://www.artifacthealth.com) * [:link:](fibers/fibers.d.ts) [fibers](https://github.com/laverdet/node-fibers) by [Carlos Ballesteros Velasco](https://github.com/soywiz) +* [:link:](field/field.d.ts) [field](https://www.npmjs.com/package/field) by [Leo Liang](https://github.com/aleung/DefinitelyTyped) * [:link:](filewriter/filewriter.d.ts) [File API: Writer](http://www.w3.org/TR/file-writer-api) by [Kon](http://phyzkit.net) * [:link:](filesystem/filesystem.d.ts) [File System API](http://www.w3.org/TR/file-system-api) by [Kon](http://phyzkit.net) * [:link:](file-url/file-url.d.ts) [file-url](https://github.com/sindresorhus/file-url) by [MEDIA CHECK s.r.o.](http://www.mediacheck.cz) @@ -383,7 +419,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](firebase-client/firebase-client.d.ts) [Firebase Client](https://www.github.com/jpstevens/firebase-client) by [Andrew Breen](https://github.com/fpsscarecrow) * [:link:](firebase/firebase-simplelogin.d.ts) [Firebase Simple Login](https://www.firebase.com/docs/security/simple-login-overview.html) by [Wilker Lucio](http://github.com/wilkerlucio) * [:link:](first-mate/first-mate.d.ts) [first-mate](https://github.com/atom/first-mate) by [Vadim Macagon](https://github.com/enlight) -* [:link:](fixed-data-table/fixed-data-table.d.ts) [fixed-data-table](https://github.com/facebook/fixed-data-table) by [Petar Paar](https://github.com/pepaar) +* [:link:](fixed-data-table/fixed-data-table.d.ts) [fixed-data-table](https://github.com/facebook/fixed-data-table) by [Petar Paar](https://github.com/pepaar), [Stephen Jelfs](https://github.com/stephenjelfs) * [:link:](flake-idgen/flake-idgen.d.ts) [flakge-idgen](https://github.com/T-PWK/flake-idgen) by [Yuce Tekol](http://yuce.me) * [:link:](flat/flat.d.ts) [flat](https://github.com/hughsk/flat) by [Ilya Mochalov](https://github.com/chrootsu) * [:link:](flexSlider/flexSlider.d.ts) [FlexSlider 2 jquery plugin](https://github.com/woothemes/FlexSlider) by [Diullei Gomes](https://github.com/diullei) @@ -391,19 +427,20 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](flipsnap/flipsnap.d.ts) [flipsnap.js](http://pxgrid.github.io/js-flipsnap) by [kubosho](https://github.com/kubosho), [gsino](https://github.com/gsino), [Mayuki Sawatari](https://github.com/mayuki) * [:link:](flot/jquery.flot.d.ts) [Flot](http://www.flotcharts.org) by [Matt Burland](https://github.com/burlandm) * [:link:](flowjs/flowjs.d.ts) [flowjs](https://github.com/flowjs/flow.js) by [Ryan McNamara](https://github.com/ryan10132) -* [:link:](flux/flux.d.ts) [Flux](http://facebook.github.io/flux) by [Steve Baker](https://github.com/stkb) +* [:link:](flux/flux.d.ts) [Flux](http://facebook.github.io/flux) by [Steve Baker](https://github.com/stkb), [Giedrius Grabauskas](https://github.com/QuatroDevOfficial) * [:link:](flux-standard-action/flux-standard-action.d.ts) [flux-standard-action](https://github.com/acdlite/flux-standard-action) by [Qubo](https://github.com/tkqubo) * [:link:](fluxxor/fluxxor.d.ts) [Fluxxor](https://github.com/BinaryMuse/fluxxor) by [Yuichi Murata](https://github.com/mrk21) * [:link:](fontoxml/fontoxml.d.ts) [FontoXML](http://www.fontoxml.com) by [Roland Zwaga](https://github.com/rolandzwaga) * [:link:](ion.rangeSlider/ion.rangeSlider.d.ts) [for Ion.RangeSlider](https://github.com/IonDen/ion.rangeSlider) by [Sixin Li](https://github.com/sixinli) +* [:link:](jee-jsf/jsf.d.ts) [for the JSF 2.0 Ajax request API](https://docs.oracle.com/cd/E17802_01/j2ee/javaee/javaserverfaces/2.0/docs/js-api/symbols/jsf.ajax.html) by [Lars Michaelis and Stephan Zerhusen](https://github.com/ButterFaces/ButterFaces) * [:link:](forge-di/forge-di.d.ts) [forge-di](https://github.com/nkohari/forge) by [Adam Carr](https://github.com/adamcarr) -* [:link:](form-data/form-data.d.ts) [form-data](https://github.com/felixge/node-form-data) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](formidable/formidable.d.ts) [Formidable](https://github.com/felixge/node-formidable) by [Wim Looman](https://github.com/Nemo157) * [:link:](foundation/foundation.d.ts) [Foundation](http://foundation.zurb.com) by [Boris Yankov](https://github.com/borisyankov) +* [:link:](foundation-sites/foundation-sites.d.ts) [Foundation Sites](http://foundation.zurb.com) by [Sam Vloeberghs](https://github.com/samvloeberghs) * [:link:](fpsmeter/FPSMeter.d.ts) [FPSmeter](http://darsa.in/fpsmeter) by [Aaron Lampros](http://github.com/alampros) -* [:link:](freedom/freedom-core-env.d.ts) [freedom](https://github.com/freedomjs/freedom) by [Jonathan Pevarnek](https://github.com/jpevarnek) * [:link:](freedom/freedom-module-env.d.ts) [freedom](https://github.com/freedomjs/freedom) by [Jonathan Pevarnek](https://github.com/jpevarnek) * [:link:](freedom/freedom.d.ts) [freedom](https://github.com/freedomjs/freedom) by [Jonathan Pevarnek](https://github.com/jpevarnek) +* [:link:](freedom/freedom-core-env.d.ts) [freedom](https://github.com/freedomjs/freedom) by [Jonathan Pevarnek](https://github.com/jpevarnek) * [:link:](from/from.d.ts) [from](https://github.com/dominictarr/from) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](fs-ext/fs-ext.d.ts) [fs-ext](https://github.com/baudehlo/node-fs-ext) by [Oguzhan Ergin](https://github.com/OguzhanE) * [:link:](fs-extra/fs-extra.d.ts) [fs-extra](https://github.com/jprichardson/node-fs-extra) by [midknight41](https://github.com/midknight41) @@ -413,6 +450,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](ftp/ftp.d.ts) [ftp](https://github.com/mscdex/node-ftp) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](ftpd/ftpd.d.ts) [ftpd](https://github.com/sstur/nodeftpd) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](fullCalendar/fullCalendar.d.ts) [FullCalendar](http://arshaw.com/fullcalendar) by [Neil Stalker](https://github.com/nestalk), [Marcelo Camargo](https://github.com/hasellcamargo) +* [:link:](fullname/fullname.d.ts) [fullname](https://www.npmjs.com/package/fullname) by [Klaus Reimer](https://github.com/kayahr) * [:link:](fuse/fuse.d.ts) [Fuse.js](https://github.com/krisk/Fuse) by [Greg Smith](https://github.com/smrq) * [:link:](jquery-galleria/jquery-galleria.d.ts) [galleria.js](https://github.com/aino/galleria) by [Robert Imig](https://github.com/rimig) * [:link:](gamepad/gamepad.d.ts) [Gamepad API](http://www.w3.org/TR/gamepad) by [Kon](http://phyzkit.net) @@ -434,33 +472,33 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](goJS/goJS.d.ts) [GoJS](http://gojs.net) by [Northwoods Software](https://github.com/NorthwoodsSoftware) * [:link:](google.analytics/ga.d.ts) [Google Analytics (Classic and Universal)](https://developers.google.com/analytics/devguides/collection/gajs) by [Ronnie Haakon Hegelund](http://ronniehegelund.blogspot.dk), [Pat Kujawa](http://patkujawa.com) * [:link:](gapi/gapi.d.ts) [Google API Client](https://code.google.com/p/google-api-javascript-client) by [Frank M](https://github.com/sgtfrankieboy) -* [:link:](google-apps-script/google-apps-script.html.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.groups.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.gmail.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.calendar.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google-apps-script/google-apps-script.script.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.properties.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.maps.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.url-fetch.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.optimization.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.ui.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.forms.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.document.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.content.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.mail.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.drive.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.types.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.spreadsheet.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.lock.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.sites.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.groups.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google-apps-script/google-apps-script.xml-service.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.sites.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google-apps-script/google-apps-script.utilities.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.language.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google-apps-script/google-apps-script.jdbc.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.html.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.optimization.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.url-fetch.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.properties.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.ui.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.maps.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.mail.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.lock.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.language.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.types.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google-apps-script/google-apps-script.base.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google-apps-script/google-apps-script.cache.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) -* [:link:](google-apps-script/google-apps-script.calendar.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.spreadsheet.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google-apps-script/google-apps-script.charts.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google-apps-script/google-apps-script.contacts.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.content.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.document.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.drive.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.forms.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) +* [:link:](google-apps-script/google-apps-script.gmail.d.ts) [Google Apps Script 2015-11-12](https://developers.google.com/apps-script) by [motemen](https://github.com/motemen) * [:link:](google.feeds/google.feed.api.d.ts) [Google Feed Apis](https://developers.google.com/feed) by [RodneyJT](https://github.com/RodneyJT) * [:link:](google.geolocation/google.geolocation.d.ts) [Google Geolocation](https://code.google.com/p/geo-location-javascript) by [Vincent Bortone](https://github.com/vbortone) * [:link:](googlemaps/google.maps.d.ts) [Google Maps JavaScript API](https://developers.google.com/maps) by [Folia A/S](http://www.folia.dk), [Chris Wrench](https://github.com/cgwrench) @@ -472,6 +510,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](gapi.translate/gapi.translate.d.ts) [Google Translate API](https://developers.google.com/translate) by [Frank M](https://github.com/sgtfrankieboy) * [:link:](gapi.urlshortener/gapi.urlshortener.d.ts) [Google Url Shortener API](https://developers.google.com/url-shortener) by [Frank M](https://github.com/sgtfrankieboy) * [:link:](google.visualization/google.visualization.d.ts) [Google Visualisation Apis](https://developers.google.com/chart) by [Dan Ludwig](https://github.com/danludwig) +* [:link:](google-maps/google-maps.d.ts) [google-maps](https://www.npmjs.com/package/google-maps) by [Deividas Bakanas](https://github.com/DeividasBakanas), [Giedrius Grabauskas](https://github.com/GiedriusGrabauskas) * [:link:](gae.channel.api/gae.channel.api.d.ts) [GoogleAppEngine's Channel API](https://developers.google.com/appengine/docs/java/channel/javascript) by [vvakame](https://github.com/vvakame) * [:link:](graceful-fs/graceful-fs.d.ts) [graceful-fs](https://github.com/cowboy/graceful-fs) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](graham_scan/graham_scan.d.ts) [graham_scan](https://github.com/brian3kb/graham_scan_js) by [Harm Berntsen](https://github.com/hberntsen) @@ -486,6 +525,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](gsap/TweenLite.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) * [:link:](gulp/gulp.d.ts) [Gulp v3.8.x](http://gulpjs.com) by [Drew Noakes](https://drewnoakes.com) * [:link:](gulp-autoprefixer/gulp-autoprefixer.d.ts) [gulp-autoprefixer](https://github.com/sindresorhus/gulp-autoprefixer) by [Asana](https://asana.com) +* [:link:](gulp-babel/gulp-babel.d.ts) [gulp-babel](https://github.com/babel/gulp-babel) by [Aya Morisawa](https://github.com/AyaMorisawa) * [:link:](gulp-cached/gulp-cached.d.ts) [gulp-cached](https://github.com/wearefractal/gulp-cached) by [Thomas Corbière](https://github.com/tomc974) * [:link:](gulp-changed/gulp-changed.d.ts) [gulp-changed](https://github.com/sindresorhus/gulp-changed) by [Thomas Corbière](https://github.com/tomc974) * [:link:](gulp-cheerio/gulp-cheerio.d.ts) [gulp-cheerio](https://github.com/KenPowers/gulp-cheerio) by [Qubo](https://github.com/tkQubo) @@ -552,7 +592,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](highland/highland.d.ts) [Highland](http://highlandjs.org) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](highlightjs/highlightjs.d.ts) [highlight.js](https://github.com/isagalaev/highlight.js) by [Niklas Mollenhauer](https://github.com/nikeee), [Jeremy Hull](https://github.com/sourrust) * [:link:](highcharts/highstock.d.ts) [Highstock](http://www.highcharts.com) by [David Deutsch](http://github.com/DavidKDeutsch) +* [:link:](react-router/history.d.ts) [history](https://github.com/rackt/history) by [Sergey Buturlakin](http://github.com/sergey-buturlakin) * [:link:](history/history.d.ts) [History.js](https://github.com/browserstate/history.js) by [Boris Yankov](https://github.com/borisyankov), [Gidon Junge](https://github.com/gjunge) +* [:link:](hopscotch/hopscotch.d.ts) [Hopscotch](http://linkedin.github.io/hopscotch) by [Tim Perry](https://github.com/pimterry) * [:link:](howlerjs/howler.d.ts) [howler.js](https://github.com/goldfire/howler.js) by [Pedro Casaubon](https://github.com/xperiments) * [:link:](touch-events/touch-events.d.ts) [HTML Touch Events](http://www.w3.org/TR/touch-events) by [Kevin Barabash](https://github.com/kevinb7) * [:link:](html-to-text/html-to-text.d.ts) [html-to-text](https://github.com/werk85/node-html-to-text) by [Eryk Warren](https://github.com/erykwarren) @@ -566,9 +608,10 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](humane/humane.d.ts) [Humane](http://wavded.github.com/humane-js) by [jmvrbanac](https://github.com/jmvrbanac) * [:link:](hypertext-application-language/hypertext-application-language.d.ts) [Hypertext Application Language Draft 6](https://tools.ietf.org/html/draft-kelly-json-hal-06) by [Maks3w](https://github.com/maks3w) * [:link:](i18n-node/i18n-node.d.ts) [i18n-node](https://github.com/mashpie/i18n-node) by [Maxime LUCE](https://github.com/SomaticIT) -* [:link:](ng-i18next/ng-i18next.d.ts) [i18next](https://github.com/i18next/ng-i18next) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](i18next/i18next.d.ts) [i18next](http://i18next.com) by [Maarten Docter](https://github.com/mdocter) +* [:link:](ng-i18next/ng-i18next.d.ts) [i18next](https://github.com/i18next/ng-i18next) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](iban/iban.d.ts) [iban.js](https://github.com/arhs/iban.js) by [Cyril Schumacher](https://github.com/cyrilschumacher) +* [:link:](icepick/icepick.d.ts) [icepick](https://github.com/aearly/icepick) by [Nathan Brown](https://github.com/ngbrown) * [:link:](icheck/icheck.d.ts) [iCheck](http://damirfoy.com/iCheck) by [Dániel Tar](https://github.com/qcz) * [:link:](imagemagick/imagemagick.d.ts) [imagemagick](http://github.com/rsms/node-imagemagick) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](imagemagick-native/imagemagick-native.d.ts) [imagemagick-native](https://www.npmjs.org/package/imagemagick-native) by [Hiroki Horiuchi](https://github.com/horiuchi) @@ -578,6 +621,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](impress/impress.d.ts) [Impress.js](https://github.com/bartaz/impress.js) by [Boris Yankov](https://github.com/borisyankov) * [:link:](incremental-dom/incremental-dom.d.ts) [Incremetal DOM](https://github.com/google/incremental-dom) by [Basarat Ali Syed](https://github.com/basarat) * [:link:](inflection/inflection.d.ts) [inflection](https://github.com/dreamerslab/node.inflection) by [Shogo Iwano](https://github.com/shiwano) +* [:link:](inherits/inherits.d.ts) [inherits](https://github.com/isaacs/inherits) by [Ilya Mochalov](https://github.com/chrootsu) * [:link:](ini/ini.d.ts) [ini](https://github.com/isaacs/ini) by [Marcin Porębski](https://github.com/marcinporebski) * [:link:](iniparser/iniparser.d.ts) [iniparser](https://github.com/shockie/node-iniparser) by [Ilya Mochalov](https://github.com/chrootsu) * [:link:](inline-css/inline-css.d.ts) [inline-css](https://github.com/jonkemp/inline-css) by [Philip Spain](https://github.com/philipisapain) @@ -598,6 +642,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](iscroll/iscroll-lite.d.ts) [iScroll Lite](http://cubiq.org/iscroll-4) by [Boris Yankov](https://github.com/borisyankov), [Christiaan Rakowski](https://github.com/csrakowski) * [:link:](iscroll/iscroll-5-lite.d.ts) [iScroll Lite 5](http://cubiq.org/iscroll-5-ready-for-beta-test) by [Christiaan Rakowski](https://github.com/csrakowski) * [:link:](iso8601-localizer/iso8601-localizer.d.ts) [ISO8601-Localizer](https://github.com/avielfedida/ISO8601-Localizer) by [Aviel Fedida](https://github.com/avielfedida) +* [:link:](istanbul/istanbul.d.ts) [Istanbul](https://github.com/gotwarlost/istanbul) by [Tanguy Krotoff](https://github.com/tkrotoff) * [:link:](ix.js/ix.d.ts) [IxJS 1.0.6 / ix.js](https://github.com/Reactive-Extensions/IxJS) by [Igor Oleinikov](https://github.com/Igorbek) * [:link:](ix.js/l2o.d.ts) [IxJS 1.0.6 / l2o.js](https://github.com/Reactive-Extensions/IxJS) by [Igor Oleinikov](https://github.com/Igorbek) * [:link:](jade/jade.d.ts) [jade](https://github.com/jadejs/jade) by [Panu Horsmalahti](https://github.com/panuhorsmalahti) @@ -606,6 +651,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jasmine-data_driven_tests/jasmine-data_driven_tests.d.ts) [Jasmine Data Driven Tests](https://github.com/gburghardt/jasmine-data_driven_tests) by [Anthony MacKinnon](https://github.com/AnthonyMacKinnon) * [:link:](jasmine-ajax/jasmine-ajax.d.ts) [jasmine-ajax](https://github.com/jasmine/jasmine-ajax) by [Louis Grignon](https://github.com/lgrignon) * [:link:](jasmine-es6-promise-matchers/jasmine-es6-promise-matchers.d.ts) [jasmine-es6-promise-matchers](https://github.com/bvaughn/jasmine-es6-promise-matchers) by [Stephen Lautier](https://github.com/stephenlautier) +* [:link:](jasmine-expect/jasmine-expect.d.ts) [jasmine-expect](https://github.com/JamieMason/Jasmine-Matchers) by [UserPixel](https://github.com/UserPixel) * [:link:](jasmine-fixture/jasmine-fixture.d.ts) [Jasmine-fixture](https://github.com/searls/jasmine-fixture) by [Craig Brett](https://github.com/craigbrett17) * [:link:](jasmine-jquery/jasmine-jquery.d.ts) [Jasmine-JQuery](https://github.com/velesin/jasmine-jquery) by [Gregor Stamac](https://github.com/gstamac) * [:link:](jasmine-matchers/jasmine-matchers.d.ts) [jasmine-matchers](https://github.com/uxebu/jasmine-matchers) by [Bart van der Schoor](https://github.com/Bartvds) @@ -614,6 +660,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](java-applet/java-applet.d.ts) [Java Applet](https://www.java.com) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](hooker/hooker.d.ts) [JavaScript Hooker](https://github.com/cowboy/javascript-hooker) by [Michael Zabka](https://github.com/misak113) * [:link:](oauth.js/oauth.js.d.ts) [JavaScript software for implementing an OAuth consumer](https://code.google.com/p/oauth) by [NOBUOKA Yu](https://github.com/nobuoka) +* [:link:](javascript-bignum/javascript-bignum.d.ts) [javascript-bignum](https://github.com/jtobey/javascript-bignum) by [Nathan Shively-Sanders](https://github.com/sandersn) * [:link:](jbinary/jbinary.d.ts) [jBinary](https://github.com/jDataView/jBinary) by [Tim Bureck](https://github.com/tbureck) * [:link:](jdataview/jdataview.d.ts) [jDataView](https://github.com/jDataView/jDataView) by [Ingvar Stepanyan](https://github.com/RReverser) * [:link:](jest/jest.d.ts) [Jest](http://facebook.github.io/jest) by [Asana](https://asana.com) @@ -621,7 +668,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jjve/jjve.d.ts) [JJVE](https://github.com/silas/jjve) by [Wim Looman](https://github.com/Nemo157) * [:link:](joData/joData.d.ts) [joData](https://github.com/mccow002/joData) by [Chris Wrench](https://github.com/cgwrench) * [:link:](johnny-five/johnny-five.d.ts) [johnny-five](https://github.com/rwaldron/johnny-five) by [Toshiya Nakakura](https://github.com/nakakura) -* [:link:](joi/joi.d.ts) [joi](https://github.com/spumko/joi) by [Bart van der Schoor](https://github.com/Bartvds), [Laurence Dougal Myers](https://github.com/laurence-myers), [Christopher Glantschnig](https://github.com/cglantschnig) +* [:link:](joi/joi.d.ts) [joi](https://github.com/spumko/joi) by [Bart van der Schoor](https://github.com/Bartvds), [Laurence Dougal Myers](https://github.com/laurence-myers), [Christopher Glantschnig](https://github.com/cglantschnig), [David Broder-Rodgers](https://github.com/DavidBR-SW) * [:link:](jointjs/jointjs.d.ts) [Joint JS](http://www.jointjs.com) by [Aidan Reel](http://github.com/areel), [David Durman](http://github.com/DavidDurman), [Ewout Van Gossum](https://github.com/DenEwout) * [:link:](jqrangeslider/jqrangeslider.d.ts) [jQRangeSlider](http://ghusse.github.com/jQRangeSlider) by [Dániel Tar](https://github.com/qcz) * [:link:](jquery/jquery.d.ts) [jQuery 1.10.x / 2.0.x](http://jquery.com) by [Boris Yankov](https://github.com/borisyankov), [Christian Hoffmeister](https://github.com/choffmeister), [Steve Fenton](https://github.com/Steve-Fenton), [Diullei Gomes](https://github.com/Diullei), [Tass Iliopoulos](https://github.com/tasoili), [Jason Swearingen](https://github.com/jasons-novaleaf), [Sean Hill](https://github.com/seanski), [Guus Goossens](https://github.com/Guuz), [Kelly Summerlin](https://github.com/ksummerlin), [Basarat Ali Syed](https://github.com/basarat), [Nicholas Wolverson](https://github.com/nwolverson), [Derek Cicerone](https://github.com/derekcicerone), [Andrew Gaspar](https://github.com/AndrewGaspar), [James Harrison Fisher](https://github.com/jameshfisher), [Seikichi Kondo](https://github.com/seikichi), [Benjamin Jackman](https://github.com/benjaminjackman), [Poul Sorensen](https://github.com/s093294), [Josh Strobl](https://github.com/JoshStrobl), [John Reilly](https://github.com/johnnyreilly), [Dick van den Brink](https://github.com/DickvdBrink) @@ -637,6 +684,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jquery.joyride/jquery.joyride.d.ts) [jQuery JoyRide Plugin](https://github.com/zurb/joyride) by [Vincent Bortone](https://github.com/vbortone) * [:link:](jqgrid/jqgrid.d.ts) [jQuery jqgrid Plugin](https://github.com/tonytomov/jqGrid) by [Lokesh Peta](https://github.com/lokeshpeta) * [:link:](jquery-knob/jquery-knob.d.ts) [jQuery Knob](http://anthonyterrien.com/knob) by [Iain Buchanan](https://github.com/iain8) +* [:link:](jquery.mmenu/jquery.mmenu.d.ts) [jQuery mmenu](http://mmenu.frebsite.nl) by [John Gouigouix](https://github.com/orchestra-ts/DefinitelyTyped) * [:link:](jquerymobile/jquerymobile.d.ts) [jQuery Mobile](http://jquerymobile.com) by [Boris Yankov](https://github.com/borisyankov) * [:link:](jquery.notifyBar/jquery.notifyBar.d.ts) [jQuery Notify Bar](http://www.whoop.ee/posts/2013-04-05-the-resurrection-of-jquery-notify-bar) by [Shunsuke Ohtani](https://github.com/zaneli) * [:link:](jquery.base64/jquery.base64.d.ts) [jQuery Plugin - base64 codec](https://github.com/yatt/jquery.base64) by [Shinya Mochizuki](https://github.com/enrapt-mochizuki) @@ -688,6 +736,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jquery.placeholder/jquery.placeholder.d.ts) [jquery.placeholder.js](https://github.com/mathiasbynens/jquery-placeholder) by [Peter Gill](https://github.com/majorsilence), [Neil Culver](https://github.com/EnableSoftware) * [:link:](jquery.pnotify/jquery.pnotify.d.ts) [jquery.pnotify 2.x](https://github.com/sciactive/pnotify) by [David Sichau](https://github.com/DavidSichau) * [:link:](jquery.qrcode/jquery.qrcode.d.ts) [jQuery.qrcode](https://github.com/lrsjng/jquery-qrcode) by [Dan Manastireanu](https://github.com/danmana) +* [:link:](raty/raty.d.ts) [jQuery.raty](https://github.com/wbotelhos/raty) by [Matt Wheatley](http://github.com/terrawheat) * [:link:](jquery.scrollTo/jquery.scrollTo.d.ts) [jQuery.scrollTo.js](https://github.com/flesler/jquery.scrollTo) by [Neil Stalker](https://github.com/nestalk) * [:link:](form-serializer/form-serializer.d.ts) [jquery.serialize-object](https://github.com/macek/jquery-serialize-object) by [Florian Wagner](https://github.com/flqw) * [:link:](jquery.simulate/jquery.simulate.d.ts) [jquery.simulate.js](https://github.com/jquery/jquery-simulate) by [Derek Cicerone](https://github.com/derekcicerone) @@ -704,8 +753,10 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jquery.total-storage/jquery.total-storage.d.ts) [jQueryTotalStorage](https://github.com/Upstatement/jquery-total-storage) by [Jeremy Brooks](https://github.com/JeremyCBrooks) * [:link:](jqueryui/jqueryui.d.ts) [jQueryUI](http://jqueryui.com) by [Boris Yankov](https://github.com/borisyankov), [John Reilly](https://github.com/johnnyreilly) * [:link:](js-beautify/js-beautify.d.ts) [js_beautify](https://github.com/beautify-web/js-beautify) by [Josh Goldberg](https://github.com/JoshuaKGoldberg) -* [:link:](js-cookie/js-cookie.d.ts) [js-cookie](https://github.com/js-cookie/js-cookie) by [Theodore Brown](https://github.com/theodorejb) +* [:link:](js-combinatorics/js-combinatorics.d.ts) [js-combinatorics](https://github.com/dankogai/js-combinatorics) by [Vasya Aksyonov](https://github.com/outring) +* [:link:](js-combinatorics/js-combinatorics-global.d.ts) [js-combinatorics (global)](https://github.com/dankogai/js-combinatorics) by [Vasya Aksyonov](https://github.com/outring) * [:link:](ua-parser-js/ua-parser-js.d.ts) [js-cookie](https://github.com/faisalman/ua-parser-js) by [Viktor Miroshnikov](https://github.com/superduper) +* [:link:](js-cookie/js-cookie.d.ts) [js-cookie](https://github.com/js-cookie/js-cookie) by [Theodore Brown](https://github.com/theodorejb) * [:link:](js-fixtures/fixtures.d.ts) [js-fixtures](https://github.com/badunk/js-fixtures) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid) * [:link:](js-git/js-git.d.ts) [js-git](https://github.com/creationix/js-git) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](js-md5/md5.d.ts) [js-md5](https://github.com/emn178/js-md5) by [Roland Greim](https://github.com/tigerxy) @@ -736,17 +787,20 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jsonwebtoken/jsonwebtoken.d.ts) [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](jsplumb/jquery.jsPlumb.d.ts) [jsPlumb 1.3.16 jQuery adapter](http://jsplumb.org) by [Steve Shearn](https://github.com/shearnie) * [:link:](jsrender/jsrender.d.ts) [JsRender](http://www.jsviews.com/#jsrender) by [Kensuke Matsuzaki](https://github.com/zakki) -* [:link:](jssha/jssha.d.ts) [jsSHA](https://github.com/Caligatio/jsSHA) by [David Li](https://github.com/randombk) +* [:link:](jssha/jssha.d.ts) [jsSHA](https://github.com/Caligatio/jsSHA) by [David Li](https://github.com/randombk), [Tobias Kahlert](https://github.com/SrTobi) * [:link:](jstorage/jstorage.d.ts) [jStorage](http://www.jstorage.info) by [Danil Flores](https://github.com/dflor003) * [:link:](jstree/jstree.d.ts) [jsTree](http://www.jstree.com) by [Adam Pluciński](https://github.com/adaskothebeast) * [:link:](jsts/jsts.d.ts) [jsts](https://github.com/bjornharrtell/jsts) by [Stephane Alie](https://github.com/StephaneAlie) * [:link:](jsuri/jsuri.d.ts) [jsUri](https://github.com/derek-watson/jsUri) by [Chris Charabaruk](http://github.com/coldacid), [Florian Wagner](http://github.com/flqw) +* [:link:](jsurl/jsurl.d.ts) [jsurl](https://github.com/Mikhus/jsurl) by [Alexey Gorshkov](https://github.com/agorshkov23) * [:link:](jszip/jszip.d.ts) [JSZip](http://stuk.github.com/jszip) by [mzeiher](https://github.com/mzeiher) * [:link:](jug/jug.d.ts) [jug](https://github.com/kaiquewdev/Graph) by [yevt](https://github.com/yevt) * [:link:](jwplayer/jwplayer.d.ts) [JW Player](http://developer.longtailvideo.com/trac) by [Martin Duparc](https://github.com/martinduparc) +* [:link:](jwt-decode/jwt-decode.d.ts) [jwt-decode](https://github.com/auth0/jwt-decode) by [Giedrius Grabauskas](https://github.com/QuatroDevOfficial) * [:link:](jwt-simple/jwt-simple.d.ts) [jwt-simple](https://github.com/hokaccha/node-jwt-simple) by [Ken Fukuyama](https://github.com/kenfdev) * [:link:](kafka-node/kafka-node.d.ts) [kafka-node](https://github.com/SOHU-Co/kafka-node) by [Daniel Imrie-Situnayake](https://github.com/dansitu) * [:link:](karma/karma.d.ts) [karma](https://github.com/karma-runner/karma) by [Tanguy Krotoff](https://github.com/tkrotoff) +* [:link:](karma-coverage/karma-coverage.d.ts) [karma-coverage](https://github.com/karma-runner/karma-coverage) by [Tanguy Krotoff](https://github.com/tkrotoff) * [:link:](karma-jasmine/karma-jasmine.d.ts) [karma-jasmine plugin](https://github.com/karma-runner/karma-jasmine) by [Michel Salib](https://github.com/michelsalib) * [:link:](katex/katex.d.ts) [KaTeX v.0.5.0](http://khan.github.io/KaTeX) by [Michael Randolph](https://github.com/mrand01) * [:link:](kefir/kefir.d.ts) [Kefir](http://rpominov.github.io/kefir) by [Aya Morisawa](https://github.com/AyaMorisawa) @@ -754,6 +808,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](keyboardjs/keyboardjs.d.ts) [KeyboardJS](https://github.com/RobertWHurst/KeyboardJS) by [Vincent Bortone](https://github.com/vbortone) * [:link:](keymaster/keymaster.d.ts) [keymaster](https://github.com/madrobby/keymaster) by [Martin W. Kirst](https://github.com/nitram509) * [:link:](keypress/keypress.d.ts) [Keypress](https://github.com/dmauro/Keypress) by [Roger Chen](https://github.com/rcchen) +* [:link:](keytar/keytar.d.ts) [keytar](http://atom.github.io/node-keytar) by [Milan Burda](https://github.com/miniak) * [:link:](kii-cloud-sdk/kii-cloud-sdk.d.ts) [Kii Cloud SDK](http://en.kii.com) by [Kii Consortium](http://jp.kii.com/consortium) * [:link:](kineticjs/kineticjs.d.ts) [KineticJS](http://kineticjs.com) by [Basarat Ali Syed](http://www.github.com/basarat), [Ralph de Ruijter](http://www.superdopey.nl/techblog) * [:link:](knex/knex.d.ts) [Knex.js](https://github.com/tgriesser/knex) by [Qubo](https://github.com/tkQubo) @@ -792,9 +847,12 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](leapmotionTS/LeapMotionTS.d.ts) [Leap Motion TS](https://github.com/logotype/LeapMotionTS) by [Victor Norgren](https://github.com/logotype) * [:link:](less/less.d.ts) [LESS](http://lesscss.org) by [Tom Hasner](https://github.com/thasner) * [:link:](less-middleware/less-middleware.d.ts) [less-middleware](https://github.com/emberfeather/less.js-middleware) by [Federico Bond](https://github.com/federicobond) +* [:link:](lestate/lestate.d.ts) [LeState](https://github.com/LeTools/LeState) by [Hadrian Oliveira](https://github.com/thelambdaparty) * [:link:](level-sublevel/level-sublevel.d.ts) [level-sublevel](https://github.com/dominictarr/level-sublevel) by [Bas Pennings](https://github.com/basp) * [:link:](levelup/levelup.d.ts) [LevelUp](https://github.com/rvagg/node-levelup) by [Bret Little](https://github.com/blittle) * [:link:](libxmljs/libxmljs.d.ts) [Libxmljs](https://github.com/polotek/libxmljs) by [François de Campredon](https://github.com/fdecampredon) +* [:link:](lwip/lwip.d.ts) [Light-weight image processor](https://github.com/EyalAr/lwip) by [Aya Morisawa](https://github.com/AyaMorisawa) +* [:link:](lime-js/lime-js.d.ts) [lime-js](https://github.com/takenet/lime-js) by [Arthur Xavier](https://github.com/arthur-xavier) * [:link:](line-reader/line-reader.d.ts) [line-reader](https://github.com/nickewing/line-reader) by [Sam Saint-Pettersen](https://github.com/stpettersens) * [:link:](dustjs-linkedin/dustjs-linkedin.d.ts) [linkedin dustjs](https://github.com/linkedin/dustjs) by [Marcelo Dezem](http://github.com/mdezem) * [:link:](linq/linq.jquery.d.ts) [linq.jquery (from linq.js)](http://linqjs.codeplex.com) by [neuecc](http://www.codeplex.com/site/users/view/neuecc) @@ -802,6 +860,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](linqsharp/linqsharp.d.ts) [linqsharp](https://www.npmjs.com/package/linqsharp) by [Bruno Leonardo Michels](https://github.com/brunolm) * [:link:](jquery.livestampjs/jquery.livestampjs.d.ts) [Livestamp.js](http://mattbradley.github.com/livestampjs) by [Vincent Bortone](https://github.com/vbortone) * [:link:](lodash/lodash.d.ts) [Lo-Dash](http://lodash.com) by [Brian Zengel](https://github.com/bczengel), [Ilya Mochalov](https://github.com/chrootsu) +* [:link:](lobibox/lobibox.d.ts) [lobibox](https://github.com/arboshiki/lobibox) by [Sabeeh Ul Hussnain](https://github.com/itboy87) * [:link:](lockfile/lockfile.d.ts) [lockfile](https://github.com/isaacs/lockfile) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](lodash-decorators/lodash-decorators.d.ts) [lodash-decorators](https://github.com/steelsojka/lodash-decorators) by [Qubo](https://github.com/tkqubo) * [:link:](log4javascript/log4javascript.d.ts) [log4javascript](http://log4javascript.org) by [Markus Wagner](https://github.com/Ritzlgrmft) @@ -812,7 +871,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](logrotate-stream/logrotate-stream.d.ts) [logrotate-stream](https://github.com/dstokes/logrotate-stream) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](lokijs/lokijs.d.ts) [lokijs](https://github.com/techfort/LokiJS) by [TeamworkGuy2](https://github.com/TeamworkGuy2) * [:link:](lolex/lolex.d.ts) [lolex](https://github.com/sinonjs/lolex) by [Wim Looman](https://github.com/Nemo157) -* [:link:](long/long.d.ts) [Long.js](https://github.com/dcodeIO/Long.js) by [Peter Kooijmans](https://github.com/peterkooijmans) +* [:link:](long/long.d.ts) [long.js](https://github.com/dcodeIO/long.js) by [Peter Kooijmans](https://github.com/peterkooijmans) * [:link:](lory.js/lory.js.d.ts) [lory](https://github.com/meandmax/lory) by [kubosho](https://github.com/kubosho) * [:link:](lovefield/lovefield.d.ts) [Lovefield](http://google.github.io/lovefield) by [freshp86](https://github.com/freshp86) * [:link:](lower-case/lower-case.d.ts) [lower-case](https://github.com/blakeembrey/lower-case) by [Sam Saint-Pettersen](https://github.com/stpettersens) @@ -836,6 +895,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](mariasql/mariasql.d.ts) [mariasql](https://github.com/mscdex/node-mariasql) by [MichaelBennett](https://github.com/bennett000) * [:link:](marionette/marionette.d.ts) [Marionette](https://github.com/marionettejs) by [Zeeshan Hamid](https://github.com/zhamid), [Natan Vivo](https://github.com/nvivo), [Sven Tschui](https://github.com/sventschui) * [:link:](marked/marked.d.ts) [Marked](https://github.com/chjj/marked) by [William Orr](https://github.com/worr) +* [:link:](ngwysiwyg/ngwysiwyg.d.ts) [Marked](https://github.com/psergus/ngWYSIWYG) by [Patrick Mac Kay](https://github.com/patrick-mackay) * [:link:](markerclustererplus/markerclustererplus.d.ts) [MarkerClustererPlus for Google Maps V3](http://github.com/mahnunchik/markerclustererplus) by [Mathias Rodriguez](http://github.com/enanox) * [:link:](markitup/markitup.d.ts) [markitup 1.x](https://github.com/markitup/1.x) by [drillbits](https://github.com/drillbits) * [:link:](maskedinput/maskedinput.d.ts) [Masked Input plugin for jQuery](http://digitalbush.com/projects/masked-input-plugin) by [Lokesh Peta](https://github.com/lokeshpeta) @@ -881,21 +941,24 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](mixto/mixto.d.ts) [mixto](https://github.com/atom/mixto) by [vvakame](https://github.com/vvakame) * [:link:](mkdirp/mkdirp.d.ts) [mkdirp](http://github.com/substack/node-mkdirp) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](mkpath/mkpath.d.ts) [mkpath](https://www.npmjs.com/package/mkpath) by [Jared Klopper](https://github.com/optical) +* [:link:](mmmagic/mmmagic.d.ts) [mmmagic](https://github.com/mscdex/mmmagic) by [Andrei Sebastian Cîmpean](http://andreime.com) * [:link:](mobile-detect/mobile-detect.d.ts) [mobile-detect](http://hgoebl.github.io/mobile-detect.js) by [Martin McWhorter](https://github.com/martinmcwhorter) -* [:link:](mobservable-react/mobservable-react.d.ts) [mobservable](https://github.com/mweststrate/mobservable-react) by [Michel Weststrate](https://github.com/mweststrate) * [:link:](mobservable/mobservable.d.ts) [mobservable](https://mweststrate.github.io/mobservable) by [Michel Weststrate](https://github.com/mweststrate) +* [:link:](mobservable-react/mobservable-react.d.ts) [mobservable](https://github.com/mweststrate/mobservable-react) by [Michel Weststrate](https://github.com/mweststrate) * [:link:](mocha/mocha.d.ts) [mocha](http://mochajs.org) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid), [otiai10](https://github.com/otiai10), [jt000](https://github.com/jt000), [Vadim Macagon](https://github.com/enlight) * [:link:](mocha/mocha-node.d.ts) [mocha](http://mochajs.org) by [Vadim Macagon](https://github.com/enlight), [vvakame](https://github.com/vvakame) * [:link:](mocha-phantomjs/mocha-phantomjs.d.ts) [mocha-phantomjs](http://metaskills.net/mocha-phantomjs) by [Erik Schierboom](https://github.com/ErikSchierboom) * [:link:](mock-fs/mock-fs.d.ts) [mock-fs](https://github.com/tschaub/mock-fs) by [Wim Looman](https://github.com/Nemo157) * [:link:](mockery/mockery.d.ts) [mockery](https://github.com/mfncooper/mockery) by [jt000](https://github.com/jt000) -* [:link:](modernizr/modernizr.d.ts) [Modernizr](http://modernizr.com) by [Boris Yankov](https://github.com/borisyankov), [Theodore Brown](https://github.com/theodorejb) +* [:link:](modernizr/modernizr.d.ts) [Modernizr](http://modernizr.com) by [Boris Yankov](https://github.com/borisyankov), [Theodore Brown](https://github.com/theodorejb), [Leon Yu](https://github.com/leonyu) * [:link:](moment-timezone/moment-timezone.d.ts) [moment-timezone.js](http://momentjs.com/timezone) by [Michel Salib](https://github.com/michelsalib) -* [:link:](moment/moment.d.ts) [Moment.js](https://github.com/timrwood/moment) by [Michael Lakerveld](https://github.com/Lakerfield), [Aaron King](https://github.com/kingdango), [Hiroki Horiuchi](https://github.com/horiuchi), [Dick van den Brink](https://github.com/DickvdBrink), [Adi Dahiya](https://github.com/adidahiya), [Matt Brooks](https://github.com/EnableSoftware) -* [:link:](moment/moment-node.d.ts) [Moment.js](https://github.com/timrwood/moment) by [Michael Lakerveld](https://github.com/Lakerfield), [Aaron King](https://github.com/kingdango), [Hiroki Horiuchi](https://github.com/horiuchi), [Dick van den Brink](https://github.com/DickvdBrink), [Adi Dahiya](https://github.com/adidahiya), [Matt Brooks](https://github.com/EnableSoftware) * [:link:](moment-range/moment-range.d.ts) [Moment.js](https://github.com/gf3/moment-range) by [Bart van den Burg](https://github.com/Burgov), [Wilgert Velinga](https://github.com/wilgert) +* [:link:](moment/moment-node.d.ts) [Moment.js](https://github.com/timrwood/moment) by [Michael Lakerveld](https://github.com/Lakerfield), [Aaron King](https://github.com/kingdango), [Hiroki Horiuchi](https://github.com/horiuchi), [Dick van den Brink](https://github.com/DickvdBrink), [Adi Dahiya](https://github.com/adidahiya), [Matt Brooks](https://github.com/EnableSoftware) +* [:link:](moment/moment.d.ts) [Moment.js](https://github.com/timrwood/moment) by [Michael Lakerveld](https://github.com/Lakerfield), [Aaron King](https://github.com/kingdango), [Hiroki Horiuchi](https://github.com/horiuchi), [Dick van den Brink](https://github.com/DickvdBrink), [Adi Dahiya](https://github.com/adidahiya), [Matt Brooks](https://github.com/EnableSoftware) * [:link:](mongodb/mongodb.d.ts) [MongoDB](https://github.com/mongodb/node-mongodb-native) by [Boris Yankov](https://github.com/borisyankov) * [:link:](mongoose/mongoose.d.ts) [Mongoose](http://mongoosejs.com) by [horiuchi](https://github.com/horiuchi) +* [:link:](mongoose-auto-increment/mongoose-auto-increment.d.ts) [mongoose-auto-increment](https://github.com/codetunnel/mongoose-auto-increment) by [Aya Morisawa](https://github.com/AyaMorisawa) +* [:link:](mongoose-deep-populate/mongoose-deep-populate.d.ts) [mongoose-deep-populate](https://github.com/buunguyen/mongoose-deep-populate) by [Aya Morisawa](https://github.com/AyaMorisawa) * [:link:](mongoose-mock/mongoose-mock.d.ts) [mongoose-mock](https://github.com/JohanObrink/mongoose-mock) by [jt000](https://github.com/jt000) * [:link:](morgan/morgan.d.ts) [morgan](https://github.com/expressjs/morgan) by [James Roland Cabresos](https://github.com/staticfunction) * [:link:](mousetrap/mousetrap-global-bind.d.ts) [Mousetrap 1.4.6's global-bind extension](http://craig.is/killing/mice#extensions.global) by [Andrew Bradley](https://github.com/cspotcode) @@ -910,7 +973,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](msportalfx-test/msportalfx-test.d.ts) [msportalfx-test](https://msazure.visualstudio.com/DefaultCollection/AzureUX/_git/portalfx-msportalfx-test) by [Julio Casal](https://github.com/julioct) * [:link:](mssql/mssql.d.ts) [mssql](https://www.npmjs.com/package/mssql) by [COLSA Corporation](http://www.colsa.com), [Ben Farr](https://github.com/jaminfarr) * [:link:](mu2/mu2.d.ts) [mu2](http://github.com/raycmorgan/mu) by [Jeff Goddard](https://github.com/jedigo) -* [:link:](multer/multer.d.ts) [multer](https://github.com/expressjs/multer) by [jt000](https://github.com/jt000), [vilicvane](https://vilic.github.io) +* [:link:](multer/multer.d.ts) [multer](https://github.com/expressjs/multer) by [jt000](https://github.com/jt000), [vilicvane](https://vilic.github.io), [David Broder-Rodgers](https://github.com/DavidBR-SW) * [:link:](multiplexjs/multiplexjs.d.ts) [Multiplex.js](http://github.com/multiplex/multiplex.js) by [Kamyar Nazeri](http://github.com/KamyarNazeri) * [:link:](mustache/mustache.d.ts) [Mustache](https://github.com/janl/mustache.js) by [Mark Ashley Bell](https://github.com/markashleybell) * [:link:](natural/natural.d.ts) [Natural](https://github.com/NaturalNode/natural) by [Dylan R. E. Moonfire](https://github.com/dmoonfire) @@ -925,23 +988,30 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](ng-flow/ng-flow.d.ts) [ng-flow](https://github.com/flowjs/ng-flow) by [Ryan McNamara](https://github.com/ryan10132) * [:link:](ng-grid/ng-grid.d.ts) [ng-grid](http://angular-ui.github.io/ng-grid) by [Ken Smith](https://github.com/smithkl42), [Roland Zwaga](https://github.com/rolandzwaga), [Kent Cooper](https://github.com/kentcooper) * [:link:](angular-idle/angular-idle.d.ts) [ng-idle](http://hackedbychinese.github.io/ng-idle) by [mthamil](https://github.com/mthamil) +* [:link:](ng-notify/ng-notify.d.ts) [ng-notify](https://github.com/matowens/ng-notify) by [Nick Zamosenchuk](https://github.com/nzamosenchuk) * [:link:](ngbootbox/ngbootbox.d.ts) [ngbootbox](https://github.com/eriktufvesson/ngBootbox) by [Sam Saint-Pettersen](https://github.com/stpettersens) +* [:link:](ng-cordova/actionSheet.d.ts) [ngCordova Action Sheet plugin](https://github.com/driftyco/ng-cordova) by [Phil McCloghry-Laing](https://github.com/pmccloghrylaing) * [:link:](ng-cordova/appAvailability.d.ts) [ngCordova AppAvailability plugin](https://github.com/driftyco/ng-cordova) by [Kapil Sachdeva](https://github.com/ksachdeva) -* [:link:](ng-cordova/datepicker.d.ts) [ngCordova datepicker plugin](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker) by [Jacques Kang](https://www.linkedin.com/in/jacqueskang) +* [:link:](ng-cordova/badge.d.ts) [ngCordova badge plugin](https://github.com/driftyco/ng-cordova) by [Phil McCloghry-Laing](https://github.com/pmccloghrylaing) * [:link:](ng-cordova/app-version.d.ts) [ngCordova datepicker plugin](https://github.com/driftyco/ng-cordova) by [Jacques Kang](https://www.linkedin.com/in/jacqueskang) +* [:link:](ng-cordova/datepicker.d.ts) [ngCordova datepicker plugin](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker) by [Jacques Kang](https://www.linkedin.com/in/jacqueskang) * [:link:](ng-cordova/deviceMotion.d.ts) [ngCordova device motion plugin](https://github.com/driftyco/ng-cordova) by [Michel Vidailhet](https://github.com/mvidailhet), [Kapil Sachdeva](https://github.com/ksachdeva) * [:link:](ng-cordova/deviceOrientation.d.ts) [ngCordova device orientation plugin](https://github.com/driftyco/ng-cordova) by [Michel Vidailhet](https://github.com/mvidailhet), [Kapil Sachdeva](https://github.com/ksachdeva) * [:link:](ng-cordova/device.d.ts) [ngCordova device plugin](https://github.com/driftyco/ng-cordova) by [Kapil Sachdeva](https://github.com/ksachdeva) * [:link:](ng-cordova/dialogs.d.ts) [ngCordova dialogs plugin](https://github.com/driftyco/ng-cordova) by [Michel Vidailhet](https://github.com/mvidailhet), [Kapil Sachdeva](https://github.com/ksachdeva) * [:link:](ng-cordova/emailComposer.d.ts) [ngCordova emailComposer plugin](https://github.com/driftyco/ng-cordova) by [Kapil Sachdeva](https://github.com/ksachdeva) +* [:link:](ng-cordova/file.d.ts) [ngCordova file plugin](https://github.com/driftyco/ng-cordova) by [Phil McCloghry-Laing](https://github.com/pmccloghrylaing) +* [:link:](ng-cordova/fileTransfer.d.ts) [ngCordova file-transfer plugin](https://github.com/driftyco/ng-cordova) by [Phil McCloghry-Laing](https://github.com/pmccloghrylaing) * [:link:](ng-cordova/geolocation.d.ts) [ngCordova geolocation plugin](https://github.com/driftyco/ng-cordova) by [Kapil Sachdeva](https://github.com/ksachdeva) * [:link:](ng-cordova/network.d.ts) [ngCordova network plugin](https://github.com/driftyco/ng-cordova) by [Kapil Sachdeva](https://github.com/ksachdeva) * [:link:](ng-cordova/tsd.d.ts) [ngCordova plugins](https://github.com/driftyco/ng-cordova) by [Kapil Sachdeva](https://github.com/ksachdeva) * [:link:](ng-cordova/toast.d.ts) [ngCordova toast plugin](https://github.com/driftyco/ng-cordova) by [Kapil Sachdeva](https://github.com/ksachdeva) +* [:link:](ng-cordova/camera.d.ts) [ngCordova.plugins.camera](https://github.com/driftyco/ng-cordova) by [Jacques Kang](https://www.linkedin.com/in/jacqueskang) * [:link:](ng-dialog/ng-dialog.d.ts) [ngDialog](https://github.com/likeastore/ngDialog) by [Stephen Lautier](https://github.com/stephenlautier) * [:link:](ngkookies/ngkookies.d.ts) [ngKookes](https://github.com/voronianski/ngKookies) by [Martin McWhorter](https://github.com/martinmcwhorter) * [:link:](ngprogress/ngprogress.d.ts) [ngProgress](http://victorbjelkholm.github.io/ngProgress) by [Martin McWhorter](https://github.com/martinmcwhorter) * [:link:](ngprogress-lite/ngprogress-lite.d.ts) [ngprogress-lite](https://github.com/voronianski/ngprogress-lite) by [Luke Forder](https://github.com/LukeForder) +* [:link:](ng-stomp/ng-stomp.d.ts) [ngStomp](https://github.com/beevelop/ng-stomp) by [Lukasz Potapczuk](https://github.com/lpotapczuk) * [:link:](nightmare/nightmare.d.ts) [Nightmare](https://github.com/segmentio/nightmare) by [horiuchi](https://github.com/horiuchi) * [:link:](noble/noble.d.ts) [noble](https://github.com/sandeepmistry/noble) by [Seon-Wook Park](https://github.com/swook) * [:link:](nock/nock.d.ts) [nock](https://github.com/pgte/nock) by [bonnici](https://github.com/bonnici) @@ -959,6 +1029,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](config/config.d.ts) [node-config](https://github.com/lorenwest/node-config) by [Roman Korneev](https://github.com/RWander) * [:link:](node-config-manager/node-config-manager.d.ts) [node-config-manager](https://www.npmjs.com/package/node-config-manager) by [TANAKA Koichi](https://gitnub.com/mugeso) * [:link:](convict/convict.d.ts) [node-convict](https://github.com/mozilla/node-convict) by [Wim Looman](https://github.com/Nemo157) +* [:link:](node-dir/node-dir.d.ts) [node-dir](https://github.com/fshost/node-dir) by [Panu Horsmalahti](https://github.com/panuhorsmalahti) +* [:link:](email-templates/email-templates.d.ts) [node-email-templates](https://github.com/niftylettuce/node-email-templates) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](node-ffi/node-ffi.d.ts) [node-ffi](https://github.com/rbranson/node-ffi) by [Paul Loyd](https://github.com/loyd) * [:link:](node-fibers/node-fibers.d.ts) [node-fibers](https://github.com/laverdet/node-fibers) by [Cary Haynie](https://github.com/caryhaynie) * [:link:](node-form/node-form.d.ts) [node-form](https://github.com/rsamec/form) by [Roman Samec](https://github.com/rsamec) @@ -980,10 +1052,10 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](node-slack/node-slack.d.ts) [node-slack](https://github.com/xoxco/node-slack) by [Qubo](https://github.com/tkQubo) * [:link:](srp/srp.d.ts) [node-srp](https://github.com/mozilla/node-srp) by [Pat Smuk](https://github.com/Patman64) * [:link:](stack-trace/stack-trace.d.ts) [node-stack-trace](https://github.com/felixge/node-stack-trace) by [Exceptionless](https://github.com/exceptionless) -* [:link:](node-uuid/node-uuid-base.d.ts) [node-uuid.js](https://github.com/broofa/node-uuid) by [Jeff May](https://github.com/jeffmay) * [:link:](node-uuid/node-uuid-cjs.d.ts) [node-uuid.js](https://github.com/broofa/node-uuid) by [Jeff May](https://github.com/jeffmay) -* [:link:](node-uuid/node-uuid-global.d.ts) [node-uuid.js](https://github.com/broofa/node-uuid) by [Jeff May](https://github.com/jeffmay) +* [:link:](node-uuid/node-uuid-base.d.ts) [node-uuid.js](https://github.com/broofa/node-uuid) by [Jeff May](https://github.com/jeffmay) * [:link:](node-uuid/node-uuid.d.ts) [node-uuid.js](https://github.com/broofa/node-uuid) by [Jeff May](https://github.com/jeffmay) +* [:link:](node-uuid/node-uuid-global.d.ts) [node-uuid.js](https://github.com/broofa/node-uuid) by [Jeff May](https://github.com/jeffmay) * [:link:](node-validator/node-validator.d.ts) [node-validator](https://www.npmjs.com/package/node-validator) by [Ken Gorab](https://github.com/kengorab) * [:link:](node-webkit/node-webkit.d.ts) [node-webkit](https://github.com/rogerwang/node-webkit) by [Pedro Casaubon](https://github.com/xperiments) * [:link:](xml2js/xml2js.d.ts) [node-xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) by [Michel Salib](https://github.com/michelsalib), [Jason McNeil](https://github.com/jasonrm) @@ -991,6 +1063,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](restify/restify.d.ts) [node.js REST framework](https://github.com/mcavage/node-restify) by [Bret Little](https://github.com/blittle) * [:link:](node/node.d.ts) [Node.js v4.x](http://nodejs.org) by [Microsoft TypeScript](http://typescriptlang.org), [DefinitelyTyped](https://github.com/borisyankov/DefinitelyTyped) * [:link:](each/each.d.ts) [NodeEach](http://www.adaltas.com/projects/node-each) by [Michael Zabka](https://github.com/misak113) +* [:link:](yandex-money-sdk/yandex-money-sdk.d.ts) [NodeJS Yandex.Money API SDK](https://github.com/yandex-money/yandex-money-sdk-nodejs) by [Ilya Mochalov](https://github.com/chrootsu) * [:link:](nodemailer/nodemailer.d.ts) [Nodemailer](https://github.com/andris9/Nodemailer) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](nodemailer/nodemailer-types.d.ts) [Nodemailer](https://github.com/andris9/Nodemailer) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](nodemailer-direct-transport/nodemailer-direct-transport.d.ts) [nodemailer-direct-transport](https://github.com/andris9/nodemailer-direct-transport) by [Rogier Schouten](https://github.com/rogierschouten) @@ -1000,8 +1073,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](nodeunit/nodeunit.d.ts) [nodeunit](https://github.com/caolan/nodeunit) by [Jeff Goddard](https://github.com/jedigo) * [:link:](nomnom/nomnom.d.ts) [nomnom](https://github.com/harthur/nomnom) by [Paul Vick](https://github.com/panopticoncentral) * [:link:](nopt/nopt.d.ts) [nopt](https://github.com/npm/nopt) by [jbondc](https://github.com/jbondc) -* [:link:](notifyjs/notifyjs.d.ts) [notify.js](https://github.com/alexgibson/notify.js) by [soundTricker](https://github.com/soundTricker) * [:link:](notify/notify.d.ts) [Notify.js](https://github.com/jpillora/notifyjs) by [Xiaohan Zhang](https://github.com/hellochar) +* [:link:](notifyjs/notifyjs.d.ts) [notify.js](https://github.com/alexgibson/notify.js) by [soundTricker](https://github.com/soundTricker) * [:link:](wnumb/wnumb.d.ts) [nouislider](https://github.com/leongersen/wnumb) by [Corey Jepperson](https://github.com/acoreyj) * [:link:](nouislider/nouislider.d.ts) [nouislider](https://github.com/leongersen/noUiSlider) by [Patrick Davies](https://github.com/bleuarg) * [:link:](noVNC/noVNC.d.ts) [noVNC](https://github.com/kanaka/noVNC) by [Ken Smith](https://github.com/smithkl42) @@ -1026,23 +1099,25 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](OpenJsCad/openjscad.d.ts) [OpenJsCad.js](https://github.com/joostn/OpenJsCad) by [Dan Marshall](https://github.com/danmarshall) * [:link:](openlayers/openlayers.d.ts) [OpenLayers](http://openlayers.org) by [Wouter Goedhart](https://github.com/woutergd) * [:link:](openpgp/openpgp.d.ts) [openpgpjs](http://openpgpjs.org) by [Guillaume Lacasa](https://blog.lacasa.fr) -* [:link:](opn/opn.d.ts) [opn](https://github.com/sindresorhus/opn) by [Shinnosuke Watanabe](https://github.com/shinnn) +* [:link:](opn/opn.d.ts) [opn](https://github.com/sindresorhus/opn) by [Shinnosuke Watanabe](https://github.com/shinnn), [Maxime LUCE](https://github.com/SomaticIT) * [:link:](optimist/optimist.d.ts) [optimist](https://github.com/substack/node-optimist) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](orchestrator/orchestrator.d.ts) [Orchestrator](https://github.com/orchestrator/orchestrator) by [Qubo](https://github.com/tkQubo) * [:link:](os-locale/os-locale.d.ts) [os-locale](https://github.com/sindresorhus/os-locale) by [Aya Morisawa](https://github.com/AyaMorisawa) * [:link:](owlcarousel/owlcarousel.d.ts) [OwlCarousel v.1.3.3](https://github.com/OwlFonk/OwlCarousel) by [Damian Piątkowski](https://github.com/dpiatkowski) +* [:link:](p2/p2.d.ts) [p2.js](https://github.com/schteppe/p2.js) by [Clark Stevenson](https://github.com/clark-stevenson) * [:link:](packery/packery.d.ts) [Packery](http://packery.metafizzy.co) by [Piraveen Kamalathas from Kilix](https://github.com/piraveen) * [:link:](page/page.d.ts) [page](http://visionmedia.github.io/page.js) by [Alan Norbauer](http://alan.norbauer.com) +* [:link:](pako/pako.d.ts) [pako](https://github.com/nodeca/pako) by [Denis Cappellin](http://github.com/cappellin) * [:link:](papaparse/papaparse.d.ts) [PapaParse](https://github.com/mholt/PapaParse) by [Pedro Flemming](https://github.com/torpedro) * [:link:](parallel/parallel.d.ts) [parallel.js](http://adambom.github.io/parallel.js) by [Josh Baldwin](https://github.com/jbaldwin) * [:link:](param-case/param-case.d.ts) [param-case](https://github.com/blakeembrey/param-case) by [Sam Saint-Pettersen](https://github.com/stpettersens) * [:link:](parse/parse.d.ts) [Parse](https://parse.com) by [Ullisen Media Group](http://ullisenmedia.com) -* [:link:](parsimmon/parsimmon.d.ts) [Parsimmon](https://github.com/jneen/parsimmon) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](parsimmon/parsimmon.d.ts) [Parsimmon](https://github.com/jneen/parsimmon) by [Bart van der Schoor](https://github.com/Bartvds), [Mizunashi Mana](https://github.com/mizunashi-mana) * [:link:](pascal-case/pascal-case.d.ts) [pascal-case](https://github.com/blakeembrey/pascal-case) by [Sam Saint-Pettersen](https://github.com/stpettersens) * [:link:](passport/passport.d.ts) [Passport](http://passportjs.org) by [Horiuchi_H](https://github.com/horiuchi) * [:link:](passport-strategy/passport-strategy.d.ts) [Passport Strategy module](https://github.com/jaredhanson/passport-strategy) by [Lior Mualem](https://github.com/liorm) -* [:link:](passport-facebook/passport-facebook.d.ts) [passport-facebook](https://github.com/jaredhanson/passport-facebook) by [James Roland Cabresos](https://github.com/staticfunction) * [:link:](passport-google-oauth/passport-google-oauth.d.ts) [passport-facebook](https://github.com/jaredhanson/passport-facebook) by [James Roland Cabresos](https://github.com/staticfunction) +* [:link:](passport-facebook/passport-facebook.d.ts) [passport-facebook](https://github.com/jaredhanson/passport-facebook) by [James Roland Cabresos](https://github.com/staticfunction) * [:link:](passport-twitter/passport-twitter.d.ts) [passport-facebook](https://github.com/jaredhanson/passport-facebook) by [James Roland Cabresos](https://github.com/staticfunction) * [:link:](passport-facebook-token/passport-facebook-token.d.ts) [passport-facebook-token](https://github.com/drudge/passport-facebook-token) by [Ray Martone](https://github.com/rmartone) * [:link:](passport-local/passport-local.d.ts) [passport-local](https://github.com/jaredhanson/passport-local) by [Maxime LUCE](https://github.com/SomaticIT) @@ -1085,6 +1160,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](poly2tri/poly2tri.d.ts) [poly2tri](http://github.com/r3mi/poly2tri.js) by [Elemar Junior](https://github.com/elemarjr) * [:link:](polyline/polyline.d.ts) [Polyline](https://github.com/mapbox/polyline) by [Arseniy Maximov](https://github.com/Kern0) * [:link:](polymer/polymer.d.ts) [polymer](https://github.com/Polymer/polymer) by [Louis Grignon](https://github.com/lgrignon), [Suguru Inatomi](https://github.com/laco0416) +* [:link:](polymer-ts/polymer-ts.d.ts) [PolymerTS](https://github.com/nippur72/PolymerTS) by [Louis Grignon](https://github.com/lgrignon) * [:link:](popcorn/popcorn.d.ts) [Popcorn](https://github.com/mozilla/popcorn-js) by [grapswiz](https://github.com/grapswiz) * [:link:](postal/postal.d.ts) [Postal](https://github.com/postaljs/postal.js) by [Lokesh Peta](https://github.com/lokeshpeta), [Paul Jolly](https://github.com/myitcv) * [:link:](pouchDB/pouch.d.ts) [Pouch](http://pouchdb.com) by [Bill Sears](https://github.com/MrBigDog2U) @@ -1099,6 +1175,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](promise-pool/promise-pool.d.ts) [promise-pool](https://github.com/vilic/promise-pool) by [VILIC VANE](https://github.com/vilic) * [:link:](promises-a-plus/promises-a-plus.d.ts) [promises-a-plus](http://promisesaplus.com) by [Igor Oleinikov](https://github.com/Igorbek) * [:link:](protobufjs/protobufjs.d.ts) [ProtoBuf.js](https://github.com/dcodeIO/ProtoBuf.js) by [Panu Horsmalahti](https://github.com/panuhorsmalahti) +* [:link:](protractor-http-mock/protractor-http-mock.d.ts) [protractor-http-mock](https://github.com/atecarlos/protractor-http-mock) by [Crevil](https://github.com/Crevil) * [:link:](proxyquire/proxyquire.d.ts) [Proxyquire](https://github.com/thlorenz/proxyquire) by [jt000](https://github.com/jt000) * [:link:](pty.js/pty.js.d.ts) [pty.js 0.2.7-1](https://github.com/chjj/pty.js) by [Vadim Macagon](https://github.com/enlight) * [:link:](pubsubjs/pubsub.d.ts) [PubSubJS](https://github.com/mroderick/PubSubJS) by [Boris Yankov](https://github.com/borisyankov) @@ -1110,6 +1187,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](qajax/qajax.d.ts) [Qajax](https://github.com/gre/qajax) by [Boltmade](https://github.com/Boltmade) * [:link:](qs/qs.d.ts) [qs](https://github.com/hapijs/qs) by [Roman Korneev](https://github.com/RWander) * [:link:](qtip2/qtip2.d.ts) [qtip2](http://qtip2.com) by [Nathan Pitman](https://github.com/Seltzer) +* [:link:](query-string/query-string.d.ts) [query-string](https://github.com/sindresorhus/query-string) by [Sam Verschueren](https://github.com/SamVerschueren) * [:link:](quixote/quixote.d.ts) [quixote](http://quixote-css.com) by [Aleksandr Filatov](https://github.com/greybax) * [:link:](qunit/qunit.d.ts) [QUnit](http://qunitjs.com) by [Diullei Gomes](https://github.com/diullei) * [:link:](qwest/qwest.d.ts) [qwest](https://github.com/pyrsmk/qwest) by [Lindsay Evans](https://github.com/lindsayevans) @@ -1119,13 +1197,15 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](rangy/rangy.d.ts) [Rangy](https://github.com/timdown/rangy) by [Rudolph Gottesheim](http://www.midnight-design.at) * [:link:](raphael/raphael.d.ts) [Raphael](http://raphaeljs.com) by [CheCoxshall](https://github.com/CheCoxshall) * [:link:](rappid/rappid.d.ts) [Rappid](http://jointjs.com/about-rappid) by [Ewout Van Gossum](https://github.com/DenEwout) +* [:link:](ratelimiter/ratelimiter.d.ts) [ratelimiter](https://github.com/tj/node-ratelimiter) by [Aya Morisawa](https://github.com/AyaMorisawa) * [:link:](ravenjs/ravenjs.d.ts) [Raven.js](https://github.com/getsentry/raven-js) by [Santi Albo](https://github.com/santialbo) * [:link:](raygun4js/raygun4js.d.ts) [raygun4js](https://github.com/MindscapeHQ/raygun4js) by [Brian Surowiec](https://github.com/xt0rted) +* [:link:](rcloader/rcloader.d.ts) [rcloader](https://github.com/spalger/rcloader) by [Panu Horsmalahti](https://github.com/panuhorsmalahti) * [:link:](react/react.d.ts) [React](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) * [:link:](react/react-global.d.ts) [React (namespace)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) * [:link:](react/react-addons-create-fragment.d.ts) [React (react-addons-create-fragment)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) -* [:link:](react/react-addons-shallow-compare.d.ts) [React (react-addons-css-transition-group)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) * [:link:](react/react-addons-css-transition-group.d.ts) [React (react-addons-css-transition-group)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) +* [:link:](react/react-addons-shallow-compare.d.ts) [React (react-addons-css-transition-group)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) * [:link:](react/react-addons-linked-state-mixin.d.ts) [React (react-addons-linked-state-mixin)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) * [:link:](react/react-addons-perf.d.ts) [React (react-addons-perf)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) * [:link:](react/react-addons-pure-render-mixin.d.ts) [React (react-addons-pure-render-mixin)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) @@ -1134,16 +1214,19 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](react/react-addons-update.d.ts) [React (react-addons-update)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) * [:link:](react/react-dom.d.ts) [React (react-dom)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com) * [:link:](react-dnd/react-dnd.d.ts) [React DnD](https://github.com/gaearon/react-dnd) by [Asana](https://asana.com) -* [:link:](react-router/react-router.d.ts) [React Router](https://github.com/rackt/react-router) by [Yuichi Murata](https://github.com/mrk21), [Václav Ostrožlík](https://github.com/vasek17) * [:link:](react-bootstrap/react-bootstrap.d.ts) [react-bootstrap](https://github.com/react-bootstrap/react-bootstrap) by [Walker Burgin](https://github.com/walkerburgin) +* [:link:](react-datagrid/react-datagrid.d.ts) [react-datagrid](https://github.com/zippyui/react-datagrid.git) by [Stephen Jelfs](https://github.com/stephenjelfs) * [:link:](react-day-picker/react-day-picker.d.ts) [react-day-picker](https://github.com/gpbl/react-day-picker) by [Giampaolo Bellavite](https://github.com/gpbl), [Jason Killian](https://github.com/jkillian) * [:link:](react-dropzone/react-dropzone.d.ts) [react-dropzone](https://github.com/paramaggarwal/react-dropzone) by [Mathieu Larouche Dube](https://github.com/matdube) +* [:link:](react-infinite/react-infinite.d.ts) [react-infinite](https://github.com/seatgeek/react-infinite) by [rhysd](https://github.com/rhysd) * [:link:](react-input-calendar/react-input-calendar.d.ts) [react-input-calendar](https://github.com/Rudeg/react-input-calendar) by [Stepan Mikhaylyuk](https://github.com/stepancar) * [:link:](react-intl/react-intl.d.ts) [react-intl](http://formatjs.io/react) by [Bruno Grieder](https://github.com/bgrieder), [Christian Droulers](https://github.com/cdroulers) * [:link:](react-mixin/react-mixin.d.ts) [react-mixin](https://github.com/brigand/react-mixin) by [Qubo](https://github.com/tkqubo) * [:link:](react-native/react-native.d.ts) [react-native](https://github.com/facebook/react-native) by [Bruno Grieder](https://github.com/bgrieder) * [:link:](react-props-decorators/react-props-decorators.d.ts) [react-props-decorators](https://github.com/popkirby/react-props-decorators) by [Qubo](https://github.com/tkqubo) * [:link:](react-redux/react-redux.d.ts) [react-redux](https://github.com/rackt/react-redux) by [Qubo](https://github.com/tkqubo) +* [:link:](react-router/react-router.d.ts) [react-router](https://github.com/rackt/react-router) by [Sergey Buturlakin](http://github.com/sergey-buturlakin), [Yuichi Murata](https://github.com/mrk21), [Václav Ostrožlík](https://github.com/vasek17) +* [:link:](react-select/react-select.d.ts) [react-select](https://github.com/JedWatson/react-select) by [ESQUIBET Hugo](https://github.com/Hesquibet) * [:link:](react-spinkit/react-spinkit.d.ts) [react-spinkit](https://github.com/KyleAMathews/react-spinkit) by [Qubo](https://github.com/tkqubo) * [:link:](react-swf/react-swf.d.ts) [react-swf](https://github.com/syranide/react-swf) by [Stepan Mikhaylyuk](https://github.com/stepancar) * [:link:](read/read.d.ts) [read](https://github.com/isaacs/read) by [Tim JK](https://github.com/timjk) @@ -1155,11 +1238,10 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](redux-action-utils/redux-action-utils.d.ts) [redux-action-utils](https://github.com/insin/redux-action-utils) by [Qubo](https://github.com/tkqubo) * [:link:](redux-actions/redux-actions.d.ts) [redux-actions](https://github.com/acdlite/redux-actions) by [Jack Hsu](https://github.com/jaysoo) * [:link:](redux-devtools/redux-devtools.d.ts) [redux-devtools](https://github.com/gaearon/redux-devtools) by [Qubo](https://github.com/tkqubo) +* [:link:](redux-form/redux-form.d.ts) [redux-form](https://github.com/erikras/redux-form) by [Daniel Lytkin](https://github.com/aikoven) * [:link:](redux-logger/redux-logger.d.ts) [redux-logger](https://github.com/fcomb/redux-logger) by [Alexander Rusakov](https://github.com/arusakov) * [:link:](redux-thunk/redux-thunk.d.ts) [redux-thunk](https://github.com/gaearon/redux-thunk) by [Qubo](https://github.com/tkqubo) -* [:link:](ref/ref.d.ts) [ref](https://github.com/TooTallNate/ref) by [Paul Loyd](https://github.com/loyd) * [:link:](ref-array/ref-array.d.ts) [ref-array](https://github.com/TooTallNate/ref-array) by [Paul Loyd](https://github.com/loyd) -* [:link:](ref-struct/ref-struct.d.ts) [ref-struct](https://github.com/TooTallNate/ref-struct) by [Paul Loyd](https://github.com/loyd) * [:link:](ref-union/ref-union.d.ts) [ref-union](https://github.com/TooTallNate/ref-union) by [Paul Loyd](https://github.com/loyd) * [:link:](reflux/reflux.d.ts) [RefluxJS](https://github.com/reflux/refluxjs) by [Maurice de Beijer](https://github.com/mauricedb) * [:link:](request/request.d.ts) [request](https://github.com/mikeal/request) by [Carlos Ballesteros Velasco](https://github.com/soywiz), [bonnici](https://github.com/bonnici), [Bart van der Schoor](https://github.com/Bartvds), [Joe Skeen](http://github.com/joeskeen) @@ -1186,6 +1268,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](routie/routie.d.ts) [routie](https://github.com/jgallen23/routie) by [Adilson](https://github.com/Adilson) * [:link:](rsmq/rsmq.d.ts) [rsmq](http://smrchy.github.io/rsmq) by [Qubo](https://github.com/MugeSo) * [:link:](rsmq-worker/rsmq-worker.d.ts) [rsmq-worker](http://smrchy.github.io/rsmq/rsmq-worker) by [TANAKA Koichi](https://github.com/MugeSo) +* [:link:](rss/rss.d.ts) [rss](https://github.com/dylang/node-rss) by [Second Datke](https://github.com/secondwtq) * [:link:](rtree/rtree.d.ts) [rtree](https://github.com/leaflet-extras/RTree) by [Omede Firouz](https://github.com/oefirouz) * [:link:](run-sequence/run-sequence.d.ts) [run-sequence](https://github.com/OverZealous/run-sequence) by [Keita Kagurazaka](https://github.com/k-kagurazaka) * [:link:](rx/rx.d.ts) [RxJS](http://rx.codeplex.com) by [gsino](http://www.codeplex.com/site/users/view/gsino), [Igor Oleinikov](https://github.com/Igorbek) @@ -1203,7 +1286,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](rx/rx.time.d.ts) [RxJS-Time](http://rx.codeplex.com) by [Carl de Billy](http://carl.debilly.net), [Igor Oleinikov](https://github.com/Igorbek) * [:link:](rx/rx.virtualtime.d.ts) [RxJS-VirtualTime](http://rx.codeplex.com) by [gsino](http://www.codeplex.com/site/users/view/gsino), [Igor Oleinikov](https://github.com/Igorbek) * [:link:](s3-uploader/s3-uploader.d.ts) [s3-uploader](https://www.npmjs.com/package/s3-uploader) by [COLSA Corporation](http://www.colsa.com) +* [:link:](s3rver/s3rver.d.ts) [S3rver](https://github.com/jamhall/s3rver) by [David Broder-Rodgers](https://github.com/DavidBR-SW) * [:link:](sammyjs/sammyjs.d.ts) [Sammy.js](http://sammyjs.org) by [Boris Yankov](https://github.com/borisyankov), [Oisin Grehan](https://github.com/oising) +* [:link:](sandboxed-module/sandboxed-module.d.ts) [sandboxed-module](https://github.com/felixge/node-sandboxed-module) by [Sven Reglitzki](https://github.com/svi3c) * [:link:](sanitize-filename/sanitize-filename.d.ts) [sanitize-filename](https://github.com/parshap/node-sanitize-filename) by [Wim Looman](https://github.com/Nemo157) * [:link:](sanitize-html/sanitize-html.d.ts) [sanitize-html](https://github.com/punkave/sanitize-html) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](sanitizer/sanitizer.d.ts) [Sanitizer](https://github.com/theSmaw/Caja-HTML-Sanitizer) by [Dave Taylor](http://davetayls.me) @@ -1212,6 +1297,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](scalike/scalike.d.ts) [scalike API](https://github.com/ryoppy/scalike-typescript) by [ryoppy](https://github.com/ryoppy) * [:link:](screenfull/screenfull.d.ts) [screenfull.js](https://github.com/sindresorhus/screenfull.js) by [Ilia Choly](http://github.com/icholy) * [:link:](scrolltofixed/scrolltofixed.d.ts) [ScrollToFixed](https://github.com/bigspotteddog/ScrollToFixed) by [Ben Dixon](https://github.com/bmdixon) +* [:link:](scrypt-async/scrypt-async.d.ts) [scrypt-async](https://github.com/dchest/scrypt-async-js) by [Kaur Kuut](https://github.com/xStrom) * [:link:](seedrandom/seedrandom.d.ts) [seedrandom](https://github.com/davidbau/seedrandom) by [Kern Handa](https://github.com/kernhanda) * [:link:](segment-analytics/segment-analytics.d.ts) [Segment's analytics.js](https://segment.com/docs/libraries/analytics.js) by [Andrew Fong](https://github.com/fongandrew) * [:link:](analytics-node/analytics-node.d.ts) [Segment's analytics.js for Node.js](https://segment.com/docs/libraries/node) by [Andrew Fong](https://github.com/fongandrew) @@ -1226,6 +1312,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](sequelize-fixtures/sequelize-fixtures.d.ts) [Sequelize-Fixtures](https://github.com/domasx2/sequelize-fixtures) by [Christian Schwarz](https://github.com/cschwarz) * [:link:](serve-favicon/serve-favicon.d.ts) [serve-favicon](https://github.com/expressjs/serve-favicon) by [Uros Smolnik](https://github.com/urossmolnik) * [:link:](on-headers/on-headers.d.ts) [serve-favicon](https://github.com/jshttp/on-headers) by [John Jeffery](https://github.com/jjeffery) +* [:link:](serve-index/serve-index.d.ts) [serve-index](https://github.com/expressjs/serve-index) by [Tanguy Krotoff](https://github.com/tkrotoff) * [:link:](serve-static/serve-static.d.ts) [serve-static](https://github.com/expressjs/serve-static) by [Uros Smolnik](https://github.com/urossmolnik) * [:link:](sharedworker/SharedWorker.d.ts) [SharedWorker](http://www.w3.org/TR/workers) by [Toshiya Nakakura](https://github.com/nakakura) * [:link:](sharepoint/SharePoint.d.ts) [SharePoint 2010 and 2013](https://github.com/gandjustas/sptypescript) by [Stanislav Vyshchepan](http://blog.gandjustas.ru), [Andrey Markeev](http://markeev.com) @@ -1234,11 +1321,13 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](should-promised/should-promised.d.ts) [should-promised](https://github.com/shouldjs/promised) by [Yaroslav Admin](https://github.com/devoto13) * [:link:](should/should.d.ts) [should.js](https://github.com/visionmedia/should.js) by [Alex Varju](https://github.com/varju), [Maxime LUCE](https://github.com/SomaticIT) * [:link:](showdown/showdown.d.ts) [Showdown](https://github.com/coreyti/showdown) by [cbowdon](https://github.com/cbowdon) +* [:link:](shuffle-array/shuffle-array.d.ts) [shuffle-array](https://github.com/pazguille/shuffle-array) by [rhysd](https://rhysd.github.io) * [:link:](siesta/siesta.d.ts) [Siesta](http://www.bryntum.com/products/siesta) by [bquarmby](https://github.com/bquarmby) * [:link:](sigmajs/sigmajs.d.ts) [sigma.js](https://github.com/jacomyal/sigma.js) by [Qinfeng Chen](https://github.com/qinfchen) * [:link:](signalr/signalr.d.ts) [SignalR](http://www.asp.net/signalr) by [Boris Yankov](https://github.com/borisyankov), [T. Michael Keesey](https://github.com/keesey) * [:link:](signature_pad/signature_pad.d.ts) [signature_pad](https://github.com/szimek/signature_pad) by [Abubaker Bashir](https://github.com/AbubakerB) * [:link:](simple-cw-node/simple-cw-node.d.ts) [simple-cw-node](https://github.com/astronaughts/simple-cw-node) by [vvakame](https://github.com/vvakame) +* [:link:](simple-mock/simple-mock.d.ts) [simple-mock](https://github.com/jupiter/simple-mock) by [Leon Yu](https://github.com/leonyu) * [:link:](simplebar/simplebar.d.ts) [simplebar.js](https://github.com/Grsmto/simplebar) by [Gregor Woiwode](https://github.com/gregonnet) * [:link:](jquery.simplemodal/jquery.simplemodal.d.ts) [SimpleModal](http://www.ericmmartin.com/projects/simplemodal) by [Friedrich von Never](https://github.com/ForNeVeR) * [:link:](simplestorage.js/simplestorage.js.d.ts) [simpleStorage](https://github.com/andris9/simpleStorage) by [Áxel Costas Pena](https://github.com/axelcostaspena) @@ -1259,6 +1348,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](socket.io/socket.io.d.ts) [socket.io](http://socket.io) by [PROGRE](https://github.com/progre), [Damian Connolly](https://github.com/divillysausages) * [:link:](socket.io-client/socket.io-client.d.ts) [socket.io-client](http://socket.io) by [PROGRE](https://github.com/progre), [Damian Connolly](https://github.com/divillysausages) * [:link:](socket.io.users/socket.io.users.d.ts) [socket.io.users](https://github.com/nodets/socket.io.users) by [Makis Maropoulos](https://github.com/kataras) +* [:link:](socketty/socketty.d.ts) [Socketty](https://www.npmjs.com/package/socketty) by [Nax](https://github.com/Nax) * [:link:](sockjs/sockjs.d.ts) [SockJS 0.3.x](https://github.com/sockjs/sockjs-client) by [Emil Ivanov](https://github.com/vladev) * [:link:](sockjs-client/sockjs-client.d.ts) [sockjs-client](https://github.com/sockjs/sockjs-client) by [Emil Ivanov](https://github.com/vladev), [Alexander Rusakov](https://github.com/arusakov) * [:link:](sockjs-node/sockjs-node.d.ts) [sockjs-node 0.3.x](https://github.com/sockjs/sockjs-node) by [Phil McCloghry-Laing](https://github.com/pmccloghrylaing) @@ -1272,6 +1362,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](split/split.d.ts) [split](https://github.com/dominictarr/split) by [Marcin Porębski](https://github.com/marcinporebski) * [:link:](sprintf-js/sprintf-js.d.ts) [sprintf-js](https://www.npmjs.com/package/sprintf-js) by [Jason Swearingen](https://jasonswearingen.github.io) * [:link:](sprintf/sprintf.d.ts) [sprintff](https://github.com/maritz/node-sprintff) by [Carlos Ballesteros Velasco](https://github.com/soywiz) +* [:link:](sql.js/sql.js.d.ts) [sql.js](https://github.com/kripken/sql.js) by [George Wu](https://github.com/Hozuki) * [:link:](sqlite3/sqlite3.d.ts) [sqlite3](https://github.com/mapbox/node-sqlite3) by [Nick Malaguti](https://github.com/nmalaguti) * [:link:](squirejs/squirejs.d.ts) [Squire](https://github.com/iammerrick/Squire.js) by [Bradley Ayers](https://github.com/bradleyayers) * [:link:](ssh2/ssh2.d.ts) [ssh2](https://github.com/mscdex/ssh2) by [Qubo](https://github.com/tkQubo) @@ -1285,13 +1376,15 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](status-bar/status-bar.d.ts) [status-bar](https://github.com/atom/status-bar) by [vvakame](https://github.com/vvakame) * [:link:](statuses/statuses.d.ts) [statuses](https://github.com/jshttp/statuses) by [Tanguy Krotoff](https://github.com/tkrotoff) * [:link:](steam/steam.d.ts) [steam](https://github.com/seishun/node-steam) by [Andrey Kurdyumov](https://github.com/kant2002) +* [:link:](slick-carousel/slick-carousel.d.ts) [stick](http://kenwheeler.github.io/slick) by [John Gouigouix](https://github.com/orchestra-ts/DefinitelyTyped) * [:link:](storejs/storejs.d.ts) [store.js](https://github.com/marcuswestin/store.js) by [Vincent Bortone](https://github.com/vbortone) * [:link:](stream-series/stream-series.d.ts) [stream-series](https://github.com/rschmukler/stream-series) by [Keita Kagurazaka](https://github.com/k-kagurazaka) * [:link:](stream-to-array/stream-to-array.d.ts) [stream-to-array](https://github.com/stream-utils/stream-to-array) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](streamjs/streamjs.d.ts) [streamjs](http://winterbe.github.io/streamjs) by [Bence Eros](https://github.com/erosb) * [:link:](string_score/string_score.d.ts) [string_score](https://github.com/joshaven/string_score) by [Marcin Porębski](https://github.com/marcinporebski) * [:link:](string/string.d.ts) [string.js](http://stringjs.com) by [Bas Pennings](https://github.com/basp) -* [:link:](stripe/stripe.d.ts) [stripe](https://stripe.com) by [Andy Hawkins](https://github.com/a904guy/,http://a904guy.com), [Eric J. Smith](https://github.com/ejsmith) +* [:link:](strip-json-comments/strip-json-comments.d.ts) [strip-json-comments](https://github.com/sindresorhus/strip-json-comments) by [Dylan R. E. Moonfire](https://github.com/dmoonfire) +* [:link:](stripe/stripe.d.ts) [stripe](https://stripe.com) by [Andy Hawkins](https://github.com/a904guy/,http://a904guy.com), [Eric J. Smith](https://github.com/ejsmith), [Amrit Kahlon](https://github.com/amritk) * [:link:](stripe-checkout/stripe-checkout.d.ts) [Stripe Checkout](https://stripe.com/checkout) by [Chris Wrench](https://github.com/cgwrench) * [:link:](stripe/stripe-node.d.ts) [stripe-node](https://github.com/stripe/stripe-node) by [William Johnston](https://github.com/wjohnsto) * [:link:](strophe/strophe.d.ts) [Strophe.js](http://strophe.im/strophejs) by [David Deutsch](https://github.com/DavidKDeutsch) @@ -1299,6 +1392,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](sugar/sugar.d.ts) [Sugar](http://sugarjs.com) by [Josh Baldwin](https://github.com/jbaldwin) * [:link:](superagent/superagent.d.ts) [SuperAgent](https://github.com/visionmedia/superagent) by [Alex Varju](https://github.com/varju) * [:link:](supertest/supertest.d.ts) [SuperTest](https://github.com/visionmedia/supertest) by [Alex Varju](https://github.com/varju) +* [:link:](supertest-as-promised/supertest-as-promised.d.ts) [SuperTest as Promised](https://github.com/WhoopInc/supertest-as-promised) by [Tanguy Krotoff](https://github.com/tkrotoff) * [:link:](svg-injector/svg-injector.d.ts) [SVG Injector](https://github.com/iconic/SVGInjector) by [Patrick Westerhoff](https://github.com/poke) * [:link:](svg-pan-zoom/svg-pan-zoom.d.ts) [svg-pan-zoom](https://github.com/ariutta/svg-pan-zoom) by [Chintan Shah](https://github.com/Promact) * [:link:](svg-sprite/svg-sprite.d.ts) [svg-sprite](https://github.com/jkphl/svg-sprite) by [Qubo](https://github.com/tkqubo) @@ -1310,6 +1404,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](swap-case/swap-case.d.ts) [swap-case](https://github.com/blakeembrey/swap-case) by [Sam Saint-Pettersen](https://github.com/stpettersens) * [:link:](sweetalert/sweetalert.d.ts) [SweetAlert](https://github.com/t4t5/sweetalert) by [Markus Peloso](https://github.com/ToastHawaii) * [:link:](swfobject/swfobject.d.ts) [swfobject](https://code.google.com/p/swfobject) by [rou](https://github.com/rou) +* [:link:](swiftclick/swiftclick.d.ts) [SwiftClick](https://github.com/munkychop/swiftclick) by [Laurence C](https://github.com/Laurence-C) * [:link:](swig/swig.d.ts) [swig](http://github.com/paularmstrong/swig) by [Peter Harris](https://github.com/CodeAnimal), [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](swig-email-templates/swig-email-templates.d.ts) [swig-email-templates](https://github.com/andrewrk/swig-email-templates) by [Adam Babcock](https://github.com/mrhen) * [:link:](swipe/swipe.d.ts) [Swipe](https://github.com/thebird/Swipe) by [Andrey Kurdyumov](https://github.com/kant2002) @@ -1320,20 +1415,20 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](systemjs/systemjs.d.ts) [System.js](https://github.com/systemjs/systemjs) by [Ludovic HENIN](https://github.com/ludohenin), [Nathan Walker](https://github.com/NathanWalker) * [:link:](tabris/tabris.d.ts) [Tabris.js](http://tabrisjs.com) by [Tabris.js team](http://github.com/eclipsesource/tabris) * [:link:](tabtab/tabtab.d.ts) [tabtab](https://github.com/mklabs/node-tabtab) by [Vojtěch Habarta](https://github.com/vojtechhabarta) -* [:link:](tape/tape.d.ts) [tape](https://github.com/substack/tape) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](tape/tape.d.ts) [tape](https://github.com/substack/tape) by [Bart van der Schoor](https://github.com/Bartvds), [Haoqun Jiang](https://github.com/sodatea) * [:link:](tar/tar.d.ts) [tar](https://github.com/npm/node-tar) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](tcomb/tcomb.d.ts) [tcomb](http://gcanti.github.io/tcomb/guide/index.html) by [Hans Windhoff](https://github.com/hansrwindhoff) * [:link:](tea-merge/tea-merge.d.ts) [tea-merge](https://github.com/qualiancy/tea-merge) by [Mihhail Lapushkin](https://github.com/mihhail-lapushkin) * [:link:](tedious/tedious.d.ts) [tedious](https://pekim.github.io/tedious) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](tedious-connection-pool/tedious-connection-pool.d.ts) [tedious-connection-pool](https://github.com/pekim/tedious-connection-pool) by [Cyprien Autexier](https://github.com/sandorfr) * [:link:](teechart/teechart.d.ts) [TeeChart](http://www.steema.com) by [Steema Software](https://steema.com) +* [:link:](temp/temp.d.ts) [temp](https://www.npmjs.com/package/temp) by [Daniel Rosenwasser](https://github.com/DanielRosenwasser) * [:link:](temp-fs/temp-fs.d.ts) [temp-fs](https://github.com/jakwings/node-temp-fs) by [MEDIA CHECK s.r.o.](http://www.mediacheck.cz) * [:link:](tether/tether.d.ts) [Tether](http://github.hubspot.com/tether) by [Adi Dahiya](https://github.com/adidahiya) * [:link:](tether-shepherd/tether-shepherd.d.ts) [Tether-Shepherd](http://github.hubspot.com/shepherd) by [Matt Gibbs](https://github.com/mtgibbs) * [:link:](text-buffer/text-buffer.d.ts) [text-buffer](https://github.com/atom/text-buffer) by [vvakame](https://github.com/vvakame) * [:link:](text-encoding/text-encoding.d.ts) [text-encoding](https://github.com/inexorabletash/text-encoding) by [MIZUNE Pine](https://github.com/pine613) -* [:link:](github-electron/github-electron-main.d.ts) [the Electron 0.25.2 main process](http://electron.atom.io) by [jedmao](https://github.com/jedmao) -* [:link:](github-electron/github-electron-renderer.d.ts) [the Electron 0.25.2 renderer process (web page)](http://electron.atom.io) by [jedmao](https://github.com/jedmao) +* [:link:](spotify-api/spotify-api.d.ts) [The Spotify Web API](https://developer.spotify.com/web-api) by [Niels Kristian Hansen Skovmand](https://github.com/skovmand) * [:link:](threejs/three-FirstPersonControls.d.ts) [three.js](http://mrdoob.github.com/three.js) by [Poul Kjeldager Sørensen](https://github.com/s093294) * [:link:](threejs/three-canvasrenderer.d.ts) [three.js (CanvasRenderer.js)](https://github.com/mrdoob/three.js/blob/master/examples/js/renderers/CanvasRenderer.js) by [Satoru Kimura](https://github.com/gyohk) * [:link:](threejs/three-copyshader.d.ts) [three.js (CopyShader.js)](https://github.com/mrdoob/three.js/blob/r68/examples/js/shaders/CopyShader.js) by [Satoru Kimura](https://github.com/gyohk) @@ -1353,7 +1448,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](threejs/three.d.ts) [three.js r73](http://mrdoob.github.com/three.js) by [Kon](http://phyzkit.net), [Satoru Kimura](https://github.com/gyohk) * [:link:](thrift/thrift.d.ts) [thrift](https://www.npmjs.com/package/thrift) by [Zachary Collins](https://github.com/corps) * [:link:](through/through.d.ts) [through](https://github.com/dominictarr/through) by [Andrew Gaspar](https://github.com/AndrewGaspar) -* [:link:](through2/through2.d.ts) [through2 v](https://github.com/rvagg/through2) by [Bart van der Schoor](https://github.com/Bartvds), [jedmao](https://github.com/jedmao) +* [:link:](through2/through2.d.ts) [through2 v](https://github.com/rvagg/through2) by [Bart van der Schoor](https://github.com/Bartvds), [jedmao](https://github.com/jedmao), [Georgios Valotasios](https://github.com/valotas) * [:link:](timelinejs/timelinejs.d.ts) [timelinejs](https://github.com/NUKnightLab/TimelineJS) by [Roland Zwaga](https://github.com/rolandzwaga) * [:link:](timezone-js/timezone-js.d.ts) [timezone-js](https://github.com/mde/timezone-js) by [bonnici](https://github.com/bonnici) * [:link:](timezonecomplete/timezonecomplete.d.ts) [timezonecomplete](https://github.com/SpiritIT/timezonecomplete) by [Rogier Schouten](https://github.com/rogierschouten) @@ -1367,10 +1462,12 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](tooltipster/tooltipster.d.ts) [tooltipster](https://github.com/iamceege/tooltipster) by [Stephen Lautier](https://github.com/stephenlautier) * [:link:](sencha_touch/SenchaTouch.d.ts) [Touch](http://www.sencha.com/products/touch) by [Brian Kotek](https://github.com/brian428) * [:link:](traceback/traceback.d.ts) [Traceback](http://github.com/iriscouch/traceback) by [Michael Zabka](https://github.com/misak113) +* [:link:](tracking/tracking.d.ts) [Tracking.js](https://github.com/eduardolundgren/tracking.js) by [Tim Perry](https://github.com/pimterry) * [:link:](traverson/traverson.d.ts) [Traverson](https://github.com/basti1302/traverson) by [Marcin Porębski](https://github.com/marcinporebski) * [:link:](trunk8/trunk8.d.ts) [trunk8](https://github.com/rviscomi/trunk8) by [Blake Niemyjski](https://github.com/niemyjski) * [:link:](tsmonad/tsmonad.d.ts) [TsMonad](https://github.com/cbowdon/TsMonad) by [Chris Bowdon](https://github.com/cbowdon) * [:link:](tspromise/tspromise.d.ts) [tspromise](https://github.com/soywiz/tspromise) by [Carlos Ballesteros Velasco](https://github.com/soywiz) +* [:link:](turf/turf.d.ts) [Turf](http://turfjs.org) by [Guillaume Croteau](https://github.com/gcroteau) * [:link:](tween.js/tween.js.d.ts) [tween.js r12](https://github.com/sole/tween.js) by [sunetos](https://github.com/sunetos), [jzarnikov](https://github.com/jzarnikov) * [:link:](tweenjs/tweenjs.d.ts) [TweenJS](http://www.createjs.com/#!/TweenJS) by [Pedro Ferreira](https://bitbucket.org/drk4), [Chris Smith](https://github.com/evilangelist) * [:link:](twig/twig.d.ts) [twig](https://github.com/justjohn/twig.js) by [Carlos Ballesteros Velasco](https://github.com/soywiz) @@ -1389,9 +1486,10 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](ui-grid/ui-grid.d.ts) [ui-grid](http://www.ui-grid.info) by [Ben Tesser](https://github.com/btesser), [Joe Skeen](http://github.com/joeskeen) * [:link:](ui-router-extras/ui-router-extras.d.ts) [UI-Router Extras (ct.ui.router.extras module)](https://github.com/christopherthielen/ui-router-extras) by [Michael Putters](https://github.com/mputters), [Marcel van de Kamp](https://github.com/marcel-k) * [:link:](uikit/uikit.d.ts) [uikit](http://getuikit.org) by [Giovanni Silva](https://github.com/giovannicandido) -* [:link:](umbraco/umbraco.d.ts) [Umbraco](https://github.com/umbraco) by [DeCareSystemsIreland](https://github.com/DeCareSystemsIreland) -* [:link:](umbraco/umbraco-resources.d.ts) [Umbraco](https://github.com/umbraco) by [DeCareSystemsIreland](https://github.com/DeCareSystemsIreland) * [:link:](umbraco/umbraco-services.d.ts) [Umbraco](https://github.com/umbraco) by [DeCareSystemsIreland](https://github.com/DeCareSystemsIreland) +* [:link:](umbraco/umbraco-resources.d.ts) [Umbraco](https://github.com/umbraco) by [DeCareSystemsIreland](https://github.com/DeCareSystemsIreland) +* [:link:](umbraco/umbraco.d.ts) [Umbraco](https://github.com/umbraco) by [DeCareSystemsIreland](https://github.com/DeCareSystemsIreland) +* [:link:](umzug/umzug.d.ts) [Umzug](https://github.com/sequelize/umzug) by [Ivan Drinchev](https://github.com/drinchev) * [:link:](underscore/underscore.d.ts) [Underscore](http://underscorejs.org) by [Boris Yankov](https://github.com/borisyankov), [Josh Baldwin](https://github.com/jbaldwin) * [:link:](underscore-ko/underscore-ko.d.ts) [Underscore-ko 1.2.2 with underscore](https://github.com/kamranayub/UnderscoreKO) by [Maurits Elbers](https://github.com/MagicMau) * [:link:](underscore.string/underscore.string.d.ts) [underscore.string](https://github.com/epeli/underscore.string) by [Ry Racherbaumer](http://github.com/rygine) @@ -1399,6 +1497,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jquery.uniform/jquery.uniform.d.ts) [Uniform.js](https://github.com/pixelmatrix/uniform) by [flyfishMT](https://github.com/flyfishMT) * [:link:](uniq/uniq.d.ts) [uniq](https://www.npmjs.com/package/uniq) by [Hans Windhoff](https://github.com/hansrwindhoff) * [:link:](unique-random/unique-random.d.ts) [unique-random](https://github.com/sindresorhus/unique-random) by [Yuki Kokubun](https://github.com/Kuniwak) +* [:link:](winrt/winrt-uwp.d.ts) [Universal Windows Platform](http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx) by [Kagami Sascha Rosylight](https://github.com/saschanaz), [Taylor Starfield](https://github.com/taylor224) * [:link:](universal-analytics/universal-analytics.d.ts) [universal-analytics](https://github.com/peaksandpies/universal-analytics) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](unorm/unorm.d.ts) [unorm](https://github.com/walling/unorm) by [Christopher Brown](https://github.com/chbrown) * [:link:](update-notifier/update-notifier.d.ts) [update-notifier](https://github.com/yeoman/update-notifier) by [vvakame](https://github.com/vvakame) @@ -1411,12 +1510,14 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](urlrouter/urlrouter.d.ts) [urlrouter](https://github.com/fengmk2/urlrouter) by [soywiz](https://github.com/soywiz) * [:link:](urlsafe-base64/urlsafe-base64.d.ts) [urlsafe-base64](https://github.com/RGBboy/urlsafe-base64) by [Tanguy Krotoff](https://github.com/tkrotoff) * [:link:](usage/usage.d.ts) [usage](https://github.com/arunoda/node-usage) by [Pascal Vomhoff](https://github.com/pvomhoff) +* [:link:](username/username.d.ts) [username](https://www.npmjs.com/package/username) by [Klaus Reimer](https://github.com/kayahr) * [:link:](utils-merge/utils-merge.d.ts) [utils-merge](https://github.com/jaredhanson/utils-merge) by [Ilya Mochalov](https://github.com/chrootsu) -* [:link:](UUID/UUID.d.ts) [UUID.js core](https://github.com/LiosK/UUID.js) by [Jason Jarrett](https://github.com/staxmanade) +* [:link:](uuid/UUID.d.ts) [UUID.js core](https://github.com/LiosK/UUID.js) by [Jason Jarrett](https://github.com/staxmanade) * [:link:](valerie/valerie.d.ts) [valerie](https://github.com/davewatts/valerie) by [Howard Richards](https://github.com/conficient) * [:link:](validator/validator.d.ts) [validator.js](https://github.com/chriso/validator.js) by [tgfjt](https://github.com/tgfjt) * [:link:](vega/vega.d.ts) [Vega](http://trifacta.github.io/vega) by [Tom Crockett](http://github.com/pelotom) * [:link:](velocity-animate/velocity-animate.d.ts) [Velocity](http://velocityjs.org) by [Greg Smith](https://github.com/smrq) +* [:link:](verror/verror.d.ts) [verror](https://github.com/davepacheco/node-verror) by [Sven Reglitzki](https://github.com/svi3c) * [:link:](vex-js/vex-js.d.ts) [Vex](https://github.com/HubSpot/vex) by [Greg Cohan](https://github.com/gdcohan) * [:link:](vexflow/vexflow.d.ts) [VexFlow](http://vexflow.com) by [Roman Quiring](https://github.com/rquiring) * [:link:](victor/victor.d.ts) [Victor.js](http://victorjs.org) by [Ivane Gegia](https://twitter.com/ivanegegia) @@ -1431,7 +1532,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](vortex-web-client/vortex-web-client.d.ts) [Vortex Web 1.2.0p1](http://www.prismtech.com/vortex/vortex-web) by [Stefan Profanter](https://github.com/Pro) * [:link:](voximplant-websdk/voximplant-websdk.d.ts) [VoxImplant Web SDK 3.0.x](http://voximplant.com) by [Alexey Aylarov](https://github.com/aylarov) * [:link:](vso-node-api/vso-node-api.d.ts) [vso-node-api](https://github.com/Microsoft/vso-node-api) by [Teddy Ward](https://github.com/teddyward) -* [:link:](vue/vue.d.ts) [vuejs](https://github.com/yyx990803/vue) by [odangosan](https://github.com/odangosan) +* [:link:](vue-router/vue-router.d.ts) [vue-router](https://github.com/vuejs/vue-router) by [kaorun343](https://github.com/kaorun343) +* [:link:](vue/vue.d.ts) [vuejs](https://github.com/vuejs/vue) by [odangosan](https://github.com/odangosan), [kaorun343](https://github.com/kaorun343) +* [:link:](wake_on_lan/wake_on_lan.d.ts) [wake_on_lan](https://github.com/agnat/node_wake_on_lan) by [Tobias Kahlert](https://github.com/SrTobi) * [:link:](watch/watch.d.ts) [watch](https://github.com/mikeal/watch) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](jquery.watermark/jquery.watermark.d.ts) [Watermark plugin for jQuery](http://jquery-watermark.googlecode.com) by [Anwar Javed](https://github.com/anwarjaved) * [:link:](webaudioapi/waa.d.ts) [Web Audio API](http://www.w3.org/TR/webaudio) by [Baruch Berger](https://github.com/bbss), [Kon](http://phyzkit.net), [kubosho](https://github.com/kubosho) @@ -1441,6 +1544,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](webcola/webcola.d.ts) [webcola](https://github.com/tgdwyer/WebCola) by [Qinfeng Chen](https://github.com/qinfchen), [Tim Dwyer](https://github.com/tgdwyer), [Noah Chen](https://github.com/nchen63) * [:link:](webcomponents.js/webcomponents.js.d.ts) [webcomponents.js](https://github.com/webcomponents/webcomponentsjs) by [Adi Dahiya](https://github.com/adidahiya) * [:link:](webcrypto/WebCrypto.d.ts) [WebCrypto](http://www.w3.org/TR/WebCryptoAPI) by [Lucas Dixon](https://github.com/iislucas) +* [:link:](webdriverio/webdriverio.d.ts) [webdriverio](http://www.webdriver.io) by [Nick Malaguti](https://github.com/nmalaguti) * [:link:](webgl-ext/webgl-ext.d.ts) [WebGL Extensions](http://webgl.org) by [Arthur Langereis](https://github.com/zenmumbler) * [:link:](webix/webix.d.ts) [Webix UI](http://webix.com) by [Maksim Kozhukh](http://github.com/mkozhukh) * [:link:](webpack/webpack.d.ts) [webpack](https://github.com/webpack/webpack) by [Qubo](https://github.com/tkqubo) @@ -1457,8 +1561,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](winrt/winrt.d.ts) [WinRT](http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx) by [TypeScript samples](https://www.typescriptlang.org) * [:link:](winston/winston.d.ts) [winston](https://github.com/flatiron/winston) by [bonnici](https://github.com/bonnici), [Peter Harris](https://github.com/codeanimal) * [:link:](wolfy87-eventemitter/wolfy87-eventemitter.d.ts) [wolfy87-eventemitter](https://github.com/Wolfy87/EventEmitter) by [ryiwamoto](https://github.com/ryiwamoto) +* [:link:](wordcloud/wordcloud.d.ts) [wordcloud](https://github.com/timdream/wordcloud2.js) by [Joe Skeen](http://github.com/joeskeen) +* [:link:](wreck/wreck.d.ts) [wreck](https://github.com/hapijs/wreck) by [Marcin Porębski](http://github.com/marcinporebski) * [:link:](wrench/wrench.d.ts) [wrench](https://github.com/ryanmcgrath/wrench-js) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](ws/ws.d.ts) [ws](https://github.com/einaros/ws) by [Paul Loyd](https://github.com/loyd) +* [:link:](wu/wu.d.ts) [wu.js](https://fitzgen.github.io/wu.js) by [phiresky](https://github.com/phiresky) * [:link:](x-editable/x-editable.d.ts) [X-Editable](http://vitalets.github.io/x-editable/index.html) by [Chris Kirby](https://github.com/sirkirby) * [:link:](x2js/xml2json.d.ts) [x2js](https://code.google.com/p/x2js) by [Horiuchi_H](https://github.com/horiuchi) * [:link:](xdate/xdate.d.ts) [XDate](http://arshaw.com/xdate) by [yamada28go](https://github.com/yamada28go) @@ -1481,7 +1588,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](yui/yui.d.ts) [yui](https://github.com/yui/yui3) by [Gia Bảo @ Sân Đình](https://github.com/giabao) * [:link:](z-schema/z-schema.d.ts) [z-schema](https://github.com/zaggino/z-schema) by [Adam Meadows](https://github.com/job13er) * [:link:](zepto/zepto.d.ts) [Zepto](http://zeptojs.com) by [Josh Baldwin](https://github.com/jbaldwin) -* [:link:](zeroclipboard/zeroclipboard.d.ts) [ZeroClipboard](https://github.com/jonrohan/ZeroClipboard) by [Eric J. Smith](https://github.com/ejsmith), [Blake Niemyjski](https://github.com/niemyjski), [György Balássy](https://github.com/balassy) +* [:link:](zeroclipboard/zeroclipboard.d.ts) [ZeroClipboard v2.x.x](https://github.com/zeroclipboard/zeroclipboard) by [Eric J. Smith](https://github.com/ejsmith), [Blake Niemyjski](https://github.com/niemyjski), [György Balássy](https://github.com/balassy), [Leon Yu](https://github.com/leonyu) * [:link:](node_zeromq/zmq.d.ts) [ZeroMQ Node](https://github.com/JustinTulloss/zeromq.node) by [Dave McKeown](http://github.com/davemckeown) * [:link:](zip.js/zip.js.d.ts) [zip.js 2.x](https://github.com/gildas-lormeau/zip.js) by [Louis Grignon](https://github.com/lgrignon) * [:link:](zone.js/zone.js.d.ts) [Zone.js](https://github.com/angular/zone.js) by [angular team](https://github.com/angular) diff --git a/ace/ace.d.ts.tscparams b/ace/ace.d.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/ace/ace.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/ace/tests/ace-editor_text_edit-tests.ts.tscparams b/ace/tests/ace-editor_text_edit-tests.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/ace/tests/ace-editor_text_edit-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/ace/tests/ace-range-tests.ts.tscparams b/ace/tests/ace-range-tests.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/ace/tests/ace-range-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/ace/tests/ace-search-tests.ts.tscparams b/ace/tests/ace-search-tests.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/ace/tests/ace-search-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/angular-dynamic-locale/angular-dynamic-locale.d.ts b/angular-dynamic-locale/angular-dynamic-locale.d.ts index a30df1d7e..e404e9532 100644 --- a/angular-dynamic-locale/angular-dynamic-locale.d.ts +++ b/angular-dynamic-locale/angular-dynamic-locale.d.ts @@ -5,6 +5,11 @@ /// +declare module "angular-dynamic-locale" { + import ng = angular.dynamicLocale; + export = ng; +} + declare module angular.dynamicLocale { interface tmhDynamicLocaleService { diff --git a/angular-formly/angular-formly-tests.ts b/angular-formly/angular-formly-tests.ts index ef6a38463..2374fde4a 100644 --- a/angular-formly/angular-formly-tests.ts +++ b/angular-formly/angular-formly-tests.ts @@ -24,7 +24,7 @@ class FormConfig { } class AppController { - fields: AngularFormly.IFieldConfigurationObject[]; + fields: AngularFormly.IFieldArray; constructor() { var vm = this; vm.fields = [ @@ -99,6 +99,21 @@ class AppController { templateOptions: { label: 'no wrapper here...' } + }, + { + //From http://angular-formly.com/#/example/other/nested-formly-forms + key: 'address', + wrapper: 'panel', + templateOptions: { label: 'Address' }, + fieldGroup: [{ + key: 'town', + type: 'input', + templateOptions: { + required: true, + type: 'text', + label: 'Town' + } + }] } ] } diff --git a/angular-formly/angular-formly.d.ts b/angular-formly/angular-formly.d.ts index 2bf75af7d..7ee3d3194 100644 --- a/angular-formly/angular-formly.d.ts +++ b/angular-formly/angular-formly.d.ts @@ -1,7 +1,7 @@ -// Type definitions for angular-formly 6.18.0 +// Type definitions for angular-formly 7.2.3 // Project: https://github.com/formly-js/angular-formly // Definitions by: Scott Hatcher -// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -16,18 +16,23 @@ declare module 'angular-formly' { declare module AngularFormly { + interface IFieldArray extends Array { + + } interface IFieldGroup { data?: Object; className?: string; - elementAttributes?: { [key: string]: string }; - fieldGroup: IFieldConfigurationObject[]; + elementAttributes?: string; + fieldGroup: IFieldArray; form?: Object; hide?: boolean; - hideExpression?: string | IExpresssionFunction; + hideExpression?: string | IExpressionFunction; key?: string | number; model?: string | Object; - options?: IFormOptionsAPI + options?: IFormOptionsAPI; + templateOptions?: ITemplateOptions; + wrapper?: string | string[]; } @@ -46,7 +51,7 @@ declare module AngularFormly { /** * see http://docs.angular-formly.com/docs/formly-expressions#expressionproperties-validators--messages */ - interface IExpresssionFunction { + interface IExpressionFunction { ($viewValue: any, $modelValue: any, scope: ITemplateScope): any; } @@ -70,6 +75,11 @@ declare module AngularFormly { postWrapper?: ITemplateManipulator[]; } + interface ISelectOption { + name: string; + value?: string; + group?: string; + } /** * see http://docs.angular-formly.com/docs/ngmodelattrstemplatemanipulator @@ -104,6 +114,12 @@ declare module AngularFormly { description?: string; [key: string]: any; + // types for select/radio fields + options?: Array; + groupProp?: string; // default: group + valueProp?: string; // default: value + labelProp?: string; // default: name + } @@ -111,8 +127,8 @@ declare module AngularFormly { * see http://docs.angular-formly.com/docs/field-configuration-object#validators-object */ interface IValidator { - expression: string | IExpresssionFunction; - message?: string | IExpresssionFunction; + expression: string | IExpressionFunction; + message?: string | IExpressionFunction; } @@ -143,7 +159,7 @@ declare module AngularFormly { * see http://angular-formly.com/#/example/other/unique-value-async-validation */ asyncValidators?: { - [key: string]: string | IExpresssionFunction | IValidator; + [key: string]: string | IExpressionFunction | IValidator; } /** @@ -193,7 +209,7 @@ declare module AngularFormly { * see http://docs.angular-formly.com/docs/field-configuration-object#expressionproperties-object */ expressionProperties?: { - [key: string]: string | IExpresssionFunction | IValidator; + [key: string]: string | IExpressionFunction | IValidator; } @@ -213,7 +229,7 @@ declare module AngularFormly { * * see http://docs.angular-formly.com/docs/field-configuration-object#hideexpression-string--function */ - hideExpression?: string | IExpresssionFunction; + hideExpression?: string | IExpressionFunction; /** @@ -405,7 +421,7 @@ declare module AngularFormly { * like in this example. */ messages?: { - [key: string]: IExpresssionFunction | string; + [key: string]: IExpressionFunction | string; } @@ -429,7 +445,7 @@ declare module AngularFormly { * see http://docs.angular-formly.com/docs/field-configuration-object#validators-object */ validators?: { - [key: string]: string | IExpresssionFunction | IValidator; + [key: string]: string | IExpressionFunction | IValidator; } @@ -562,7 +578,7 @@ declare module AngularFormly { //Shortcut to options.formControl fc: ng.IFormController | ng.IFormController[]; //all the fields for the form - fields: IFieldConfigurationObject[]; + fields: IFieldArray; //the form controller the field is in form: any; //The object passed as options.formState to the formly-form directive. Use this to share state between fields. diff --git a/angular-loading-bar/angular-loading-bar-tests.ts b/angular-loading-bar/angular-loading-bar-tests.ts index b7ca2894e..b8bde9e93 100644 --- a/angular-loading-bar/angular-loading-bar-tests.ts +++ b/angular-loading-bar/angular-loading-bar-tests.ts @@ -7,9 +7,17 @@ class TestController { constructor($http: ng.IHttpService) { $http.get("http://xyz.com", { ignoreLoadingBar: true }) - + } } app.controller('TestController', TestController); + +var barConfig: angular.loadingBar.ILoadingBarProvider[] = []; +barConfig.push({ + includeSpinner: true, + includeBar: true, + spinnerTemplate: 'template', + latencyThreshold: 100 +}); diff --git a/angular-loading-bar/angular-loading-bar.d.ts b/angular-loading-bar/angular-loading-bar.d.ts index b1a8cd55d..acea6f048 100644 --- a/angular-loading-bar/angular-loading-bar.d.ts +++ b/angular-loading-bar/angular-loading-bar.d.ts @@ -14,5 +14,30 @@ declare module angular { */ ignoreLoadingBar?: boolean; } +} -} \ No newline at end of file +declare module angular.loadingBar { + + interface ILoadingBarProvider{ + /** + * Turn the spinner on or off + */ + includeSpinner?: boolean; + + /** + * Turn the loading bar on or off + */ + includeBar?: boolean; + + /** + * HTML template + */ + spinnerTemplate?: string; + + /** + * Latency Threshold + */ + latencyThreshold?: number; + } + +} diff --git a/angular-protractor/angular-protractor-tests.ts b/angular-protractor/angular-protractor-tests.ts index 45a5d7edc..0f98aead1 100644 --- a/angular-protractor/angular-protractor-tests.ts +++ b/angular-protractor/angular-protractor-tests.ts @@ -196,6 +196,27 @@ function TestWebDriverUntilModule() { conditionWebElements = protractor.until.elementsLocated(by.className('class')); } +function TestWebDriverExpectedConditionsModule() { + var conditionB: protractor.until.Condition; + var el: protractor.ElementFinder = element(by.id('id')); + + conditionB = protractor.ExpectedConditions.alertIsPresent(); + conditionB = protractor.ExpectedConditions.elementToBeClickable(el); + conditionB = protractor.ExpectedConditions.textToBePresentInElement(el, 'text'); + conditionB = protractor.ExpectedConditions.textToBePresentInElementValue(el, 'text'); + conditionB = protractor.ExpectedConditions.titleContains('text'); + conditionB = protractor.ExpectedConditions.titleIs('text'); + conditionB = protractor.ExpectedConditions.presenceOf(el); + conditionB = protractor.ExpectedConditions.stalenessOf(el); + conditionB = protractor.ExpectedConditions.visibilityOf(el); + conditionB = protractor.ExpectedConditions.invisibilityOf(el); + conditionB = protractor.ExpectedConditions.elementToBeSelected(el); + + conditionB = protractor.ExpectedConditions.not(protractor.ExpectedConditions.alertIsPresent()); + conditionB = protractor.ExpectedConditions.and(protractor.ExpectedConditions.alertIsPresent(), protractor.ExpectedConditions.elementToBeClickable(el)); + conditionB = protractor.ExpectedConditions.or(protractor.ExpectedConditions.alertIsPresent(), protractor.ExpectedConditions.elementToBeClickable(el)); +} + function TestProtractor() { var ptor: protractor.Protractor; var driver: webdriver.WebDriver = new webdriver.Builder(). diff --git a/angular-protractor/angular-protractor.d.ts b/angular-protractor/angular-protractor.d.ts index ff8324238..08f83e27d 100644 --- a/angular-protractor/angular-protractor.d.ts +++ b/angular-protractor/angular-protractor.d.ts @@ -501,6 +501,145 @@ declare module protractor { function titleMatches(regex: RegExp): webdriver.until.Condition; } + module ExpectedConditions { + /** + * Negates the result of a promise. + * + * @param {webdriver.until.Condition} expectedCondition + * @return {!webdriver.until.Condition} An expected condition that returns the negated value. + */ + function not(expectedCondition: webdriver.until.Condition): webdriver.until.Condition; + + /** + * Chain a number of expected conditions using logical_and, short circuiting at the + * first expected condition that evaluates to false. + * + * @param {...webdriver.until.Condition[]} fns An array of expected conditions to 'and' together. + * @return {!webdriver.until.Condition} An expected condition that returns a promise which evaluates + * to the result of the logical and. + */ + function and(...fns: webdriver.until.Condition[]): webdriver.until.Condition; + + /** + * Chain a number of expected conditions using logical_or, short circuiting at the + * first expected condition that evaluates to true. + * + * @param {...webdriver.until.Condition[]} fns An array of expected conditions to 'or' together. + * @return {!webdriver.until.Condition} An expected condition that returns a promise which + * evaluates to the result of the logical or. + */ + function or(...fns: webdriver.until.Condition[]): webdriver.until.Condition; + + /** + * Expect an alert to be present. + * + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether an alert is present. + */ + function alertIsPresent(): webdriver.until.Condition; + + /** + * An Expectation for checking an element is visible and enabled such that you can click it. + * + * @param {ElementFinder} element The element to check + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the element is clickable. + */ + function elementToBeClickable(element: ElementFinder): webdriver.until.Condition; + + /** + * An expectation for checking if the given text is present in the element. + * Returns false if the elementFinder does not find an element. + * + * @param {ElementFinder} element The element to check + * @param {string} text The text to verify against + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the text is present in the element. + */ + function textToBePresentInElement(element: ElementFinder, text: string): webdriver.until.Condition; + + /** + * An expectation for checking if the given text is present in the element’s value. + * Returns false if the elementFinder does not find an element. + * + * @param {ElementFinder} element The element to check + * @param {string} text The text to verify against + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the text is present in the element's value. + */ + function textToBePresentInElementValue( + element: ElementFinder, text: string + ): webdriver.until.Condition; + + /** + * An expectation for checking that the title contains a case-sensitive substring. + * + * @param {string} title The fragment of title expected + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the title contains the string. + */ + function titleContains(title: string): webdriver.until.Condition; + + /** + * An expectation for checking the title of a page. + * + * @param {string} title The expected title, which must be an exact match. + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the title equals the string. + */ + function titleIs(title: string): webdriver.until.Condition; + + /** + * An expectation for checking that an element is present on the DOM of a page. This does not necessarily + * mean that the element is visible. This is the opposite of 'stalenessOf'. + * + * @param {ElementFinder} elementFinder The element to check + * @return {!webdriver.until.Condition} An expected condition that returns a promise + * representing whether the element is present. + */ + function presenceOf(element: ElementFinder): webdriver.until.Condition; + + /** + * An expectation for checking that an element is not attached to the DOM of a page. + * This is the opposite of 'presenceOf'. + * + * @param {ElementFinder} elementFinder The element to check + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the element is stale. + */ + function stalenessOf(element: ElementFinder): webdriver.until.Condition; + + /** + * An expectation for checking that an element is present on the DOM of a page and visible. + * Visibility means that the element is not only displayed but also has a height and width that is + * greater than 0. This is the opposite of 'invisibilityOf'. + * + * @param {ElementFinder} elementFinder The element to check + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the element is visible. + */ + function visibilityOf(element: ElementFinder): webdriver.until.Condition; + + /** + * An expectation for checking that an element is present on the DOM of a page. This does not necessarily + * mean that the element is visible. This is the opposite of 'stalenessOf'. + * + * @param {ElementFinder} elementFinder The element to check + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the element is invisible. + */ + function invisibilityOf(element: ElementFinder): webdriver.until.Condition; + + /** + * An expectation for checking the selection is selected. + * + * @param {ElementFinder} elementFinder The element to check + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the element is selected. + */ + function elementToBeSelected(element: ElementFinder): webdriver.until.Condition; + } + //endregion /** @@ -1667,6 +1806,16 @@ declare module protractor { * @return {Protractor} a protractor instance. */ forkNewDriverInstance(opt_useSameUrl?: boolean, opt_copyMockModules?: boolean): Protractor; + + /** + * Get the processed configuration object that is currently being run. This will contain + * the specs and capabilities properties of the current runner instance. + * + * Set by the runner. + * + * @return {webdriver.promise.Promise} A promise which resolves to the capabilities object. + */ + getProcessedConfig(): webdriver.promise.Promise; } /** diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index ee855af3d..960012a57 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -6,8 +6,8 @@ /// declare module "angular-translate" { - var _: string; - export = _; + import ngt = angular.translate; + export = ngt; } declare module angular.translate { @@ -22,7 +22,7 @@ declare module angular.translate { interface IStorage { get(name: string): string; - set(name: string, value: string): void; + put(name: string, value: string): void; } interface IStaticFilesLoaderOptions { diff --git a/angular-ui-router/angular-ui-router-tests.ts b/angular-ui-router/angular-ui-router-tests.ts index 3211faee5..41661d60d 100644 --- a/angular-ui-router/angular-ui-router-tests.ts +++ b/angular-ui-router/angular-ui-router-tests.ts @@ -230,7 +230,7 @@ module UrlRouterProviderTests { // this allows you to configure custom behavior in between // location changes and route synchronization: $urlRouterProvider.deferIntercept(); - }).run(($rootScope: ng.IRootScopeService, $urlRouter: ng.ui.IUrlRouterService, UserService: ITestUserService) => { + }).run(($rootScope: ng.IRootScopeService, $urlRouter: ng.ui.IUrlRouterService, UserService: ITestUserService, $urlMatcher: ng.ui.IUrlMatcher) => { $rootScope.$on('$locationChangeSuccess', e => { // UserService is an example service for managing user state if (UserService.isLoggedIn()) return; @@ -245,6 +245,18 @@ module UrlRouterProviderTests { }); // Configures $urlRouter's listener *after* your custom listener - $urlRouter.listen(); + var listen: Function = $urlRouter.listen(); + + var href: string; + href = $urlRouter.href($urlMatcher); + href = $urlRouter.href($urlMatcher, {}); + href = $urlRouter.href($urlMatcher, {}, {}); + + $urlRouter.update(); + $urlRouter.update(false); + + $urlRouter.push($urlMatcher); + $urlRouter.push($urlMatcher, {}); + $urlRouter.push($urlMatcher, {}, {}); }); } diff --git a/angular-ui-router/angular-ui-router.d.ts b/angular-ui-router/angular-ui-router.d.ts index 257446f69..a22b7d0da 100644 --- a/angular-ui-router/angular-ui-router.d.ts +++ b/angular-ui-router/angular-ui-router.d.ts @@ -300,7 +300,10 @@ declare module angular.ui { * */ sync(): void; - listen(): void; + listen(): Function; + href(urlMatcher: IUrlMatcher, params?: IStateParamsService, options?: IHrefOptions): string; + update(read?: boolean): void; + push(urlMatcher: IUrlMatcher, params?: IStateParamsService, options?: IHrefOptions): void; } interface IUiViewScrollProvider { diff --git a/angular-ui-tree/angular-ui-tree-tests.ts b/angular-ui-tree/angular-ui-tree-tests.ts index 4e5ef91b9..718fada2c 100644 --- a/angular-ui-tree/angular-ui-tree-tests.ts +++ b/angular-ui-tree/angular-ui-tree-tests.ts @@ -78,5 +78,6 @@ var droppedCallback: AngularUITree.IDroppedCallback = (eventInfo: AngularUITree. var callbacks: AngularUITree.ICallbacks = { accept: acceptCallback, + dragStart: droppedCallback, dropped: droppedCallback }; diff --git a/angular-ui-tree/angular-ui-tree.d.ts b/angular-ui-tree/angular-ui-tree.d.ts index 62c8899fa..cfcb2b108 100644 --- a/angular-ui-tree/angular-ui-tree.d.ts +++ b/angular-ui-tree/angular-ui-tree.d.ts @@ -54,6 +54,7 @@ declare module AngularUITree { interface ICallbacks { accept: IAcceptCallback; + dragStart: IDroppedCallback; dropped: IDroppedCallback; } diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index 14e8d46fb..1e82f3154 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -5,6 +5,10 @@ /// +declare module 'angular-resource' { + var _: string; + export = _; +} /////////////////////////////////////////////////////////////////////////////// // ngResource module (angular-resource.js) diff --git a/angularjs/angular-route.d.ts b/angularjs/angular-route.d.ts index 5f426d51c..eafdf714c 100644 --- a/angularjs/angular-route.d.ts +++ b/angularjs/angular-route.d.ts @@ -128,6 +128,12 @@ declare module angular.route { } interface IRouteProvider extends IServiceProvider { + /** + * Match routes without being case sensitive + * + * This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive + */ + caseInsensitiveMatch?: boolean; /** * Sets route definition that will be used on route change when no other route definition is matched. * diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index a489141d5..97477e9a8 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -165,7 +165,7 @@ declare module angular { dot: number; codeName: string; }; - + /** * If window.name contains prefix NG_DEFER_BOOTSTRAP! when angular.bootstrap is called, the bootstrap process will be paused until angular.resumeBootstrap() is called. * @param extraModules An optional array of modules that should be added to the original list of modules that the app was about to be bootstrapped with. @@ -181,6 +181,13 @@ declare module angular { animation(name: string, animationFactory: Function): IModule; animation(name: string, inlineAnnotatedFunction: any[]): IModule; animation(object: Object): IModule; + /** + * Use this method to register a component. + * + * @param name The name of the component. + * @param options A definition object passed into the component. + */ + component(name: string, options: IComponentOptions): IModule; /** * Use this method to register work which needs to be performed on module loading. * @@ -1620,6 +1627,29 @@ declare module angular { totalPendingRequests: number; } + /////////////////////////////////////////////////////////////////////////// + // Component + // see http://angularjs.blogspot.com.br/2015/11/angularjs-15-beta2-and-14-releases.html + // and http://toddmotto.com/exploring-the-angular-1-5-component-method/ + /////////////////////////////////////////////////////////////////////////// + + interface IComponentOptions { + bindings?: Object; + controller?: string | Function; + controllerAs?: string; + isolate?: boolean; + template?: string | IComponentTemplateFn; + templateUrl?: string | IComponentTemplateFn; + transclude?: boolean; + restrict?: string; + $canActivate?: Function; + $routeConfig?: Object; + } + + interface IComponentTemplateFn { + ( $element?: IAugmentedJQuery, $attrs?: IAttributes ): string; + } + /////////////////////////////////////////////////////////////////////////// // Directive // see http://docs.angularjs.org/api/ng.$compileProvider#directive diff --git a/api-error-handler/api-error-handler-tests.ts b/api-error-handler/api-error-handler-tests.ts index 83df91e86..fc92cf9a7 100644 --- a/api-error-handler/api-error-handler-tests.ts +++ b/api-error-handler/api-error-handler-tests.ts @@ -1,7 +1,7 @@ /// -import errorHandler = require('api-error-handler'); -import express = require('express'); +import * as errorHandler from 'api-error-handler'; +import * as express from 'express'; var api = express.Router(); api.get('/users/:userid', function (req, res, next) { @@ -9,3 +9,5 @@ api.get('/users/:userid', function (req, res, next) { }); api.use(errorHandler()); + +let res: errorHandler.Response; diff --git a/api-error-handler/api-error-handler.d.ts b/api-error-handler/api-error-handler.d.ts index 61a63825d..90318acd0 100644 --- a/api-error-handler/api-error-handler.d.ts +++ b/api-error-handler/api-error-handler.d.ts @@ -6,7 +6,23 @@ /// declare module 'api-error-handler' { - import express = require('express'); + import * as express from 'express'; + + namespace apiErrorHandler { + + // Body response: the JSON returned by api-error-handler + // See https://github.com/expressjs/api-error-handler/blob/1.0.0/index.js + interface Response { + status: number; + stack?: string; + message: string; + + // Client errors + code?: any; + name?: string; + type?: any; + } + } function apiErrorHandler(options?: any): express.ErrorRequestHandler; diff --git a/applicationinsights/applicationinsights-tests.ts b/applicationinsights/applicationinsights-tests.ts index 8d4d83e9d..eb9d5e701 100644 --- a/applicationinsights/applicationinsights-tests.ts +++ b/applicationinsights/applicationinsights-tests.ts @@ -1,5 +1,5 @@ /// -import appInsights = require("applicationinsights"); +import * as appInsights from "applicationinsights"; // basic use appInsights.setup("").start(); @@ -24,3 +24,8 @@ appInsights.client.trackDependency("dependency name", "commandName", 500, true); appInsights.client.commonProperties = { environment: "dev" }; + +// send any pending data and log the response +appInsights.client.sendPendingData(function (response) { + console.log(response); +}); diff --git a/applicationinsights/applicationinsights.d.ts b/applicationinsights/applicationinsights.d.ts index 9fc6f494d..d5c895466 100644 --- a/applicationinsights/applicationinsights.d.ts +++ b/applicationinsights/applicationinsights.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Application Insights v0.15.7 +// Type definitions for Application Insights v0.15.8 // Project: https://github.com/Microsoft/ApplicationInsights-node.js // Definitions by: Scott Southwood // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -358,7 +358,7 @@ interface Client { /** * Immediately send all queued telemetry. */ - sendPendingData(): void; + sendPendingData(callback?: (response: string) => void): void; getEnvelope(data: ContractsModule.Data, tagOverrides?: { [key: string]: string; }): ContractsModule.Envelope; @@ -409,66 +409,58 @@ interface Sender { * The singleton meta interface for the default client of the client. This interface is used to setup/start and configure * the auto-collection behavior of the application insights module. */ -declare class ApplicationInsights { - static client: Client; - private static _isConsole; - private static _isExceptions; - private static _isPerformance; - private static _isRequests; - private static _console; - private static _exceptions; - private static _performance; - private static _requests; - private static _isStarted; +interface ApplicationInsights { + client: Client; /** * Initializes a client with the given instrumentation key, if this is not specified, the value will be * read from the environment variable APPINSIGHTS_INSTRUMENTATIONKEY * @returns {ApplicationInsights/Client} a new client */ - static getClient(instrumentationKey?: string): Client; + getClient(instrumentationKey?: string): Client; /** * Initializes the default client of the client and sets the default configuration * @param instrumentationKey the instrumentation key to use. Optional, if this is not specified, the value will be * read from the environment variable APPINSIGHTS_INSTRUMENTATIONKEY * @returns {ApplicationInsights} this interface */ - static setup(instrumentationKey?: string): typeof ApplicationInsights; + setup(instrumentationKey?: string): ApplicationInsights; /** * Starts automatic collection of telemetry. Prior to calling start no telemetry will be collected * @returns {ApplicationInsights} this interface */ - static start(): typeof ApplicationInsights; + start(): ApplicationInsights; /** * Sets the state of console tracking (enabled by default) * @param value if true console activity will be sent to Application Insights * @returns {ApplicationInsights} this interface */ - static setAutoCollectConsole(value: boolean): typeof ApplicationInsights; + setAutoCollectConsole(value: boolean): ApplicationInsights; /** * Sets the state of exception tracking (enabled by default) * @param value if true uncaught exceptions will be sent to Application Insights * @returns {ApplicationInsights} this interface */ - static setAutoCollectExceptions(value: boolean): typeof ApplicationInsights; + setAutoCollectExceptions(value: boolean): ApplicationInsights; /** * Sets the state of performance tracking (enabled by default) * @param value if true performance counters will be collected every second and sent to Application Insights * @returns {ApplicationInsights} this interface */ - static setAutoCollectPerformance(value: boolean): typeof ApplicationInsights; + setAutoCollectPerformance(value: boolean): ApplicationInsights; /** * Sets the state of request tracking (enabled by default) * @param value if true requests will be sent to Application Insights * @returns {ApplicationInsights} this interface */ - static setAutoCollectRequests(value: boolean): typeof ApplicationInsights; + setAutoCollectRequests(value: boolean): ApplicationInsights; /** * Enables verbose debug logging * @returns {ApplicationInsights} this interface */ - static enableVerboseLogging(): typeof ApplicationInsights; + enableVerboseLogging(): ApplicationInsights; } declare module "applicationinsights" { - export = ApplicationInsights; + const applicationinsights: ApplicationInsights; + export = applicationinsights; } \ No newline at end of file diff --git a/auth0/auth0.d.ts b/auth0/auth0.d.ts index b2e1149fb..1548bd06f 100644 --- a/auth0/auth0.d.ts +++ b/auth0/auth0.d.ts @@ -51,6 +51,8 @@ interface Auth0UserProfile { user_id: string; /** Represents one or more Identities that may be associated with the User. */ identities: Auth0Identity[]; + user_metadata?: any; + app_metadata?: any; } /** Represents an Auth0UserProfile that has a Microsoft Account as the primary identity. */ diff --git a/aws-sdk/aws-sdk-tests.ts.tscparams b/aws-sdk/aws-sdk-tests.ts.tscparams deleted file mode 100644 index 70401a77e..000000000 --- a/aws-sdk/aws-sdk-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ ---noImplicitAny --module commonjs --target es5 \ No newline at end of file diff --git a/aws-sdk/aws-sdk.d.ts b/aws-sdk/aws-sdk.d.ts index 128341729..f89059463 100644 --- a/aws-sdk/aws-sdk.d.ts +++ b/aws-sdk/aws-sdk.d.ts @@ -154,6 +154,12 @@ declare module "aws-sdk" { constructor(options?: any); } + export module DynamoDB { + export class DocumentClient { + constructor(options?: any); + } + } + export module SQS { export interface SqsOptions { diff --git a/babylonjs/babylon-tests.ts b/babylonjs/babylon-tests.ts new file mode 100644 index 000000000..142d3840f --- /dev/null +++ b/babylonjs/babylon-tests.ts @@ -0,0 +1 @@ +/// diff --git a/babylonjs/babylon.d.ts b/babylonjs/babylon.d.ts new file mode 100644 index 000000000..1cc835442 --- /dev/null +++ b/babylonjs/babylon.d.ts @@ -0,0 +1,6327 @@ +// Type definitions for BabylonJS v2.2 +// Project: http://www.babylonjs.com/ +// Definitions by: David Catuhe +// Definitions: https://github.com/borisyankov/babylonjs + + +declare module BABYLON { + class _DepthCullingState { + private _isDepthTestDirty; + private _isDepthMaskDirty; + private _isDepthFuncDirty; + private _isCullFaceDirty; + private _isCullDirty; + private _isZOffsetDirty; + private _depthTest; + private _depthMask; + private _depthFunc; + private _cull; + private _cullFace; + private _zOffset; + isDirty: boolean; + zOffset: number; + cullFace: number; + cull: boolean; + depthFunc: number; + depthMask: boolean; + depthTest: boolean; + reset(): void; + apply(gl: WebGLRenderingContext): void; + } + class _AlphaState { + private _isAlphaBlendDirty; + private _isBlendFunctionParametersDirty; + private _alphaBlend; + private _blendFunctionParameters; + isDirty: boolean; + alphaBlend: boolean; + setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void; + reset(): void; + apply(gl: WebGLRenderingContext): void; + } + class EngineCapabilities { + maxTexturesImageUnits: number; + maxTextureSize: number; + maxCubemapTextureSize: number; + maxRenderTextureSize: number; + standardDerivatives: boolean; + s3tc: any; + textureFloat: boolean; + textureAnisotropicFilterExtension: any; + maxAnisotropy: number; + instancedArrays: any; + uintIndices: boolean; + highPrecisionShaderSupported: boolean; + } + /** + * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio. + */ + class Engine { + private static _ALPHA_DISABLE; + private static _ALPHA_ADD; + private static _ALPHA_COMBINE; + private static _ALPHA_SUBTRACT; + private static _ALPHA_MULTIPLY; + private static _ALPHA_MAXIMIZED; + private static _ALPHA_ONEONE; + private static _DELAYLOADSTATE_NONE; + private static _DELAYLOADSTATE_LOADED; + private static _DELAYLOADSTATE_LOADING; + private static _DELAYLOADSTATE_NOTLOADED; + private static _TEXTUREFORMAT_ALPHA; + private static _TEXTUREFORMAT_LUMINANCE; + private static _TEXTUREFORMAT_LUMINANCE_ALPHA; + private static _TEXTUREFORMAT_RGB; + private static _TEXTUREFORMAT_RGBA; + private static _TEXTURETYPE_UNSIGNED_INT; + private static _TEXTURETYPE_FLOAT; + static ALPHA_DISABLE: number; + static ALPHA_ONEONE: number; + static ALPHA_ADD: number; + static ALPHA_COMBINE: number; + static ALPHA_SUBTRACT: number; + static ALPHA_MULTIPLY: number; + static ALPHA_MAXIMIZED: number; + static DELAYLOADSTATE_NONE: number; + static DELAYLOADSTATE_LOADED: number; + static DELAYLOADSTATE_LOADING: number; + static DELAYLOADSTATE_NOTLOADED: number; + static TEXTUREFORMAT_ALPHA: number; + static TEXTUREFORMAT_LUMINANCE: number; + static TEXTUREFORMAT_LUMINANCE_ALPHA: number; + static TEXTUREFORMAT_RGB: number; + static TEXTUREFORMAT_RGBA: number; + static TEXTURETYPE_UNSIGNED_INT: number; + static TEXTURETYPE_FLOAT: number; + static Version: string; + static Epsilon: number; + static CollisionsEpsilon: number; + static CodeRepository: string; + static ShadersRepository: string; + isFullscreen: boolean; + isPointerLock: boolean; + cullBackFaces: boolean; + renderEvenInBackground: boolean; + enableOfflineSupport: boolean; + scenes: Scene[]; + _gl: WebGLRenderingContext; + private _renderingCanvas; + private _windowIsBackground; + static audioEngine: AudioEngine; + private _onBlur; + private _onFocus; + private _onFullscreenChange; + private _onPointerLockChange; + private _hardwareScalingLevel; + private _caps; + private _pointerLockRequested; + private _alphaTest; + private _resizeLoadingUI; + private _loadingDiv; + private _loadingTextDiv; + private _loadingDivBackgroundColor; + private _drawCalls; + private _glVersion; + private _glRenderer; + private _glVendor; + private _videoTextureSupported; + private _renderingQueueLaunched; + private _activeRenderLoops; + private fpsRange; + private previousFramesDuration; + private fps; + private deltaTime; + private _depthCullingState; + private _alphaState; + private _alphaMode; + private _loadedTexturesCache; + _activeTexturesCache: BaseTexture[]; + private _currentEffect; + private _compiledEffects; + private _vertexAttribArrays; + private _cachedViewport; + private _cachedVertexBuffers; + private _cachedIndexBuffer; + private _cachedEffectForVertexBuffers; + private _currentRenderTarget; + private _uintIndicesCurrentlySet; + private _workingCanvas; + private _workingContext; + /** + * @constructor + * @param {HTMLCanvasElement} canvas - the canvas to be used for rendering + * @param {boolean} [antialias] - enable antialias + * @param options - further options to be sent to the getContext function + */ + constructor(canvas: HTMLCanvasElement, antialias?: boolean, options?: any); + private _prepareWorkingCanvas(); + getGlInfo(): { + vendor: string; + renderer: string; + version: string; + }; + getAspectRatio(camera: Camera): number; + getRenderWidth(): number; + getRenderHeight(): number; + getRenderingCanvas(): HTMLCanvasElement; + getRenderingCanvasClientRect(): ClientRect; + setHardwareScalingLevel(level: number): void; + getHardwareScalingLevel(): number; + getLoadedTexturesCache(): WebGLTexture[]; + getCaps(): EngineCapabilities; + drawCalls: number; + resetDrawCalls(): void; + setDepthFunctionToGreater(): void; + setDepthFunctionToGreaterOrEqual(): void; + setDepthFunctionToLess(): void; + setDepthFunctionToLessOrEqual(): void; + /** + * stop executing a render loop function and remove it from the execution array + * @param {Function} [renderFunction] the function to be removed. If not provided all functions will be removed. + */ + stopRenderLoop(renderFunction?: () => void): void; + _renderLoop(): void; + /** + * Register and execute a render loop. The engine can have more than one render function. + * @param {Function} renderFunction - the function to continuesly execute starting the next render loop. + * @example + * engine.runRenderLoop(function () { + * scene.render() + * }) + */ + runRenderLoop(renderFunction: () => void): void; + /** + * Toggle full screen mode. + * @param {boolean} requestPointerLock - should a pointer lock be requested from the user + */ + switchFullscreen(requestPointerLock: boolean): void; + clear(color: any, backBuffer: boolean, depthStencil: boolean): void; + /** + * Set the WebGL's viewport + * @param {BABYLON.Viewport} viewport - the viewport element to be used. + * @param {number} [requiredWidth] - the width required for rendering. If not provided the rendering canvas' width is used. + * @param {number} [requiredHeight] - the height required for rendering. If not provided the rendering canvas' height is used. + */ + setViewport(viewport: Viewport, requiredWidth?: number, requiredHeight?: number): void; + setDirectViewport(x: number, y: number, width: number, height: number): void; + beginFrame(): void; + endFrame(): void; + /** + * resize the view according to the canvas' size. + * @example + * window.addEventListener("resize", function () { + * engine.resize(); + * }); + */ + resize(): void; + /** + * force a specific size of the canvas + * @param {number} width - the new canvas' width + * @param {number} height - the new canvas' height + */ + setSize(width: number, height: number): void; + bindFramebuffer(texture: WebGLTexture): void; + unBindFramebuffer(texture: WebGLTexture): void; + flushFramebuffer(): void; + restoreDefaultFramebuffer(): void; + private _resetVertexBufferBinding(); + createVertexBuffer(vertices: number[]): WebGLBuffer; + createDynamicVertexBuffer(capacity: number): WebGLBuffer; + updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: any, offset?: number): void; + private _resetIndexBufferBinding(); + createIndexBuffer(indices: number[]): WebGLBuffer; + bindBuffers(vertexBuffer: WebGLBuffer, indexBuffer: WebGLBuffer, vertexDeclaration: number[], vertexStrideSize: number, effect: Effect): void; + bindMultiBuffers(vertexBuffers: VertexBuffer[], indexBuffer: WebGLBuffer, effect: Effect): void; + _releaseBuffer(buffer: WebGLBuffer): boolean; + createInstancesBuffer(capacity: number): WebGLBuffer; + deleteInstancesBuffer(buffer: WebGLBuffer): void; + updateAndBindInstancesBuffer(instancesBuffer: WebGLBuffer, data: Float32Array, offsetLocations: number[]): void; + unBindInstancesBuffer(instancesBuffer: WebGLBuffer, offsetLocations: number[]): void; + applyStates(): void; + draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void; + drawPointClouds(verticesStart: number, verticesCount: number, instancesCount?: number): void; + _releaseEffect(effect: Effect): void; + createEffect(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], defines: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect; + createEffectForParticles(fragmentName: string, uniformsNames?: string[], samplers?: string[], defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void): Effect; + createShaderProgram(vertexCode: string, fragmentCode: string, defines: string): WebGLProgram; + getUniforms(shaderProgram: WebGLProgram, uniformsNames: string[]): WebGLUniformLocation[]; + getAttributes(shaderProgram: WebGLProgram, attributesNames: string[]): number[]; + enableEffect(effect: Effect): void; + setArray(uniform: WebGLUniformLocation, array: number[]): void; + setArray2(uniform: WebGLUniformLocation, array: number[]): void; + setArray3(uniform: WebGLUniformLocation, array: number[]): void; + setArray4(uniform: WebGLUniformLocation, array: number[]): void; + setMatrices(uniform: WebGLUniformLocation, matrices: Float32Array): void; + setMatrix(uniform: WebGLUniformLocation, matrix: Matrix): void; + setMatrix3x3(uniform: WebGLUniformLocation, matrix: Float32Array): void; + setMatrix2x2(uniform: WebGLUniformLocation, matrix: Float32Array): void; + setFloat(uniform: WebGLUniformLocation, value: number): void; + setFloat2(uniform: WebGLUniformLocation, x: number, y: number): void; + setFloat3(uniform: WebGLUniformLocation, x: number, y: number, z: number): void; + setBool(uniform: WebGLUniformLocation, bool: number): void; + setFloat4(uniform: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; + setColor3(uniform: WebGLUniformLocation, color3: Color3): void; + setColor4(uniform: WebGLUniformLocation, color3: Color3, alpha: number): void; + setState(culling: boolean, zOffset?: number, force?: boolean): void; + setDepthBuffer(enable: boolean): void; + getDepthWrite(): boolean; + setDepthWrite(enable: boolean): void; + setColorWrite(enable: boolean): void; + setAlphaMode(mode: number): void; + getAlphaMode(): number; + setAlphaTesting(enable: boolean): void; + getAlphaTesting(): boolean; + wipeCaches(): void; + setSamplingMode(texture: WebGLTexture, samplingMode: number): void; + createTexture(url: string, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any): WebGLTexture; + updateRawTexture(texture: WebGLTexture, data: ArrayBufferView, format: number, invertY: boolean, compression?: string): void; + createRawTexture(data: ArrayBufferView, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression?: string): WebGLTexture; + createDynamicTexture(width: number, height: number, generateMipMaps: boolean, samplingMode: number, forceExponantOfTwo?: boolean): WebGLTexture; + updateTextureSamplingMode(samplingMode: number, texture: WebGLTexture): void; + updateDynamicTexture(texture: WebGLTexture, canvas: HTMLCanvasElement, invertY: boolean): void; + updateVideoTexture(texture: WebGLTexture, video: HTMLVideoElement, invertY: boolean): void; + createRenderTargetTexture(size: any, options: any): WebGLTexture; + createCubeTexture(rootUrl: string, scene: Scene, extensions: string[], noMipmap?: boolean): WebGLTexture; + _releaseTexture(texture: WebGLTexture): void; + bindSamplers(effect: Effect): void; + _bindTexture(channel: number, texture: WebGLTexture): void; + setTextureFromPostProcess(channel: number, postProcess: PostProcess): void; + setTexture(channel: number, texture: BaseTexture): void; + _setAnisotropicLevel(key: number, texture: BaseTexture): void; + readPixels(x: number, y: number, width: number, height: number): Uint8Array; + dispose(): void; + displayLoadingUI(): void; + loadingUIText: string; + loadingUIBackgroundColor: string; + hideLoadingUI(): void; + getFps(): number; + getDeltaTime(): number; + private _measureFps(); + static isSupported(): boolean; + } +} + +interface Window { + mozIndexedDB(func: any): any; + webkitIndexedDB(func: any): any; + IDBTransaction(func: any): any; + webkitIDBTransaction(func: any): any; + msIDBTransaction(func: any): any; + IDBKeyRange(func: any): any; + webkitIDBKeyRange(func: any): any; + msIDBKeyRange(func: any): any; + webkitURL: HTMLURL; + webkitRequestAnimationFrame(func: any): any; + mozRequestAnimationFrame(func: any): any; + oRequestAnimationFrame(func: any): any; + WebGLRenderingContext: WebGLRenderingContext; + MSGesture: MSGesture; + CANNON: any; + SIMD: any; + AudioContext: AudioContext; + webkitAudioContext: AudioContext; +} +interface HTMLURL { + createObjectURL(param1: any, param2?: any): any; +} +interface Document { + exitFullscreen(): void; + webkitCancelFullScreen(): void; + mozCancelFullScreen(): void; + msCancelFullScreen(): void; + mozFullScreen: boolean; + msIsFullScreen: boolean; + fullscreen: boolean; + mozPointerLockElement: HTMLElement; + msPointerLockElement: HTMLElement; + webkitPointerLockElement: HTMLElement; +} +interface HTMLCanvasElement { + requestPointerLock(): void; + msRequestPointerLock(): void; + mozRequestPointerLock(): void; + webkitRequestPointerLock(): void; +} +interface CanvasRenderingContext2D { + imageSmoothingEnabled: boolean; + mozImageSmoothingEnabled: boolean; + oImageSmoothingEnabled: boolean; + webkitImageSmoothingEnabled: boolean; +} +interface WebGLTexture { + isReady: boolean; + isCube: boolean; + url: string; + noMipmap: boolean; + samplingMode: number; + references: number; + generateMipMaps: boolean; + _size: number; + _baseWidth: number; + _baseHeight: number; + _width: number; + _height: number; + _workingCanvas: HTMLCanvasElement; + _workingContext: CanvasRenderingContext2D; + _framebuffer: WebGLFramebuffer; + _depthBuffer: WebGLRenderbuffer; + _cachedCoordinatesMode: number; + _cachedWrapU: number; + _cachedWrapV: number; + _isDisabled: boolean; +} +interface WebGLBuffer { + references: number; + capacity: number; + is32Bits: boolean; +} +interface MouseEvent { + mozMovementX: number; + mozMovementY: number; + webkitMovementX: number; + webkitMovementY: number; + msMovementX: number; + msMovementY: number; +} +interface MSStyleCSSProperties { + webkitTransform: string; + webkitTransition: string; +} +interface Navigator { + getVRDevices: () => any; + mozGetVRDevices: (any: any) => any; + isCocoonJS: boolean; +} +interface Screen { + orientation: string; + mozOrientation: string; +} + +declare module BABYLON { + /** + * Node is the basic class for all scene objects (Mesh, Light Camera). + */ + class Node { + parent: Node; + name: string; + id: string; + uniqueId: number; + state: string; + animations: Animation[]; + onReady: (node: Node) => void; + private _childrenFlag; + private _isEnabled; + private _isReady; + _currentRenderId: number; + private _parentRenderId; + _waitingParentId: string; + private _scene; + _cache: any; + /** + * @constructor + * @param {string} name - the name and id to be given to this node + * @param {BABYLON.Scene} the scene this node will be added to + */ + constructor(name: string, scene: Scene); + getScene(): Scene; + getEngine(): Engine; + getWorldMatrix(): Matrix; + _initCache(): void; + updateCache(force?: boolean): void; + _updateCache(ignoreParentClass?: boolean): void; + _isSynchronized(): boolean; + _markSyncedWithParent(): void; + isSynchronizedWithParent(): boolean; + isSynchronized(updateCache?: boolean): boolean; + hasNewParent(update?: boolean): boolean; + /** + * Is this node ready to be used/rendered + * @return {boolean} is it ready + */ + isReady(): boolean; + /** + * Is this node enabled. + * If the node has a parent and is enabled, the parent will be inspected as well. + * @return {boolean} whether this node (and its parent) is enabled. + * @see setEnabled + */ + isEnabled(): boolean; + /** + * Set the enabled state of this node. + * @param {boolean} value - the new enabled state + * @see isEnabled + */ + setEnabled(value: boolean): void; + /** + * Is this node a descendant of the given node. + * The function will iterate up the hierarchy until the ancestor was found or no more parents defined. + * @param {BABYLON.Node} ancestor - The parent node to inspect + * @see parent + */ + isDescendantOf(ancestor: Node): boolean; + _getDescendants(list: Node[], results: Node[]): void; + /** + * Will return all nodes that have this node as parent. + * @return {BABYLON.Node[]} all children nodes of all types. + */ + getDescendants(): Node[]; + _setReady(state: boolean): void; + } +} + +declare module BABYLON { + interface IDisposable { + dispose(): void; + } + /** + * Represents a scene to be rendered by the engine. + * @see http://doc.babylonjs.com/page.php?p=21911 + */ + class Scene { + private static _FOGMODE_NONE; + private static _FOGMODE_EXP; + private static _FOGMODE_EXP2; + private static _FOGMODE_LINEAR; + static MinDeltaTime: number; + static MaxDeltaTime: number; + static FOGMODE_NONE: number; + static FOGMODE_EXP: number; + static FOGMODE_EXP2: number; + static FOGMODE_LINEAR: number; + autoClear: boolean; + clearColor: any; + ambientColor: Color3; + /** + * A function to be executed before rendering this scene + * @type {Function} + */ + beforeRender: () => void; + /** + * A function to be executed after rendering this scene + * @type {Function} + */ + afterRender: () => void; + /** + * A function to be executed when this scene is disposed. + * @type {Function} + */ + onDispose: () => void; + beforeCameraRender: (camera: Camera) => void; + afterCameraRender: (camera: Camera) => void; + forceWireframe: boolean; + forcePointsCloud: boolean; + forceShowBoundingBoxes: boolean; + clipPlane: Plane; + animationsEnabled: boolean; + private _onPointerMove; + private _onPointerDown; + private _onPointerUp; + onPointerDown: (evt: PointerEvent, pickInfo: PickingInfo) => void; + onPointerUp: (evt: PointerEvent, pickInfo: PickingInfo) => void; + cameraToUseForPointers: Camera; + private _pointerX; + private _pointerY; + private _meshUnderPointer; + private _onKeyDown; + private _onKeyUp; + /** + * is fog enabled on this scene. + * @type {boolean} + */ + fogEnabled: boolean; + fogMode: number; + fogColor: Color3; + fogDensity: number; + fogStart: number; + fogEnd: number; + /** + * is shadow enabled on this scene. + * @type {boolean} + */ + shadowsEnabled: boolean; + /** + * is light enabled on this scene. + * @type {boolean} + */ + lightsEnabled: boolean; + /** + * All of the lights added to this scene. + * @see BABYLON.Light + * @type {BABYLON.Light[]} + */ + lights: Light[]; + onNewLightAdded: (newLight?: Light, positionInArray?: number, scene?: Scene) => void; + onLightRemoved: (removedLight?: Light) => void; + /** + * All of the cameras added to this scene. + * @see BABYLON.Camera + * @type {BABYLON.Camera[]} + */ + cameras: Camera[]; + onNewCameraAdded: (newCamera?: Camera, positionInArray?: number, scene?: Scene) => void; + onCameraRemoved: (removedCamera?: Camera) => void; + activeCameras: Camera[]; + activeCamera: Camera; + /** + * All of the (abstract) meshes added to this scene. + * @see BABYLON.AbstractMesh + * @type {BABYLON.AbstractMesh[]} + */ + meshes: AbstractMesh[]; + onNewMeshAdded: (newMesh?: AbstractMesh, positionInArray?: number, scene?: Scene) => void; + onMeshRemoved: (removedMesh?: AbstractMesh) => void; + private _geometries; + onGeometryAdded: (newGeometry?: Geometry) => void; + onGeometryRemoved: (removedGeometry?: Geometry) => void; + materials: Material[]; + multiMaterials: MultiMaterial[]; + defaultMaterial: StandardMaterial; + texturesEnabled: boolean; + textures: BaseTexture[]; + particlesEnabled: boolean; + particleSystems: ParticleSystem[]; + spritesEnabled: boolean; + spriteManagers: SpriteManager[]; + layers: Layer[]; + skeletonsEnabled: boolean; + skeletons: Skeleton[]; + lensFlaresEnabled: boolean; + lensFlareSystems: LensFlareSystem[]; + collisionsEnabled: boolean; + private _workerCollisions; + collisionCoordinator: ICollisionCoordinator; + gravity: Vector3; + postProcessesEnabled: boolean; + postProcessManager: PostProcessManager; + postProcessRenderPipelineManager: PostProcessRenderPipelineManager; + renderTargetsEnabled: boolean; + dumpNextRenderTargets: boolean; + customRenderTargets: RenderTargetTexture[]; + useDelayedTextureLoading: boolean; + importedMeshesFiles: String[]; + database: any; + /** + * This scene's action manager + * @type {BABYLON.ActionManager} + */ + actionManager: ActionManager; + _actionManagers: ActionManager[]; + private _meshesForIntersections; + proceduralTexturesEnabled: boolean; + _proceduralTextures: ProceduralTexture[]; + mainSoundTrack: SoundTrack; + soundTracks: SoundTrack[]; + private _audioEnabled; + private _headphone; + simplificationQueue: SimplificationQueue; + private _engine; + private _totalVertices; + _activeIndices: number; + _activeParticles: number; + private _lastFrameDuration; + private _evaluateActiveMeshesDuration; + private _renderTargetsDuration; + _particlesDuration: number; + private _renderDuration; + _spritesDuration: number; + private _animationRatio; + private _animationStartDate; + _cachedMaterial: Material; + private _renderId; + private _executeWhenReadyTimeoutId; + _toBeDisposed: SmartArray; + private _onReadyCallbacks; + private _pendingData; + private _onBeforeRenderCallbacks; + private _onAfterRenderCallbacks; + private _activeMeshes; + private _processedMaterials; + private _renderTargets; + _activeParticleSystems: SmartArray; + private _activeSkeletons; + private _softwareSkinnedMeshes; + _activeBones: number; + private _renderingManager; + private _physicsEngine; + _activeAnimatables: Animatable[]; + private _transformMatrix; + private _pickWithRayInverseMatrix; + private _edgesRenderers; + private _boundingBoxRenderer; + private _outlineRenderer; + private _viewMatrix; + private _projectionMatrix; + private _frustumPlanes; + private _selectionOctree; + private _pointerOverMesh; + private _debugLayer; + private _depthRenderer; + private _uniqueIdCounter; + /** + * @constructor + * @param {BABYLON.Engine} engine - the engine to be used to render this scene. + */ + constructor(engine: Engine); + debugLayer: DebugLayer; + workerCollisions: boolean; + SelectionOctree: Octree; + /** + * The mesh that is currently under the pointer. + * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none. + */ + meshUnderPointer: AbstractMesh; + /** + * Current on-screen X position of the pointer + * @return {number} X position of the pointer + */ + pointerX: number; + /** + * Current on-screen Y position of the pointer + * @return {number} Y position of the pointer + */ + pointerY: number; + getCachedMaterial(): Material; + getBoundingBoxRenderer(): BoundingBoxRenderer; + getOutlineRenderer(): OutlineRenderer; + getEngine(): Engine; + getTotalVertices(): number; + getActiveIndices(): number; + getActiveParticles(): number; + getActiveBones(): number; + getLastFrameDuration(): number; + getEvaluateActiveMeshesDuration(): number; + getActiveMeshes(): SmartArray; + getRenderTargetsDuration(): number; + getRenderDuration(): number; + getParticlesDuration(): number; + getSpritesDuration(): number; + getAnimationRatio(): number; + getRenderId(): number; + incrementRenderId(): void; + private _updatePointerPosition(evt); + attachControl(): void; + detachControl(): void; + isReady(): boolean; + resetCachedMaterial(): void; + registerBeforeRender(func: () => void): void; + unregisterBeforeRender(func: () => void): void; + registerAfterRender(func: () => void): void; + unregisterAfterRender(func: () => void): void; + _addPendingData(data: any): void; + _removePendingData(data: any): void; + getWaitingItemsCount(): number; + /** + * Registers a function to be executed when the scene is ready. + * @param {Function} func - the function to be executed. + */ + executeWhenReady(func: () => void): void; + _checkIsReady(): void; + /** + * Will start the animation sequence of a given target + * @param target - the target + * @param {number} from - from which frame should animation start + * @param {number} to - till which frame should animation run. + * @param {boolean} [loop] - should the animation loop + * @param {number} [speedRatio] - the speed in which to run the animation + * @param {Function} [onAnimationEnd] function to be executed when the animation ended. + * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params. + * @return {BABYLON.Animatable} the animatable object created for this animation + * @see BABYLON.Animatable + * @see http://doc.babylonjs.com/page.php?p=22081 + */ + beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable; + beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable; + getAnimatableByTarget(target: any): Animatable; + /** + * Will stop the animation of the given target + * @param target - the target + * @see beginAnimation + */ + stopAnimation(target: any): void; + private _animate(); + getViewMatrix(): Matrix; + getProjectionMatrix(): Matrix; + getTransformMatrix(): Matrix; + setTransformMatrix(view: Matrix, projection: Matrix): void; + addMesh(newMesh: AbstractMesh): void; + removeMesh(toRemove: AbstractMesh): number; + removeLight(toRemove: Light): number; + removeCamera(toRemove: Camera): number; + addLight(newLight: Light): void; + addCamera(newCamera: Camera): void; + /** + * sets the active camera of the scene using its ID + * @param {string} id - the camera's ID + * @return {BABYLON.Camera|null} the new active camera or null if none found. + * @see activeCamera + */ + setActiveCameraByID(id: string): Camera; + /** + * sets the active camera of the scene using its name + * @param {string} name - the camera's name + * @return {BABYLON.Camera|null} the new active camera or null if none found. + * @see activeCamera + */ + setActiveCameraByName(name: string): Camera; + /** + * get a material using its id + * @param {string} the material's ID + * @return {BABYLON.Material|null} the material or null if none found. + */ + getMaterialByID(id: string): Material; + /** + * get a material using its name + * @param {string} the material's name + * @return {BABYLON.Material|null} the material or null if none found. + */ + getMaterialByName(name: string): Material; + getLensFlareSystemByName(name: string): LensFlareSystem; + getCameraByID(id: string): Camera; + getCameraByUniqueID(uniqueId: number): Camera; + /** + * get a camera using its name + * @param {string} the camera's name + * @return {BABYLON.Camera|null} the camera or null if none found. + */ + getCameraByName(name: string): Camera; + /** + * get a light node using its name + * @param {string} the light's name + * @return {BABYLON.Light|null} the light or null if none found. + */ + getLightByName(name: string): Light; + /** + * get a light node using its ID + * @param {string} the light's id + * @return {BABYLON.Light|null} the light or null if none found. + */ + getLightByID(id: string): Light; + /** + * get a light node using its scene-generated unique ID + * @param {number} the light's unique id + * @return {BABYLON.Light|null} the light or null if none found. + */ + getLightByUniqueID(uniqueId: number): Light; + /** + * get a geometry using its ID + * @param {string} the geometry's id + * @return {BABYLON.Geometry|null} the geometry or null if none found. + */ + getGeometryByID(id: string): Geometry; + /** + * add a new geometry to this scene. + * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene. + * @param {boolean} [force] - force addition, even if a geometry with this ID already exists + * @return {boolean} was the geometry added or not + */ + pushGeometry(geometry: Geometry, force?: boolean): boolean; + /** + * Removes an existing geometry + * @param {BABYLON.Geometry} geometry - the geometry to be removed from the scene. + * @return {boolean} was the geometry removed or not + */ + removeGeometry(geometry: Geometry): boolean; + getGeometries(): Geometry[]; + /** + * Get the first added mesh found of a given ID + * @param {string} id - the id to search for + * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. + */ + getMeshByID(id: string): AbstractMesh; + /** + * Get a mesh with its auto-generated unique id + * @param {number} uniqueId - the unique id to search for + * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. + */ + getMeshByUniqueID(uniqueId: number): AbstractMesh; + /** + * Get a the last added mesh found of a given ID + * @param {string} id - the id to search for + * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all. + */ + getLastMeshByID(id: string): AbstractMesh; + /** + * Get a the last added node (Mesh, Camera, Light) found of a given ID + * @param {string} id - the id to search for + * @return {BABYLON.Node|null} the node found or null if not found at all. + */ + getLastEntryByID(id: string): Node; + getNodeByID(id: string): Node; + getNodeByName(name: string): Node; + getMeshByName(name: string): AbstractMesh; + getSoundByName(name: string): Sound; + getLastSkeletonByID(id: string): Skeleton; + getSkeletonById(id: string): Skeleton; + getSkeletonByName(name: string): Skeleton; + isActiveMesh(mesh: Mesh): boolean; + private _evaluateSubMesh(subMesh, mesh); + private _evaluateActiveMeshes(); + private _activeMesh(mesh); + updateTransformMatrix(force?: boolean): void; + private _renderForCamera(camera); + private _processSubCameras(camera); + private _checkIntersections(); + render(): void; + private _updateAudioParameters(); + audioEnabled: boolean; + private _disableAudio(); + private _enableAudio(); + headphone: boolean; + private _switchAudioModeForHeadphones(); + private _switchAudioModeForNormalSpeakers(); + enableDepthRenderer(): DepthRenderer; + disableDepthRenderer(): void; + dispose(): void; + disposeSounds(): void; + getWorldExtends(): { + min: Vector3; + max: Vector3; + }; + createOrUpdateSelectionOctree(maxCapacity?: number, maxDepth?: number): Octree; + createPickingRay(x: number, y: number, world: Matrix, camera: Camera): Ray; + private _internalPick(rayFunction, predicate, fastCheck?); + pick(x: number, y: number, predicate?: (mesh: AbstractMesh) => boolean, fastCheck?: boolean, camera?: Camera): PickingInfo; + pickWithRay(ray: Ray, predicate: (mesh: Mesh) => boolean, fastCheck?: boolean): PickingInfo; + setPointerOverMesh(mesh: AbstractMesh): void; + getPointerOverMesh(): AbstractMesh; + getPhysicsEngine(): PhysicsEngine; + enablePhysics(gravity: Vector3, plugin?: IPhysicsEnginePlugin): boolean; + disablePhysicsEngine(): void; + isPhysicsEnabled(): boolean; + setGravity(gravity: Vector3): void; + createCompoundImpostor(parts: any, options: PhysicsBodyCreationOptions): any; + deleteCompoundImpostor(compound: any): void; + createDefaultCameraOrLight(): void; + private _getByTags(list, tagsQuery, forEach?); + getMeshesByTags(tagsQuery: string, forEach?: (mesh: AbstractMesh) => void): Mesh[]; + getCamerasByTags(tagsQuery: string, forEach?: (camera: Camera) => void): Camera[]; + getLightsByTags(tagsQuery: string, forEach?: (light: Light) => void): Light[]; + getMaterialByTags(tagsQuery: string, forEach?: (material: Material) => void): Material[]; + } +} + +declare module BABYLON { + class Action { + triggerOptions: any; + trigger: number; + _actionManager: ActionManager; + private _nextActiveAction; + private _child; + private _condition; + private _triggerParameter; + constructor(triggerOptions: any, condition?: Condition); + _prepare(): void; + getTriggerParameter(): any; + _executeCurrent(evt: ActionEvent): void; + execute(evt: ActionEvent): void; + then(action: Action): Action; + _getProperty(propertyPath: string): string; + _getEffectiveTarget(target: any, propertyPath: string): any; + } +} + +declare module BABYLON { + /** + * ActionEvent is the event beint sent when an action is triggered. + */ + class ActionEvent { + source: AbstractMesh; + pointerX: number; + pointerY: number; + meshUnderPointer: AbstractMesh; + sourceEvent: any; + additionalData: any; + /** + * @constructor + * @param source The mesh that triggered the action. + * @param pointerX the X mouse cursor position at the time of the event + * @param pointerY the Y mouse cursor position at the time of the event + * @param meshUnderPointer The mesh that is currently pointed at (can be null) + * @param sourceEvent the original (browser) event that triggered the ActionEvent + */ + constructor(source: AbstractMesh, pointerX: number, pointerY: number, meshUnderPointer: AbstractMesh, sourceEvent?: any, additionalData?: any); + /** + * Helper function to auto-create an ActionEvent from a source mesh. + * @param source the source mesh that triggered the event + * @param evt {Event} The original (browser) event + */ + static CreateNew(source: AbstractMesh, evt?: Event, additionalData?: any): ActionEvent; + /** + * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew + * @param scene the scene where the event occurred + * @param evt {Event} The original (browser) event + */ + static CreateNewFromScene(scene: Scene, evt: Event): ActionEvent; + } + /** + * Action Manager manages all events to be triggered on a given mesh or the global scene. + * A single scene can have many Action Managers to handle predefined actions on specific meshes. + */ + class ActionManager { + private static _NothingTrigger; + private static _OnPickTrigger; + private static _OnLeftPickTrigger; + private static _OnRightPickTrigger; + private static _OnCenterPickTrigger; + private static _OnPointerOverTrigger; + private static _OnPointerOutTrigger; + private static _OnEveryFrameTrigger; + private static _OnIntersectionEnterTrigger; + private static _OnIntersectionExitTrigger; + private static _OnKeyDownTrigger; + private static _OnKeyUpTrigger; + private static _OnPickUpTrigger; + static NothingTrigger: number; + static OnPickTrigger: number; + static OnLeftPickTrigger: number; + static OnRightPickTrigger: number; + static OnCenterPickTrigger: number; + static OnPointerOverTrigger: number; + static OnPointerOutTrigger: number; + static OnEveryFrameTrigger: number; + static OnIntersectionEnterTrigger: number; + static OnIntersectionExitTrigger: number; + static OnKeyDownTrigger: number; + static OnKeyUpTrigger: number; + static OnPickUpTrigger: number; + actions: Action[]; + private _scene; + constructor(scene: Scene); + dispose(): void; + getScene(): Scene; + /** + * Does this action manager handles actions of any of the given triggers + * @param {number[]} triggers - the triggers to be tested + * @return {boolean} whether one (or more) of the triggers is handeled + */ + hasSpecificTriggers(triggers: number[]): boolean; + /** + * Does this action manager handles actions of a given trigger + * @param {number} trigger - the trigger to be tested + * @return {boolean} whether the trigger is handeled + */ + hasSpecificTrigger(trigger: number): boolean; + /** + * Does this action manager has pointer triggers + * @return {boolean} whether or not it has pointer triggers + */ + hasPointerTriggers: boolean; + /** + * Does this action manager has pick triggers + * @return {boolean} whether or not it has pick triggers + */ + hasPickTriggers: boolean; + /** + * Registers an action to this action manager + * @param {BABYLON.Action} action - the action to be registered + * @return {BABYLON.Action} the action amended (prepared) after registration + */ + registerAction(action: Action): Action; + /** + * Process a specific trigger + * @param {number} trigger - the trigger to process + * @param evt {BABYLON.ActionEvent} the event details to be processed + */ + processTrigger(trigger: number, evt: ActionEvent): void; + _getEffectiveTarget(target: any, propertyPath: string): any; + _getProperty(propertyPath: string): string; + } +} + +declare module BABYLON { + class Condition { + _actionManager: ActionManager; + _evaluationId: number; + _currentResult: boolean; + constructor(actionManager: ActionManager); + isValid(): boolean; + _getProperty(propertyPath: string): string; + _getEffectiveTarget(target: any, propertyPath: string): any; + } + class ValueCondition extends Condition { + propertyPath: string; + value: any; + operator: number; + private static _IsEqual; + private static _IsDifferent; + private static _IsGreater; + private static _IsLesser; + static IsEqual: number; + static IsDifferent: number; + static IsGreater: number; + static IsLesser: number; + _actionManager: ActionManager; + private _target; + private _property; + constructor(actionManager: ActionManager, target: any, propertyPath: string, value: any, operator?: number); + isValid(): boolean; + } + class PredicateCondition extends Condition { + predicate: () => boolean; + _actionManager: ActionManager; + constructor(actionManager: ActionManager, predicate: () => boolean); + isValid(): boolean; + } + class StateCondition extends Condition { + value: string; + _actionManager: ActionManager; + private _target; + constructor(actionManager: ActionManager, target: any, value: string); + isValid(): boolean; + } +} + +declare module BABYLON { + class SwitchBooleanAction extends Action { + propertyPath: string; + private _target; + private _property; + constructor(triggerOptions: any, target: any, propertyPath: string, condition?: Condition); + _prepare(): void; + execute(): void; + } + class SetStateAction extends Action { + value: string; + private _target; + constructor(triggerOptions: any, target: any, value: string, condition?: Condition); + execute(): void; + } + class SetValueAction extends Action { + propertyPath: string; + value: any; + private _target; + private _property; + constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition); + _prepare(): void; + execute(): void; + } + class IncrementValueAction extends Action { + propertyPath: string; + value: any; + private _target; + private _property; + constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition); + _prepare(): void; + execute(): void; + } + class PlayAnimationAction extends Action { + from: number; + to: number; + loop: boolean; + private _target; + constructor(triggerOptions: any, target: any, from: number, to: number, loop?: boolean, condition?: Condition); + _prepare(): void; + execute(): void; + } + class StopAnimationAction extends Action { + private _target; + constructor(triggerOptions: any, target: any, condition?: Condition); + _prepare(): void; + execute(): void; + } + class DoNothingAction extends Action { + constructor(triggerOptions?: any, condition?: Condition); + execute(): void; + } + class CombineAction extends Action { + children: Action[]; + constructor(triggerOptions: any, children: Action[], condition?: Condition); + _prepare(): void; + execute(evt: ActionEvent): void; + } + class ExecuteCodeAction extends Action { + func: (evt: ActionEvent) => void; + constructor(triggerOptions: any, func: (evt: ActionEvent) => void, condition?: Condition); + execute(evt: ActionEvent): void; + } + class SetParentAction extends Action { + private _parent; + private _target; + constructor(triggerOptions: any, target: any, parent: any, condition?: Condition); + _prepare(): void; + execute(): void; + } + class PlaySoundAction extends Action { + private _sound; + constructor(triggerOptions: any, sound: Sound, condition?: Condition); + _prepare(): void; + execute(): void; + } + class StopSoundAction extends Action { + private _sound; + constructor(triggerOptions: any, sound: Sound, condition?: Condition); + _prepare(): void; + execute(): void; + } +} + +declare module BABYLON { + class InterpolateValueAction extends Action { + propertyPath: string; + value: any; + duration: number; + stopOtherAnimations: boolean; + private _target; + private _property; + constructor(triggerOptions: any, target: any, propertyPath: string, value: any, duration?: number, condition?: Condition, stopOtherAnimations?: boolean); + _prepare(): void; + execute(): void; + } +} + +declare module BABYLON { + class Animatable { + target: any; + fromFrame: number; + toFrame: number; + loopAnimation: boolean; + speedRatio: number; + onAnimationEnd: any; + private _localDelayOffset; + private _pausedDelay; + private _animations; + private _paused; + private _scene; + animationStarted: boolean; + constructor(scene: Scene, target: any, fromFrame?: number, toFrame?: number, loopAnimation?: boolean, speedRatio?: number, onAnimationEnd?: any, animations?: any); + appendAnimations(target: any, animations: Animation[]): void; + getAnimationByTargetProperty(property: string): Animation; + reset(): void; + pause(): void; + restart(): void; + stop(): void; + _animate(delay: number): boolean; + } +} + +declare module BABYLON { + class Animation { + name: string; + targetProperty: string; + framePerSecond: number; + dataType: number; + loopMode: number; + private _keys; + private _offsetsCache; + private _highLimitsCache; + private _stopped; + _target: any; + private _easingFunction; + targetPropertyPath: string[]; + currentFrame: number; + allowMatricesInterpolation: boolean; + static CreateAndStartAnimation(name: string, mesh: AbstractMesh, targetProperty: string, framePerSecond: number, totalFrame: number, from: any, to: any, loopMode?: number, easingFunction?: EasingFunction): Animatable; + constructor(name: string, targetProperty: string, framePerSecond: number, dataType: number, loopMode?: number); + reset(): void; + isStopped(): boolean; + getKeys(): any[]; + getEasingFunction(): IEasingFunction; + setEasingFunction(easingFunction: EasingFunction): void; + floatInterpolateFunction(startValue: number, endValue: number, gradient: number): number; + quaternionInterpolateFunction(startValue: Quaternion, endValue: Quaternion, gradient: number): Quaternion; + vector3InterpolateFunction(startValue: Vector3, endValue: Vector3, gradient: number): Vector3; + vector2InterpolateFunction(startValue: Vector2, endValue: Vector2, gradient: number): Vector2; + color3InterpolateFunction(startValue: Color3, endValue: Color3, gradient: number): Color3; + matrixInterpolateFunction(startValue: Matrix, endValue: Matrix, gradient: number): Matrix; + clone(): Animation; + setKeys(values: Array): void; + private _getKeyValue(value); + private _interpolate(currentFrame, repeatCount, loopMode, offsetValue?, highLimitValue?); + animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number): boolean; + private static _ANIMATIONTYPE_FLOAT; + private static _ANIMATIONTYPE_VECTOR3; + private static _ANIMATIONTYPE_QUATERNION; + private static _ANIMATIONTYPE_MATRIX; + private static _ANIMATIONTYPE_COLOR3; + private static _ANIMATIONTYPE_VECTOR2; + private static _ANIMATIONLOOPMODE_RELATIVE; + private static _ANIMATIONLOOPMODE_CYCLE; + private static _ANIMATIONLOOPMODE_CONSTANT; + static ANIMATIONTYPE_FLOAT: number; + static ANIMATIONTYPE_VECTOR3: number; + static ANIMATIONTYPE_VECTOR2: number; + static ANIMATIONTYPE_QUATERNION: number; + static ANIMATIONTYPE_MATRIX: number; + static ANIMATIONTYPE_COLOR3: number; + static ANIMATIONLOOPMODE_RELATIVE: number; + static ANIMATIONLOOPMODE_CYCLE: number; + static ANIMATIONLOOPMODE_CONSTANT: number; + } +} + +declare module BABYLON { + interface IEasingFunction { + ease(gradient: number): number; + } + class EasingFunction implements IEasingFunction { + private static _EASINGMODE_EASEIN; + private static _EASINGMODE_EASEOUT; + private static _EASINGMODE_EASEINOUT; + static EASINGMODE_EASEIN: number; + static EASINGMODE_EASEOUT: number; + static EASINGMODE_EASEINOUT: number; + private _easingMode; + setEasingMode(easingMode: number): void; + getEasingMode(): number; + easeInCore(gradient: number): number; + ease(gradient: number): number; + } + class CircleEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class BackEase extends EasingFunction implements IEasingFunction { + amplitude: number; + constructor(amplitude?: number); + easeInCore(gradient: number): number; + } + class BounceEase extends EasingFunction implements IEasingFunction { + bounces: number; + bounciness: number; + constructor(bounces?: number, bounciness?: number); + easeInCore(gradient: number): number; + } + class CubicEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class ElasticEase extends EasingFunction implements IEasingFunction { + oscillations: number; + springiness: number; + constructor(oscillations?: number, springiness?: number); + easeInCore(gradient: number): number; + } + class ExponentialEase extends EasingFunction implements IEasingFunction { + exponent: number; + constructor(exponent?: number); + easeInCore(gradient: number): number; + } + class PowerEase extends EasingFunction implements IEasingFunction { + power: number; + constructor(power?: number); + easeInCore(gradient: number): number; + } + class QuadraticEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class QuarticEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class QuinticEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class SineEase extends EasingFunction implements IEasingFunction { + easeInCore(gradient: number): number; + } + class BezierCurveEase extends EasingFunction implements IEasingFunction { + x1: number; + y1: number; + x2: number; + y2: number; + constructor(x1?: number, y1?: number, x2?: number, y2?: number); + easeInCore(gradient: number): number; + } +} + +declare module BABYLON { + class Analyser { + SMOOTHING: number; + FFT_SIZE: number; + BARGRAPHAMPLITUDE: number; + DEBUGCANVASPOS: { + x: number; + y: number; + }; + DEBUGCANVASSIZE: { + width: number; + height: number; + }; + private _byteFreqs; + private _byteTime; + private _floatFreqs; + private _webAudioAnalyser; + private _debugCanvas; + private _debugCanvasContext; + private _scene; + private _registerFunc; + private _audioEngine; + constructor(scene: Scene); + getFrequencyBinCount(): number; + getByteFrequencyData(): Uint8Array; + getByteTimeDomainData(): Uint8Array; + getFloatFrequencyData(): Uint8Array; + drawDebugCanvas(): void; + stopDebugCanvas(): void; + connectAudioNodes(inputAudioNode: AudioNode, outputAudioNode: AudioNode): void; + dispose(): void; + } +} + +declare module BABYLON { + class AudioEngine { + private _audioContext; + private _audioContextInitialized; + canUseWebAudio: boolean; + masterGain: GainNode; + private _connectedAnalyser; + WarnedWebAudioUnsupported: boolean; + audioContext: AudioContext; + constructor(); + private _initializeAudioContext(); + dispose(): void; + getGlobalVolume(): number; + setGlobalVolume(newVolume: number): void; + connectToAnalyser(analyser: Analyser): void; + } +} + +declare module BABYLON { + class Sound { + name: string; + autoplay: boolean; + loop: boolean; + useCustomAttenuation: boolean; + soundTrackId: number; + spatialSound: boolean; + refDistance: number; + rolloffFactor: number; + maxDistance: number; + distanceModel: string; + private _panningModel; + onended: () => any; + private _playbackRate; + private _startTime; + private _startOffset; + private _position; + private _localDirection; + private _volume; + private _isLoaded; + private _isReadyToPlay; + isPlaying: boolean; + isPaused: boolean; + private _isDirectional; + private _readyToPlayCallback; + private _audioBuffer; + private _soundSource; + private _soundPanner; + private _soundGain; + private _inputAudioNode; + private _ouputAudioNode; + private _coneInnerAngle; + private _coneOuterAngle; + private _coneOuterGain; + private _scene; + private _connectedMesh; + private _customAttenuationFunction; + private _registerFunc; + private _isOutputConnected; + /** + * Create a sound and attach it to a scene + * @param name Name of your sound + * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer + * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played + * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel + */ + constructor(name: string, urlOrArrayBuffer: any, scene: Scene, readyToPlayCallback?: () => void, options?: any); + dispose(): void; + private _soundLoaded(audioData); + setAudioBuffer(audioBuffer: AudioBuffer): void; + updateOptions(options: any): void; + private _createSpatialParameters(); + private _updateSpatialParameters(); + switchPanningModelToHRTF(): void; + switchPanningModelToEqualPower(): void; + private _switchPanningModel(); + connectToSoundTrackAudioNode(soundTrackAudioNode: AudioNode): void; + /** + * Transform this sound into a directional source + * @param coneInnerAngle Size of the inner cone in degree + * @param coneOuterAngle Size of the outer cone in degree + * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0) + */ + setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): void; + setPosition(newPosition: Vector3): void; + setLocalDirectionToMesh(newLocalDirection: Vector3): void; + private _updateDirection(); + updateDistanceFromListener(): void; + setAttenuationFunction(callback: (currentVolume: number, currentDistance: number, maxDistance: number, refDistance: number, rolloffFactor: number) => number): void; + /** + * Play the sound + * @param time (optional) Start the sound after X seconds. Start immediately (0) by default. + */ + play(time?: number): void; + private _onended(); + /** + * Stop the sound + * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default. + */ + stop(time?: number): void; + pause(): void; + setVolume(newVolume: number, time?: number): void; + setPlaybackRate(newPlaybackRate: number): void; + getVolume(): number; + attachToMesh(meshToConnectTo: AbstractMesh): void; + private _onRegisterAfterWorldMatrixUpdate(connectedMesh); + } +} + +declare module BABYLON { + class SoundTrack { + private _audioEngine; + private _outputAudioNode; + private _inputAudioNode; + private _trackConvolver; + private _scene; + id: number; + soundCollection: Array; + private _isMainTrack; + private _connectedAnalyser; + constructor(scene: Scene, options?: any); + dispose(): void; + AddSound(sound: Sound): void; + RemoveSound(sound: Sound): void; + setVolume(newVolume: number): void; + switchPanningModelToHRTF(): void; + switchPanningModelToEqualPower(): void; + connectToAnalyser(analyser: Analyser): void; + } +} + +declare module BABYLON { + class Bone extends Node { + name: string; + children: Bone[]; + animations: Animation[]; + private _skeleton; + private _matrix; + private _baseMatrix; + private _worldTransform; + private _absoluteTransform; + private _invertedAbsoluteTransform; + private _parent; + constructor(name: string, skeleton: Skeleton, parentBone: Bone, matrix: Matrix); + getParent(): Bone; + getLocalMatrix(): Matrix; + getBaseMatrix(): Matrix; + getWorldMatrix(): Matrix; + getInvertedAbsoluteTransform(): Matrix; + getAbsoluteMatrix(): Matrix; + updateMatrix(matrix: Matrix): void; + private _updateDifferenceMatrix(); + markAsDirty(): void; + } +} + +declare module BABYLON { + class Skeleton { + name: string; + id: string; + bones: Bone[]; + private _scene; + private _isDirty; + private _transformMatrices; + private _animatables; + private _identity; + constructor(name: string, id: string, scene: Scene); + getTransformMatrices(): Float32Array; + getScene(): Scene; + _markAsDirty(): void; + prepare(): void; + getAnimatables(): IAnimatable[]; + clone(name: string, id: string): Skeleton; + } +} + +declare module BABYLON { + class ArcRotateCamera extends TargetCamera { + alpha: number; + beta: number; + radius: number; + target: any; + inertialAlphaOffset: number; + inertialBetaOffset: number; + inertialRadiusOffset: number; + lowerAlphaLimit: any; + upperAlphaLimit: any; + lowerBetaLimit: number; + upperBetaLimit: number; + lowerRadiusLimit: any; + upperRadiusLimit: any; + angularSensibilityX: number; + angularSensibilityY: number; + wheelPrecision: number; + pinchPrecision: number; + panningSensibility: number; + inertialPanningX: number; + inertialPanningY: number; + keysUp: number[]; + keysDown: number[]; + keysLeft: number[]; + keysRight: number[]; + zoomOnFactor: number; + targetScreenOffset: Vector2; + pinchInwards: boolean; + allowUpsideDown: boolean; + private _keys; + _viewMatrix: Matrix; + private _attachedElement; + private _onContextMenu; + private _onPointerDown; + private _onPointerUp; + private _onPointerMove; + private _wheel; + private _onMouseMove; + private _onKeyDown; + private _onKeyUp; + private _onLostFocus; + _reset: () => void; + private _onGestureStart; + private _onGesture; + private _MSGestureHandler; + private _localDirection; + private _transformedDirection; + private _isRightClick; + private _isCtrlPushed; + onCollide: (collidedMesh: AbstractMesh) => void; + checkCollisions: boolean; + collisionRadius: Vector3; + private _collider; + private _previousPosition; + private _collisionVelocity; + private _newPosition; + private _previousAlpha; + private _previousBeta; + private _previousRadius; + private _collisionTriggered; + angularSensibility: number; + constructor(name: string, alpha: number, beta: number, radius: number, target: any, scene: Scene); + _getTargetPosition(): Vector3; + _initCache(): void; + _updateCache(ignoreParentClass?: boolean): void; + _isSynchronizedViewMatrix(): boolean; + attachControl(element: HTMLElement, noPreventDefault?: boolean, useCtrlForPanning?: boolean): void; + detachControl(element: HTMLElement): void; + _checkInputs(): void; + private _checkLimits(); + setPosition(position: Vector3): void; + setTarget(target: Vector3): void; + _getViewMatrix(): Matrix; + private _onCollisionPositionChange; + zoomOn(meshes?: AbstractMesh[], doNotUpdateMaxZ?: boolean): void; + focusOn(meshesOrMinMaxVectorAndDistance: any, doNotUpdateMaxZ?: boolean): void; + /** + * @override + * Override Camera.createRigCamera + */ + createRigCamera(name: string, cameraIndex: number): Camera; + /** + * @override + * Override Camera._updateRigCameras + */ + _updateRigCameras(): void; + } +} + +declare module BABYLON { + class VRCameraMetrics { + hResolution: number; + vResolution: number; + hScreenSize: number; + vScreenSize: number; + vScreenCenter: number; + eyeToScreenDistance: number; + lensSeparationDistance: number; + interpupillaryDistance: number; + distortionK: number[]; + chromaAbCorrection: number[]; + postProcessScaleFactor: number; + lensCenterOffset: number; + compensateDistorsion: boolean; + aspectRatio: number; + aspectRatioFov: number; + leftHMatrix: Matrix; + rightHMatrix: Matrix; + leftPreViewMatrix: Matrix; + rightPreViewMatrix: Matrix; + static GetDefault(): VRCameraMetrics; + } + class Camera extends Node { + position: Vector3; + private static _PERSPECTIVE_CAMERA; + private static _ORTHOGRAPHIC_CAMERA; + private static _FOVMODE_VERTICAL_FIXED; + private static _FOVMODE_HORIZONTAL_FIXED; + private static _RIG_MODE_NONE; + private static _RIG_MODE_STEREOSCOPIC_ANAGLYPH; + private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL; + private static _RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED; + private static _RIG_MODE_STEREOSCOPIC_OVERUNDER; + private static _RIG_MODE_VR; + static PERSPECTIVE_CAMERA: number; + static ORTHOGRAPHIC_CAMERA: number; + static FOVMODE_VERTICAL_FIXED: number; + static FOVMODE_HORIZONTAL_FIXED: number; + static RIG_MODE_NONE: number; + static RIG_MODE_STEREOSCOPIC_ANAGLYPH: number; + static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL: number; + static RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED: number; + static RIG_MODE_STEREOSCOPIC_OVERUNDER: number; + static RIG_MODE_VR: number; + upVector: Vector3; + orthoLeft: any; + orthoRight: any; + orthoBottom: any; + orthoTop: any; + fov: number; + minZ: number; + maxZ: number; + inertia: number; + mode: number; + isIntermediate: boolean; + viewport: Viewport; + layerMask: number; + fovMode: number; + cameraRigMode: number; + _cameraRigParams: any; + _rigCameras: Camera[]; + private _computedViewMatrix; + _projectionMatrix: Matrix; + private _worldMatrix; + _postProcesses: PostProcess[]; + _postProcessesTakenIndices: any[]; + _activeMeshes: SmartArray; + private _globalPosition; + constructor(name: string, position: Vector3, scene: Scene); + globalPosition: Vector3; + getActiveMeshes(): SmartArray; + isActiveMesh(mesh: Mesh): boolean; + _initCache(): void; + _updateCache(ignoreParentClass?: boolean): void; + _updateFromScene(): void; + _isSynchronized(): boolean; + _isSynchronizedViewMatrix(): boolean; + _isSynchronizedProjectionMatrix(): boolean; + attachControl(element: HTMLElement): void; + detachControl(element: HTMLElement): void; + _update(): void; + _checkInputs(): void; + attachPostProcess(postProcess: PostProcess, insertAt?: number): number; + detachPostProcess(postProcess: PostProcess, atIndices?: any): number[]; + getWorldMatrix(): Matrix; + _getViewMatrix(): Matrix; + getViewMatrix(force?: boolean): Matrix; + _computeViewMatrix(force?: boolean): Matrix; + getProjectionMatrix(force?: boolean): Matrix; + dispose(): void; + setCameraRigMode(mode: number, rigParams: any): void; + private _getVRProjectionMatrix(); + setCameraRigParameter(name: string, value: any): void; + /** + * May needs to be overridden by children so sub has required properties to be copied + */ + createRigCamera(name: string, cameraIndex: number): Camera; + /** + * May needs to be overridden by children + */ + _updateRigCameras(): void; + } +} + +declare module BABYLON { + class DeviceOrientationCamera extends FreeCamera { + private _offsetX; + private _offsetY; + private _orientationGamma; + private _orientationBeta; + private _initialOrientationGamma; + private _initialOrientationBeta; + private _attachedCanvas; + private _orientationChanged; + angularSensibility: number; + moveSensibility: number; + constructor(name: string, position: Vector3, scene: Scene); + attachControl(canvas: HTMLCanvasElement, noPreventDefault: boolean): void; + detachControl(canvas: HTMLCanvasElement): void; + _checkInputs(): void; + } +} + +declare module BABYLON { + class FollowCamera extends TargetCamera { + radius: number; + rotationOffset: number; + heightOffset: number; + cameraAcceleration: number; + maxCameraSpeed: number; + target: AbstractMesh; + constructor(name: string, position: Vector3, scene: Scene); + private getRadians(degrees); + private follow(cameraTarget); + _checkInputs(): void; + } + class ArcFollowCamera extends TargetCamera { + alpha: number; + beta: number; + radius: number; + target: AbstractMesh; + private _cartesianCoordinates; + constructor(name: string, alpha: number, beta: number, radius: number, target: AbstractMesh, scene: Scene); + private follow(); + _checkInputs(): void; + } +} + +declare module BABYLON { + class FreeCamera extends TargetCamera { + ellipsoid: Vector3; + keysUp: number[]; + keysDown: number[]; + keysLeft: number[]; + keysRight: number[]; + checkCollisions: boolean; + applyGravity: boolean; + angularSensibility: number; + onCollide: (collidedMesh: AbstractMesh) => void; + private _keys; + private _collider; + private _needMoveForGravity; + private _oldPosition; + private _diffPosition; + private _newPosition; + private _attachedElement; + private _localDirection; + private _transformedDirection; + private _onMouseDown; + private _onMouseUp; + private _onMouseOut; + private _onMouseMove; + private _onKeyDown; + private _onKeyUp; + _onLostFocus: (e: FocusEvent) => any; + _waitingLockedTargetId: string; + constructor(name: string, position: Vector3, scene: Scene); + attachControl(element: HTMLElement, noPreventDefault?: boolean): void; + detachControl(element: HTMLElement): void; + _collideWithWorld(velocity: Vector3): void; + private _onCollisionPositionChange; + _checkInputs(): void; + _decideIfNeedsToMove(): boolean; + _updatePosition(): void; + } +} + +declare module BABYLON { + class GamepadCamera extends FreeCamera { + private _gamepad; + private _gamepads; + angularSensibility: number; + moveSensibility: number; + constructor(name: string, position: Vector3, scene: Scene); + private _onNewGameConnected(gamepad); + _checkInputs(): void; + dispose(): void; + } +} + +declare module BABYLON { + class AnaglyphFreeCamera extends FreeCamera { + constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene); + } + class AnaglyphArcRotateCamera extends ArcRotateCamera { + constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, scene: Scene); + } + class AnaglyphGamepadCamera extends GamepadCamera { + constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene); + } + class StereoscopicFreeCamera extends FreeCamera { + constructor(name: string, position: Vector3, interaxialDistance: number, isSideBySide: boolean, scene: Scene); + } + class StereoscopicArcRotateCamera extends ArcRotateCamera { + constructor(name: string, alpha: number, beta: number, radius: number, target: any, interaxialDistance: number, isSideBySide: boolean, scene: Scene); + } + class StereoscopicGamepadCamera extends GamepadCamera { + constructor(name: string, position: Vector3, interaxialDistance: number, isSideBySide: boolean, scene: Scene); + } +} + +declare module BABYLON { + class TargetCamera extends Camera { + cameraDirection: Vector3; + cameraRotation: Vector2; + rotation: Vector3; + speed: number; + noRotationConstraint: boolean; + lockedTarget: any; + _currentTarget: Vector3; + _viewMatrix: Matrix; + _camMatrix: Matrix; + _cameraTransformMatrix: Matrix; + _cameraRotationMatrix: Matrix; + private _rigCamTransformMatrix; + _referencePoint: Vector3; + _transformedReferencePoint: Vector3; + _lookAtTemp: Matrix; + _tempMatrix: Matrix; + _reset: () => void; + _waitingLockedTargetId: string; + constructor(name: string, position: Vector3, scene: Scene); + getFrontPosition(distance: number): Vector3; + _getLockedTargetPosition(): Vector3; + _initCache(): void; + _updateCache(ignoreParentClass?: boolean): void; + _isSynchronizedViewMatrix(): boolean; + _computeLocalCameraSpeed(): number; + setTarget(target: Vector3): void; + getTarget(): Vector3; + _decideIfNeedsToMove(): boolean; + _updatePosition(): void; + _checkInputs(): void; + _getViewMatrix(): Matrix; + _getVRViewMatrix(): Matrix; + /** + * @override + * Override Camera.createRigCamera + */ + createRigCamera(name: string, cameraIndex: number): Camera; + /** + * @override + * Override Camera._updateRigCameras + */ + _updateRigCameras(): void; + private _getRigCamPosition(halfSpace, result); + } +} + +declare module BABYLON { + class TouchCamera extends FreeCamera { + private _offsetX; + private _offsetY; + private _pointerCount; + private _pointerPressed; + private _attachedCanvas; + private _onPointerDown; + private _onPointerUp; + private _onPointerMove; + angularSensibility: number; + moveSensibility: number; + constructor(name: string, position: Vector3, scene: Scene); + attachControl(canvas: HTMLCanvasElement, noPreventDefault: boolean): void; + detachControl(canvas: HTMLCanvasElement): void; + _checkInputs(): void; + } +} + +declare module BABYLON { + class VirtualJoysticksCamera extends FreeCamera { + private _leftjoystick; + private _rightjoystick; + constructor(name: string, position: Vector3, scene: Scene); + getLeftJoystick(): VirtualJoystick; + getRightJoystick(): VirtualJoystick; + _checkInputs(): void; + dispose(): void; + } +} + +declare module BABYLON { + class Collider { + radius: Vector3; + retry: number; + velocity: Vector3; + basePoint: Vector3; + epsilon: number; + collisionFound: boolean; + velocityWorldLength: number; + basePointWorld: Vector3; + velocityWorld: Vector3; + normalizedVelocity: Vector3; + initialVelocity: Vector3; + initialPosition: Vector3; + nearestDistance: number; + intersectionPoint: Vector3; + collidedMesh: AbstractMesh; + private _collisionPoint; + private _planeIntersectionPoint; + private _tempVector; + private _tempVector2; + private _tempVector3; + private _tempVector4; + private _edge; + private _baseToVertex; + private _destinationPoint; + private _slidePlaneNormal; + private _displacementVector; + _initialize(source: Vector3, dir: Vector3, e: number): void; + _checkPointInTriangle(point: Vector3, pa: Vector3, pb: Vector3, pc: Vector3, n: Vector3): boolean; + _canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean; + _testTriangle(faceIndex: number, trianglePlaneArray: Array, p1: Vector3, p2: Vector3, p3: Vector3, hasMaterial: boolean): void; + _collide(trianglePlaneArray: Array, pts: Vector3[], indices: number[], indexStart: number, indexEnd: number, decal: number, hasMaterial: boolean): void; + _getResponse(pos: Vector3, vel: Vector3): void; + } +} + +declare module BABYLON { + var CollisionWorker: string; + interface ICollisionCoordinator { + getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void; + init(scene: Scene): void; + destroy(): void; + onMeshAdded(mesh: AbstractMesh): any; + onMeshUpdated(mesh: AbstractMesh): any; + onMeshRemoved(mesh: AbstractMesh): any; + onGeometryAdded(geometry: Geometry): any; + onGeometryUpdated(geometry: Geometry): any; + onGeometryDeleted(geometry: Geometry): any; + } + interface SerializedMesh { + id: string; + name: string; + uniqueId: number; + geometryId: string; + sphereCenter: Array; + sphereRadius: number; + boxMinimum: Array; + boxMaximum: Array; + worldMatrixFromCache: any; + subMeshes: Array; + checkCollisions: boolean; + } + interface SerializedSubMesh { + position: number; + verticesStart: number; + verticesCount: number; + indexStart: number; + indexCount: number; + hasMaterial: boolean; + sphereCenter: Array; + sphereRadius: number; + boxMinimum: Array; + boxMaximum: Array; + } + interface SerializedGeometry { + id: string; + positions: Float32Array; + indices: Int32Array; + normals: Float32Array; + } + interface BabylonMessage { + taskType: WorkerTaskType; + payload: InitPayload | CollidePayload | UpdatePayload; + } + interface SerializedColliderToWorker { + position: Array; + velocity: Array; + radius: Array; + } + enum WorkerTaskType { + INIT = 0, + UPDATE = 1, + COLLIDE = 2, + } + interface WorkerReply { + error: WorkerReplyType; + taskType: WorkerTaskType; + payload?: any; + } + interface CollisionReplyPayload { + newPosition: Array; + collisionId: number; + collidedMeshUniqueId: number; + } + interface InitPayload { + } + interface CollidePayload { + collisionId: number; + collider: SerializedColliderToWorker; + maximumRetry: number; + excludedMeshUniqueId?: number; + } + interface UpdatePayload { + updatedMeshes: { + [n: number]: SerializedMesh; + }; + updatedGeometries: { + [s: string]: SerializedGeometry; + }; + removedMeshes: Array; + removedGeometries: Array; + } + enum WorkerReplyType { + SUCCESS = 0, + UNKNOWN_ERROR = 1, + } + class CollisionCoordinatorWorker implements ICollisionCoordinator { + private _scene; + private _scaledPosition; + private _scaledVelocity; + private _collisionsCallbackArray; + private _init; + private _runningUpdated; + private _runningCollisionTask; + private _worker; + private _addUpdateMeshesList; + private _addUpdateGeometriesList; + private _toRemoveMeshesArray; + private _toRemoveGeometryArray; + constructor(); + static SerializeMesh: (mesh: AbstractMesh) => SerializedMesh; + static SerializeGeometry: (geometry: Geometry) => SerializedGeometry; + getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void; + init(scene: Scene): void; + destroy(): void; + onMeshAdded(mesh: AbstractMesh): void; + onMeshUpdated: (mesh: AbstractMesh) => void; + onMeshRemoved(mesh: AbstractMesh): void; + onGeometryAdded(geometry: Geometry): void; + onGeometryUpdated: (geometry: Geometry) => void; + onGeometryDeleted(geometry: Geometry): void; + private _afterRender; + private _onMessageFromWorker; + } + class CollisionCoordinatorLegacy implements ICollisionCoordinator { + private _scene; + private _scaledPosition; + private _scaledVelocity; + private _finalPosition; + getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void; + init(scene: Scene): void; + destroy(): void; + onMeshAdded(mesh: AbstractMesh): void; + onMeshUpdated(mesh: AbstractMesh): void; + onMeshRemoved(mesh: AbstractMesh): void; + onGeometryAdded(geometry: Geometry): void; + onGeometryUpdated(geometry: Geometry): void; + onGeometryDeleted(geometry: Geometry): void; + private _collideWithWorld(position, velocity, collider, maximumRetry, finalPosition, excludedMesh?); + } +} + +declare module BABYLON { + var WorkerIncluded: boolean; + class CollisionCache { + private _meshes; + private _geometries; + getMeshes(): { + [n: number]: SerializedMesh; + }; + getGeometries(): { + [s: number]: SerializedGeometry; + }; + getMesh(id: any): SerializedMesh; + addMesh(mesh: SerializedMesh): void; + getGeometry(id: string): SerializedGeometry; + addGeometry(geometry: SerializedGeometry): void; + } + class CollideWorker { + collider: Collider; + private _collisionCache; + private finalPosition; + private collisionsScalingMatrix; + private collisionTranformationMatrix; + constructor(collider: Collider, _collisionCache: CollisionCache, finalPosition: Vector3); + collideWithWorld(position: Vector3, velocity: Vector3, maximumRetry: number, excludedMeshUniqueId?: number): void; + private checkCollision(mesh); + private processCollisionsForSubMeshes(transformMatrix, mesh); + private collideForSubMesh(subMesh, transformMatrix, meshGeometry); + private checkSubmeshCollision(subMesh); + } + interface ICollisionDetector { + onInit(payload: InitPayload): void; + onUpdate(payload: UpdatePayload): void; + onCollision(payload: CollidePayload): void; + } + class CollisionDetectorTransferable implements ICollisionDetector { + private _collisionCache; + onInit(payload: InitPayload): void; + onUpdate(payload: UpdatePayload): void; + onCollision(payload: CollidePayload): void; + } +} + +declare module BABYLON { + class IntersectionInfo { + bu: number; + bv: number; + distance: number; + faceId: number; + subMeshId: number; + constructor(bu: number, bv: number, distance: number); + } + class PickingInfo { + hit: boolean; + distance: number; + pickedPoint: Vector3; + pickedMesh: AbstractMesh; + bu: number; + bv: number; + faceId: number; + subMeshId: number; + getNormal(useWorldCoordinates?: boolean, useVerticesNormals?: boolean): Vector3; + getTextureCoordinates(): Vector2; + } +} + +declare module BABYLON { + class BoundingBox { + minimum: Vector3; + maximum: Vector3; + vectors: Vector3[]; + center: Vector3; + extendSize: Vector3; + directions: Vector3[]; + vectorsWorld: Vector3[]; + minimumWorld: Vector3; + maximumWorld: Vector3; + private _worldMatrix; + constructor(minimum: Vector3, maximum: Vector3); + getWorldMatrix(): Matrix; + _update(world: Matrix): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + isCompletelyInFrustum(frustumPlanes: Plane[]): boolean; + intersectsPoint(point: Vector3): boolean; + intersectsSphere(sphere: BoundingSphere): boolean; + intersectsMinMax(min: Vector3, max: Vector3): boolean; + static Intersects(box0: BoundingBox, box1: BoundingBox): boolean; + static IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean; + static IsCompletelyInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean; + static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean; + } +} + +declare module BABYLON { + class BoundingInfo { + minimum: Vector3; + maximum: Vector3; + boundingBox: BoundingBox; + boundingSphere: BoundingSphere; + constructor(minimum: Vector3, maximum: Vector3); + _update(world: Matrix): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + isCompletelyInFrustum(frustumPlanes: Plane[]): boolean; + _checkCollision(collider: Collider): boolean; + intersectsPoint(point: Vector3): boolean; + intersects(boundingInfo: BoundingInfo, precise: boolean): boolean; + } +} + +declare module BABYLON { + class BoundingSphere { + minimum: Vector3; + maximum: Vector3; + center: Vector3; + radius: number; + centerWorld: Vector3; + radiusWorld: number; + private _tempRadiusVector; + constructor(minimum: Vector3, maximum: Vector3); + _update(world: Matrix): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + intersectsPoint(point: Vector3): boolean; + static Intersects(sphere0: BoundingSphere, sphere1: BoundingSphere): boolean; + } +} + +declare module BABYLON { + class DebugLayer { + private _scene; + private _camera; + private _transformationMatrix; + private _enabled; + private _labelsEnabled; + private _displayStatistics; + private _displayTree; + private _displayLogs; + private _globalDiv; + private _statsDiv; + private _statsSubsetDiv; + private _optionsDiv; + private _optionsSubsetDiv; + private _logDiv; + private _logSubsetDiv; + private _treeDiv; + private _treeSubsetDiv; + private _drawingCanvas; + private _drawingContext; + private _syncPositions; + private _syncData; + private _syncUI; + private _onCanvasClick; + private _clickPosition; + private _ratio; + private _identityMatrix; + private _showUI; + private _needToRefreshMeshesTree; + shouldDisplayLabel: (node: Node) => boolean; + shouldDisplayAxis: (mesh: Mesh) => boolean; + axisRatio: number; + accentColor: string; + customStatsFunction: () => string; + constructor(scene: Scene); + private _refreshMeshesTreeContent(); + private _renderSingleAxis(zero, unit, unitText, label, color); + private _renderAxis(projectedPosition, mesh, globalViewport); + private _renderLabel(text, projectedPosition, labelOffset, onClick, getFillStyle); + private _isClickInsideRect(x, y, width, height); + isVisible(): boolean; + hide(): void; + show(showUI?: boolean, camera?: Camera): void; + private _clearLabels(); + private _generateheader(root, text); + private _generateTexBox(root, title, color); + private _generateAdvancedCheckBox(root, leftTitle, rightTitle, initialState, task, tag?); + private _generateCheckBox(root, title, initialState, task, tag?); + private _generateButton(root, title, task, tag?); + private _generateRadio(root, title, name, initialState, task, tag?); + private _generateDOMelements(); + private _displayStats(); + } +} + +declare module BABYLON { + class Layer { + name: string; + texture: Texture; + isBackground: boolean; + color: Color4; + onDispose: () => void; + private _scene; + private _vertexDeclaration; + private _vertexStrideSize; + private _vertexBuffer; + private _indexBuffer; + private _effect; + constructor(name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4); + render(): void; + dispose(): void; + } +} + +declare module BABYLON { + class LensFlare { + size: number; + position: number; + color: Color3; + texture: Texture; + private _system; + constructor(size: number, position: number, color: any, imgUrl: string, system: LensFlareSystem); + dispose: () => void; + } +} + +declare module BABYLON { + class LensFlareSystem { + name: string; + lensFlares: LensFlare[]; + borderLimit: number; + meshesSelectionPredicate: (mesh: Mesh) => boolean; + layerMask: number; + private _scene; + private _emitter; + private _vertexDeclaration; + private _vertexStrideSize; + private _vertexBuffer; + private _indexBuffer; + private _effect; + private _positionX; + private _positionY; + private _isEnabled; + constructor(name: string, emitter: any, scene: Scene); + isEnabled: boolean; + getScene(): Scene; + getEmitter(): any; + setEmitter(newEmitter: any): void; + getEmitterPosition(): Vector3; + computeEffectivePosition(globalViewport: Viewport): boolean; + _isVisible(): boolean; + render(): boolean; + dispose(): void; + } +} + +declare module BABYLON { + class DirectionalLight extends Light implements IShadowLight { + direction: Vector3; + position: Vector3; + private _transformedDirection; + transformedPosition: Vector3; + private _worldMatrix; + shadowOrthoScale: number; + constructor(name: string, direction: Vector3, scene: Scene); + getAbsolutePosition(): Vector3; + setDirectionToTarget(target: Vector3): Vector3; + setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): void; + supportsVSM(): boolean; + needRefreshPerFrame(): boolean; + computeTransformedPosition(): boolean; + transferToEffect(effect: Effect, directionUniformName: string): void; + _getWorldMatrix(): Matrix; + } +} + +declare module BABYLON { + class HemisphericLight extends Light { + direction: Vector3; + groundColor: Color3; + private _worldMatrix; + constructor(name: string, direction: Vector3, scene: Scene); + setDirectionToTarget(target: Vector3): Vector3; + getShadowGenerator(): ShadowGenerator; + transferToEffect(effect: Effect, directionUniformName: string, groundColorUniformName: string): void; + _getWorldMatrix(): Matrix; + } +} + +declare module BABYLON { + interface IShadowLight { + position: Vector3; + direction: Vector3; + transformedPosition: Vector3; + name: string; + computeTransformedPosition(): boolean; + getScene(): Scene; + setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): void; + supportsVSM(): boolean; + needRefreshPerFrame(): boolean; + _shadowGenerator: ShadowGenerator; + } + class Light extends Node { + diffuse: Color3; + specular: Color3; + intensity: number; + range: number; + includeOnlyWithLayerMask: number; + includedOnlyMeshes: AbstractMesh[]; + excludedMeshes: AbstractMesh[]; + excludeWithLayerMask: number; + _shadowGenerator: ShadowGenerator; + private _parentedWorldMatrix; + _excludedMeshesIds: string[]; + _includedOnlyMeshesIds: string[]; + constructor(name: string, scene: Scene); + getShadowGenerator(): ShadowGenerator; + getAbsolutePosition(): Vector3; + transferToEffect(effect: Effect, uniformName0?: string, uniformName1?: string): void; + _getWorldMatrix(): Matrix; + canAffectMesh(mesh: AbstractMesh): boolean; + getWorldMatrix(): Matrix; + dispose(): void; + } +} + +declare module BABYLON { + class PointLight extends Light { + position: Vector3; + private _worldMatrix; + private _transformedPosition; + constructor(name: string, position: Vector3, scene: Scene); + getAbsolutePosition(): Vector3; + transferToEffect(effect: Effect, positionUniformName: string): void; + getShadowGenerator(): ShadowGenerator; + _getWorldMatrix(): Matrix; + } +} + +declare module BABYLON { + class SpotLight extends Light implements IShadowLight { + position: Vector3; + direction: Vector3; + angle: number; + exponent: number; + transformedPosition: Vector3; + private _transformedDirection; + private _worldMatrix; + constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene); + getAbsolutePosition(): Vector3; + setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): void; + supportsVSM(): boolean; + needRefreshPerFrame(): boolean; + setDirectionToTarget(target: Vector3): Vector3; + computeTransformedPosition(): boolean; + transferToEffect(effect: Effect, positionUniformName: string, directionUniformName: string): void; + _getWorldMatrix(): Matrix; + } +} + +declare module BABYLON { + interface ISceneLoaderPlugin { + extensions: string; + importMesh: (meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => boolean; + load: (scene: Scene, data: string, rootUrl: string) => boolean; + } + class SceneLoader { + private static _ForceFullSceneLoadingForIncremental; + private static _ShowLoadingScreen; + static ForceFullSceneLoadingForIncremental: boolean; + static ShowLoadingScreen: boolean; + private static _registeredPlugins; + private static _getPluginForFilename(sceneFilename); + static RegisterPlugin(plugin: ISceneLoaderPlugin): void; + static ImportMesh(meshesNames: any, rootUrl: string, sceneFilename: string, scene: Scene, onsuccess?: (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, progressCallBack?: () => void, onerror?: (scene: Scene, e: any) => void): void; + /** + * Load a scene + * @param rootUrl a string that defines the root url for scene and resources + * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene + * @param engine is the instance of BABYLON.Engine to use to create the scene + */ + static Load(rootUrl: string, sceneFilename: any, engine: Engine, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void; + /** + * Append a scene + * @param rootUrl a string that defines the root url for scene and resources + * @param sceneFilename a string that defines the name of the scene file. can start with "data:" following by the stringified version of the scene + * @param scene is the instance of BABYLON.Scene to append to + */ + static Append(rootUrl: string, sceneFilename: any, scene: Scene, onsuccess?: (scene: Scene) => void, progressCallBack?: any, onerror?: (scene: Scene) => void): void; + } +} + +declare module BABYLON { + class EffectFallbacks { + private _defines; + private _currentRank; + private _maxRank; + addFallback(rank: number, define: string): void; + isMoreFallbacks: boolean; + reduce(currentDefines: string): string; + } + class Effect { + name: any; + defines: string; + onCompiled: (effect: Effect) => void; + onError: (effect: Effect, errors: string) => void; + onBind: (effect: Effect) => void; + private _engine; + private _uniformsNames; + private _samplers; + private _isReady; + private _compilationError; + private _attributesNames; + private _attributes; + private _uniforms; + _key: string; + private _program; + private _valueCache; + constructor(baseName: any, attributesNames: string[], uniformsNames: string[], samplers: string[], engine: any, defines?: string, fallbacks?: EffectFallbacks, onCompiled?: (effect: Effect) => void, onError?: (effect: Effect, errors: string) => void); + isReady(): boolean; + getProgram(): WebGLProgram; + getAttributesNames(): string[]; + getAttributeLocation(index: number): number; + getAttributeLocationByName(name: string): number; + getAttributesCount(): number; + getUniformIndex(uniformName: string): number; + getUniform(uniformName: string): WebGLUniformLocation; + getSamplers(): string[]; + getCompilationError(): string; + _loadVertexShader(vertex: any, callback: (data: any) => void): void; + _loadFragmentShader(fragment: any, callback: (data: any) => void): void; + private _prepareEffect(vertexSourceCode, fragmentSourceCode, attributesNames, defines, fallbacks?); + _bindTexture(channel: string, texture: WebGLTexture): void; + setTexture(channel: string, texture: BaseTexture): void; + setTextureFromPostProcess(channel: string, postProcess: PostProcess): void; + _cacheFloat2(uniformName: string, x: number, y: number): void; + _cacheFloat3(uniformName: string, x: number, y: number, z: number): void; + _cacheFloat4(uniformName: string, x: number, y: number, z: number, w: number): void; + setArray(uniformName: string, array: number[]): Effect; + setArray2(uniformName: string, array: number[]): Effect; + setArray3(uniformName: string, array: number[]): Effect; + setArray4(uniformName: string, array: number[]): Effect; + setMatrices(uniformName: string, matrices: Float32Array): Effect; + setMatrix(uniformName: string, matrix: Matrix): Effect; + setMatrix3x3(uniformName: string, matrix: Float32Array): Effect; + setMatrix2x2(uniformname: string, matrix: Float32Array): Effect; + setFloat(uniformName: string, value: number): Effect; + setBool(uniformName: string, bool: boolean): Effect; + setVector2(uniformName: string, vector2: Vector2): Effect; + setFloat2(uniformName: string, x: number, y: number): Effect; + setVector3(uniformName: string, vector3: Vector3): Effect; + setFloat3(uniformName: string, x: number, y: number, z: number): Effect; + setVector4(uniformName: string, vector4: Vector4): Effect; + setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect; + setColor3(uniformName: string, color3: Color3): Effect; + setColor4(uniformName: string, color3: Color3, alpha: number): Effect; + static ShadersStore: {}; + } +} + +declare module BABYLON { + class Material { + name: string; + private static _TriangleFillMode; + private static _WireFrameFillMode; + private static _PointFillMode; + static TriangleFillMode: number; + static WireFrameFillMode: number; + static PointFillMode: number; + id: string; + checkReadyOnEveryCall: boolean; + checkReadyOnlyOnce: boolean; + state: string; + alpha: number; + backFaceCulling: boolean; + onCompiled: (effect: Effect) => void; + onError: (effect: Effect, errors: string) => void; + onDispose: () => void; + onBind: (material: Material, mesh: Mesh) => void; + getRenderTargetTextures: () => SmartArray; + alphaMode: number; + disableDepthWrite: boolean; + _effect: Effect; + _wasPreviouslyReady: boolean; + private _scene; + private _fillMode; + private _cachedDepthWriteState; + pointSize: number; + zOffset: number; + wireframe: boolean; + pointsCloud: boolean; + fillMode: number; + constructor(name: string, scene: Scene, doNotAdd?: boolean); + isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean; + getEffect(): Effect; + getScene(): Scene; + needAlphaBlending(): boolean; + needAlphaTesting(): boolean; + getAlphaTestTexture(): BaseTexture; + trackCreation(onCompiled: (effect: Effect) => void, onError: (effect: Effect, errors: string) => void): void; + _preBind(): void; + bind(world: Matrix, mesh?: Mesh): void; + bindOnlyWorldMatrix(world: Matrix): void; + unbind(): void; + clone(name: string): Material; + dispose(forceDisposeEffect?: boolean): void; + } +} + +declare module BABYLON { + class MultiMaterial extends Material { + subMaterials: Material[]; + constructor(name: string, scene: Scene); + getSubMaterial(index: any): Material; + isReady(mesh?: AbstractMesh): boolean; + clone(name: string): MultiMaterial; + } +} + +declare module BABYLON { + class ShaderMaterial extends Material { + private _shaderPath; + private _options; + private _textures; + private _floats; + private _floatsArrays; + private _colors3; + private _colors4; + private _vectors2; + private _vectors3; + private _vectors4; + private _matrices; + private _matrices3x3; + private _matrices2x2; + private _cachedWorldViewMatrix; + private _renderId; + constructor(name: string, scene: Scene, shaderPath: any, options: any); + needAlphaBlending(): boolean; + needAlphaTesting(): boolean; + private _checkUniform(uniformName); + setTexture(name: string, texture: Texture): ShaderMaterial; + setFloat(name: string, value: number): ShaderMaterial; + setFloats(name: string, value: number[]): ShaderMaterial; + setColor3(name: string, value: Color3): ShaderMaterial; + setColor4(name: string, value: Color4): ShaderMaterial; + setVector2(name: string, value: Vector2): ShaderMaterial; + setVector3(name: string, value: Vector3): ShaderMaterial; + setVector4(name: string, value: Vector4): ShaderMaterial; + setMatrix(name: string, value: Matrix): ShaderMaterial; + setMatrix3x3(name: string, value: Float32Array): ShaderMaterial; + setMatrix2x2(name: string, value: Float32Array): ShaderMaterial; + isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean; + bindOnlyWorldMatrix(world: Matrix): void; + bind(world: Matrix, mesh?: Mesh): void; + clone(name: string): ShaderMaterial; + dispose(forceDisposeEffect?: boolean): void; + } +} + +declare module BABYLON { + class FresnelParameters { + isEnabled: boolean; + leftColor: Color3; + rightColor: Color3; + bias: number; + power: number; + } + class StandardMaterial extends Material { + diffuseTexture: BaseTexture; + ambientTexture: BaseTexture; + opacityTexture: BaseTexture; + reflectionTexture: BaseTexture; + emissiveTexture: BaseTexture; + specularTexture: BaseTexture; + bumpTexture: BaseTexture; + ambientColor: Color3; + diffuseColor: Color3; + specularColor: Color3; + specularPower: number; + emissiveColor: Color3; + useAlphaFromDiffuseTexture: boolean; + useEmissiveAsIllumination: boolean; + useReflectionFresnelFromSpecular: boolean; + useSpecularOverAlpha: boolean; + fogEnabled: boolean; + roughness: number; + diffuseFresnelParameters: FresnelParameters; + opacityFresnelParameters: FresnelParameters; + reflectionFresnelParameters: FresnelParameters; + emissiveFresnelParameters: FresnelParameters; + useGlossinessFromSpecularMapAlpha: boolean; + private _renderTargets; + private _worldViewProjectionMatrix; + private _globalAmbientColor; + private _scaledDiffuse; + private _scaledSpecular; + private _renderId; + private _defines; + private _cachedDefines; + constructor(name: string, scene: Scene); + needAlphaBlending(): boolean; + needAlphaTesting(): boolean; + private _shouldUseAlphaFromDiffuseTexture(); + getAlphaTestTexture(): BaseTexture; + isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean; + unbind(): void; + bindOnlyWorldMatrix(world: Matrix): void; + bind(world: Matrix, mesh?: Mesh): void; + getAnimatables(): IAnimatable[]; + dispose(forceDisposeEffect?: boolean): void; + clone(name: string): StandardMaterial; + static DiffuseTextureEnabled: boolean; + static AmbientTextureEnabled: boolean; + static OpacityTextureEnabled: boolean; + static ReflectionTextureEnabled: boolean; + static EmissiveTextureEnabled: boolean; + static SpecularTextureEnabled: boolean; + static BumpTextureEnabled: boolean; + static FresnelEnabled: boolean; + } +} + +declare module BABYLON { + class Color3 { + r: number; + g: number; + b: number; + constructor(r?: number, g?: number, b?: number); + toString(): string; + toArray(array: number[], index?: number): Color3; + toColor4(alpha?: number): Color4; + asArray(): number[]; + toLuminance(): number; + multiply(otherColor: Color3): Color3; + multiplyToRef(otherColor: Color3, result: Color3): Color3; + equals(otherColor: Color3): boolean; + equalsFloats(r: number, g: number, b: number): boolean; + scale(scale: number): Color3; + scaleToRef(scale: number, result: Color3): Color3; + add(otherColor: Color3): Color3; + addToRef(otherColor: Color3, result: Color3): Color3; + subtract(otherColor: Color3): Color3; + subtractToRef(otherColor: Color3, result: Color3): Color3; + clone(): Color3; + copyFrom(source: Color3): Color3; + copyFromFloats(r: number, g: number, b: number): Color3; + toHexString(): string; + static FromHexString(hex: string): Color3; + static FromArray(array: number[], offset?: number): Color3; + static FromInts(r: number, g: number, b: number): Color3; + static Lerp(start: Color3, end: Color3, amount: number): Color3; + static Red(): Color3; + static Green(): Color3; + static Blue(): Color3; + static Black(): Color3; + static White(): Color3; + static Purple(): Color3; + static Magenta(): Color3; + static Yellow(): Color3; + static Gray(): Color3; + } + class Color4 { + r: number; + g: number; + b: number; + a: number; + constructor(r: number, g: number, b: number, a: number); + addInPlace(right: any): Color4; + asArray(): number[]; + toArray(array: number[], index?: number): Color4; + add(right: Color4): Color4; + subtract(right: Color4): Color4; + subtractToRef(right: Color4, result: Color4): Color4; + scale(scale: number): Color4; + scaleToRef(scale: number, result: Color4): Color4; + toString(): string; + clone(): Color4; + copyFrom(source: Color4): Color4; + toHexString(): string; + static FromHexString(hex: string): Color4; + static Lerp(left: Color4, right: Color4, amount: number): Color4; + static LerpToRef(left: Color4, right: Color4, amount: number, result: Color4): void; + static FromArray(array: number[], offset?: number): Color4; + static FromInts(r: number, g: number, b: number, a: number): Color4; + } + class Vector2 { + x: number; + y: number; + constructor(x: number, y: number); + toString(): string; + toArray(array: number[], index?: number): Vector2; + asArray(): number[]; + copyFrom(source: Vector2): Vector2; + copyFromFloats(x: number, y: number): Vector2; + add(otherVector: Vector2): Vector2; + addVector3(otherVector: Vector3): Vector2; + subtract(otherVector: Vector2): Vector2; + subtractInPlace(otherVector: Vector2): Vector2; + multiplyInPlace(otherVector: Vector2): Vector2; + multiply(otherVector: Vector2): Vector2; + multiplyToRef(otherVector: Vector2, result: Vector2): Vector2; + multiplyByFloats(x: number, y: number): Vector2; + divide(otherVector: Vector2): Vector2; + divideToRef(otherVector: Vector2, result: Vector2): Vector2; + negate(): Vector2; + scaleInPlace(scale: number): Vector2; + scale(scale: number): Vector2; + equals(otherVector: Vector2): boolean; + equalsWithEpsilon(otherVector: Vector2, epsilon?: number): boolean; + length(): number; + lengthSquared(): number; + normalize(): Vector2; + clone(): Vector2; + static Zero(): Vector2; + static FromArray(array: number[], offset?: number): Vector2; + static FromArrayToRef(array: number[], offset: number, result: Vector2): void; + static CatmullRom(value1: Vector2, value2: Vector2, value3: Vector2, value4: Vector2, amount: number): Vector2; + static Clamp(value: Vector2, min: Vector2, max: Vector2): Vector2; + static Hermite(value1: Vector2, tangent1: Vector2, value2: Vector2, tangent2: Vector2, amount: number): Vector2; + static Lerp(start: Vector2, end: Vector2, amount: number): Vector2; + static Dot(left: Vector2, right: Vector2): number; + static Normalize(vector: Vector2): Vector2; + static Minimize(left: Vector2, right: Vector2): Vector2; + static Maximize(left: Vector2, right: Vector2): Vector2; + static Transform(vector: Vector2, transformation: Matrix): Vector2; + static Distance(value1: Vector2, value2: Vector2): number; + static DistanceSquared(value1: Vector2, value2: Vector2): number; + } + class Vector3 { + x: number; + y: number; + z: number; + constructor(x: number, y: number, z: number); + toString(): string; + asArray(): number[]; + toArray(array: number[], index?: number): Vector3; + toQuaternion(): Quaternion; + addInPlace(otherVector: Vector3): Vector3; + add(otherVector: Vector3): Vector3; + addToRef(otherVector: Vector3, result: Vector3): Vector3; + subtractInPlace(otherVector: Vector3): Vector3; + subtract(otherVector: Vector3): Vector3; + subtractToRef(otherVector: Vector3, result: Vector3): Vector3; + subtractFromFloats(x: number, y: number, z: number): Vector3; + subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): Vector3; + negate(): Vector3; + scaleInPlace(scale: number): Vector3; + scale(scale: number): Vector3; + scaleToRef(scale: number, result: Vector3): void; + equals(otherVector: Vector3): boolean; + equalsWithEpsilon(otherVector: Vector3, epsilon?: number): boolean; + equalsToFloats(x: number, y: number, z: number): boolean; + multiplyInPlace(otherVector: Vector3): Vector3; + multiply(otherVector: Vector3): Vector3; + multiplyToRef(otherVector: Vector3, result: Vector3): Vector3; + multiplyByFloats(x: number, y: number, z: number): Vector3; + divide(otherVector: Vector3): Vector3; + divideToRef(otherVector: Vector3, result: Vector3): Vector3; + MinimizeInPlace(other: Vector3): Vector3; + MaximizeInPlace(other: Vector3): Vector3; + length(): number; + lengthSquared(): number; + normalize(): Vector3; + clone(): Vector3; + copyFrom(source: Vector3): Vector3; + copyFromFloats(x: number, y: number, z: number): Vector3; + static GetClipFactor(vector0: Vector3, vector1: Vector3, axis: Vector3, size: any): number; + static FromArray(array: number[], offset?: number): Vector3; + static FromFloatArray(array: Float32Array, offset?: number): Vector3; + static FromArrayToRef(array: number[], offset: number, result: Vector3): void; + static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector3): void; + static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void; + static Zero(): Vector3; + static Up(): Vector3; + static TransformCoordinates(vector: Vector3, transformation: Matrix): Vector3; + static TransformCoordinatesToRef(vector: Vector3, transformation: Matrix, result: Vector3): void; + static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void; + static TransformCoordinatesToRefSIMD(vector: Vector3, transformation: Matrix, result: Vector3): void; + static TransformCoordinatesFromFloatsToRefSIMD(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void; + static TransformNormal(vector: Vector3, transformation: Matrix): Vector3; + static TransformNormalToRef(vector: Vector3, transformation: Matrix, result: Vector3): void; + static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: Matrix, result: Vector3): void; + static CatmullRom(value1: Vector3, value2: Vector3, value3: Vector3, value4: Vector3, amount: number): Vector3; + static Clamp(value: Vector3, min: Vector3, max: Vector3): Vector3; + static Hermite(value1: Vector3, tangent1: Vector3, value2: Vector3, tangent2: Vector3, amount: number): Vector3; + static Lerp(start: Vector3, end: Vector3, amount: number): Vector3; + static Dot(left: Vector3, right: Vector3): number; + static Cross(left: Vector3, right: Vector3): Vector3; + static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void; + static Normalize(vector: Vector3): Vector3; + static NormalizeToRef(vector: Vector3, result: Vector3): void; + static Project(vector: Vector3, world: Matrix, transform: Matrix, viewport: Viewport): Vector3; + static UnprojectFromTransform(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, transform: Matrix): Vector3; + static Unproject(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Vector3; + static Minimize(left: Vector3, right: Vector3): Vector3; + static Maximize(left: Vector3, right: Vector3): Vector3; + static Distance(value1: Vector3, value2: Vector3): number; + static DistanceSquared(value1: Vector3, value2: Vector3): number; + static Center(value1: Vector3, value2: Vector3): Vector3; + /** + * Given three orthogonal left-handed oriented Vector3 axis in space (target system), + * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply + * to something in order to rotate it from its local system to the given target system. + */ + static RotationFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Vector3; + /** + * The same than RotationFromAxis but updates the passed ref Vector3 parameter. + */ + static RotationFromAxisToRef(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: Vector3): void; + } + class Vector4 { + x: number; + y: number; + z: number; + w: number; + constructor(x: number, y: number, z: number, w: number); + toString(): string; + asArray(): number[]; + toArray(array: number[], index?: number): Vector4; + addInPlace(otherVector: Vector4): Vector4; + add(otherVector: Vector4): Vector4; + addToRef(otherVector: Vector4, result: Vector4): Vector4; + subtractInPlace(otherVector: Vector4): Vector4; + subtract(otherVector: Vector4): Vector4; + subtractToRef(otherVector: Vector4, result: Vector4): Vector4; + subtractFromFloats(x: number, y: number, z: number, w: number): Vector4; + subtractFromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): Vector4; + negate(): Vector4; + scaleInPlace(scale: number): Vector4; + scale(scale: number): Vector4; + scaleToRef(scale: number, result: Vector4): void; + equals(otherVector: Vector4): boolean; + equalsWithEpsilon(otherVector: Vector4, epsilon?: number): boolean; + equalsToFloats(x: number, y: number, z: number, w: number): boolean; + multiplyInPlace(otherVector: Vector4): Vector4; + multiply(otherVector: Vector4): Vector4; + multiplyToRef(otherVector: Vector4, result: Vector4): Vector4; + multiplyByFloats(x: number, y: number, z: number, w: number): Vector4; + divide(otherVector: Vector4): Vector4; + divideToRef(otherVector: Vector4, result: Vector4): Vector4; + MinimizeInPlace(other: Vector4): Vector4; + MaximizeInPlace(other: Vector4): Vector4; + length(): number; + lengthSquared(): number; + normalize(): Vector4; + clone(): Vector4; + copyFrom(source: Vector4): Vector4; + copyFromFloats(x: number, y: number, z: number, w: number): Vector4; + static FromArray(array: number[], offset?: number): Vector4; + static FromArrayToRef(array: number[], offset: number, result: Vector4): void; + static FromFloatArrayToRef(array: Float32Array, offset: number, result: Vector4): void; + static FromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): void; + static Zero(): Vector4; + static Normalize(vector: Vector4): Vector4; + static NormalizeToRef(vector: Vector4, result: Vector4): void; + static Minimize(left: Vector4, right: Vector4): Vector4; + static Maximize(left: Vector4, right: Vector4): Vector4; + static Distance(value1: Vector4, value2: Vector4): number; + static DistanceSquared(value1: Vector4, value2: Vector4): number; + static Center(value1: Vector4, value2: Vector4): Vector4; + } + class Quaternion { + x: number; + y: number; + z: number; + w: number; + constructor(x?: number, y?: number, z?: number, w?: number); + toString(): string; + asArray(): number[]; + equals(otherQuaternion: Quaternion): boolean; + clone(): Quaternion; + copyFrom(other: Quaternion): Quaternion; + copyFromFloats(x: number, y: number, z: number, w: number): Quaternion; + add(other: Quaternion): Quaternion; + subtract(other: Quaternion): Quaternion; + scale(value: number): Quaternion; + multiply(q1: Quaternion): Quaternion; + multiplyToRef(q1: Quaternion, result: Quaternion): Quaternion; + length(): number; + normalize(): Quaternion; + toEulerAngles(): Vector3; + toEulerAnglesToRef(result: Vector3): Quaternion; + toRotationMatrix(result: Matrix): Quaternion; + fromRotationMatrix(matrix: Matrix): Quaternion; + static FromRotationMatrix(matrix: Matrix): Quaternion; + static FromRotationMatrixToRef(matrix: Matrix, result: Quaternion): void; + static Inverse(q: Quaternion): Quaternion; + static Identity(): Quaternion; + static RotationAxis(axis: Vector3, angle: number): Quaternion; + static FromArray(array: number[], offset?: number): Quaternion; + static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion; + static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void; + static RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion; + static RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void; + static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion; + } + class Matrix { + private static _tempQuaternion; + private static _xAxis; + private static _yAxis; + private static _zAxis; + m: Float32Array; + isIdentity(): boolean; + determinant(): number; + toArray(): Float32Array; + asArray(): Float32Array; + invert(): Matrix; + reset(): Matrix; + add(other: Matrix): Matrix; + addToRef(other: Matrix, result: Matrix): Matrix; + addToSelf(other: Matrix): Matrix; + invertToRef(other: Matrix): Matrix; + invertToRefSIMD(other: Matrix): Matrix; + setTranslation(vector3: Vector3): Matrix; + multiply(other: Matrix): Matrix; + copyFrom(other: Matrix): Matrix; + copyToArray(array: Float32Array, offset?: number): Matrix; + multiplyToRef(other: Matrix, result: Matrix): Matrix; + multiplyToArray(other: Matrix, result: Float32Array, offset: number): Matrix; + multiplyToArraySIMD(other: Matrix, result: Matrix, offset?: number): void; + equals(value: Matrix): boolean; + clone(): Matrix; + decompose(scale: Vector3, rotation: Quaternion, translation: Vector3): boolean; + static FromArray(array: number[], offset?: number): Matrix; + static FromArrayToRef(array: number[], offset: number, result: Matrix): void; + static FromFloat32ArrayToRefScaled(array: Float32Array, offset: number, scale: number, result: Matrix): void; + static FromValuesToRef(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number, result: Matrix): void; + static FromValues(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number): Matrix; + static Compose(scale: Vector3, rotation: Quaternion, translation: Vector3): Matrix; + static Identity(): Matrix; + static IdentityToRef(result: Matrix): void; + static Zero(): Matrix; + static RotationX(angle: number): Matrix; + static Invert(source: Matrix): Matrix; + static RotationXToRef(angle: number, result: Matrix): void; + static RotationY(angle: number): Matrix; + static RotationYToRef(angle: number, result: Matrix): void; + static RotationZ(angle: number): Matrix; + static RotationZToRef(angle: number, result: Matrix): void; + static RotationAxis(axis: Vector3, angle: number): Matrix; + static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix; + static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void; + static Scaling(x: number, y: number, z: number): Matrix; + static ScalingToRef(x: number, y: number, z: number, result: Matrix): void; + static Translation(x: number, y: number, z: number): Matrix; + static TranslationToRef(x: number, y: number, z: number, result: Matrix): void; + static LookAtLH(eye: Vector3, target: Vector3, up: Vector3): Matrix; + static LookAtLHToRef(eye: Vector3, target: Vector3, up: Vector3, result: Matrix): void; + static LookAtLHToRefSIMD(eyeRef: Vector3, targetRef: Vector3, upRef: Vector3, result: Matrix): void; + static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix; + static OrthoLHToRef(width: number, height: number, znear: number, zfar: number, result: Matrix): void; + static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix; + static OrthoOffCenterLHToRef(left: number, right: any, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void; + static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix; + static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix; + static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, fovMode?: number): void; + static GetFinalMatrix(viewport: Viewport, world: Matrix, view: Matrix, projection: Matrix, zmin: number, zmax: number): Matrix; + static GetAsMatrix2x2(matrix: Matrix): Float32Array; + static GetAsMatrix3x3(matrix: Matrix): Float32Array; + static Transpose(matrix: Matrix): Matrix; + static Reflection(plane: Plane): Matrix; + static ReflectionToRef(plane: Plane, result: Matrix): void; + } + class Plane { + normal: Vector3; + d: number; + constructor(a: number, b: number, c: number, d: number); + asArray(): number[]; + clone(): Plane; + normalize(): Plane; + transform(transformation: Matrix): Plane; + dotCoordinate(point: any): number; + copyFromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane; + isFrontFacingTo(direction: Vector3, epsilon: number): boolean; + signedDistanceTo(point: Vector3): number; + static FromArray(array: number[]): Plane; + static FromPoints(point1: any, point2: any, point3: any): Plane; + static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane; + static SignedDistanceToPlaneFromPositionAndNormal(origin: Vector3, normal: Vector3, point: Vector3): number; + } + class Viewport { + x: number; + y: number; + width: number; + height: number; + constructor(x: number, y: number, width: number, height: number); + toGlobal(engine: any): Viewport; + } + class Frustum { + static GetPlanes(transform: Matrix): Plane[]; + static GetPlanesToRef(transform: Matrix, frustumPlanes: Plane[]): void; + } + class Ray { + origin: Vector3; + direction: Vector3; + length: number; + private _edge1; + private _edge2; + private _pvec; + private _tvec; + private _qvec; + constructor(origin: Vector3, direction: Vector3, length?: number); + intersectsBoxMinMax(minimum: Vector3, maximum: Vector3): boolean; + intersectsBox(box: BoundingBox): boolean; + intersectsSphere(sphere: any): boolean; + intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): IntersectionInfo; + static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray; + /** + * Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be + * transformed to the given world matrix. + * @param origin The origin point + * @param end The end point + * @param world a matrix to transform the ray to. Default is the identity matrix. + */ + static CreateNewFromTo(origin: Vector3, end: Vector3, world?: Matrix): Ray; + static Transform(ray: Ray, matrix: Matrix): Ray; + } + enum Space { + LOCAL = 0, + WORLD = 1, + } + class Axis { + static X: Vector3; + static Y: Vector3; + static Z: Vector3; + } + class BezierCurve { + static interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number; + } + enum Orientation { + CW = 0, + CCW = 1, + } + class Angle { + private _radians; + constructor(radians: number); + degrees: () => number; + radians: () => number; + static BetweenTwoPoints(a: Vector2, b: Vector2): Angle; + static FromRadians(radians: number): Angle; + static FromDegrees(degrees: number): Angle; + } + class Arc2 { + startPoint: Vector2; + midPoint: Vector2; + endPoint: Vector2; + centerPoint: Vector2; + radius: number; + angle: Angle; + startAngle: Angle; + orientation: Orientation; + constructor(startPoint: Vector2, midPoint: Vector2, endPoint: Vector2); + } + class PathCursor { + private path; + private _onchange; + value: number; + animations: Animation[]; + constructor(path: Path2); + getPoint(): Vector3; + moveAhead(step?: number): PathCursor; + moveBack(step?: number): PathCursor; + move(step: number): PathCursor; + private ensureLimits(); + private markAsDirty(propertyName); + private raiseOnChange(); + onchange(f: (cursor: PathCursor) => void): PathCursor; + } + class Path2 { + private _points; + private _length; + closed: boolean; + constructor(x: number, y: number); + addLineTo(x: number, y: number): Path2; + addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments?: number): Path2; + close(): Path2; + length(): number; + getPoints(): Vector2[]; + getPointAtLengthPosition(normalizedLengthPosition: number): Vector2; + static StartingAt(x: number, y: number): Path2; + } + class Path3D { + path: Vector3[]; + private _curve; + private _distances; + private _tangents; + private _normals; + private _binormals; + private _raw; + /** + * new Path3D(path, normal, raw) + * path : an array of Vector3, the curve axis of the Path3D + * normal (optional) : Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal. + * raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed. + */ + constructor(path: Vector3[], firstNormal?: Vector3, raw?: boolean); + getCurve(): Vector3[]; + getTangents(): Vector3[]; + getNormals(): Vector3[]; + getBinormals(): Vector3[]; + getDistances(): number[]; + update(path: Vector3[], firstNormal?: Vector3): Path3D; + private _compute(firstNormal); + private _getFirstNonNullVector(index); + private _getLastNonNullVector(index); + private _normalVector(v0, vt, va); + } + class Curve3 { + private _points; + private _length; + static CreateQuadraticBezier(v0: Vector3, v1: Vector3, v2: Vector3, nbPoints: number): Curve3; + static CreateCubicBezier(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, nbPoints: number): Curve3; + static CreateHermiteSpline(p1: Vector3, t1: Vector3, p2: Vector3, t2: Vector3, nbPoints: number): Curve3; + constructor(points: Vector3[]); + getPoints(): Vector3[]; + length(): number; + continue(curve: Curve3): Curve3; + private _computeLength(path); + } + class PositionNormalVertex { + position: Vector3; + normal: Vector3; + constructor(position?: Vector3, normal?: Vector3); + clone(): PositionNormalVertex; + } + class PositionNormalTextureVertex { + position: Vector3; + normal: Vector3; + uv: Vector2; + constructor(position?: Vector3, normal?: Vector3, uv?: Vector2); + clone(): PositionNormalTextureVertex; + } + class SIMDHelper { + private static _isEnabled; + static IsEnabled: boolean; + static DisableSIMD(): void; + static EnableSIMD(): void; + } +} + +declare module BABYLON { + class AbstractMesh extends Node implements IDisposable { + private static _BILLBOARDMODE_NONE; + private static _BILLBOARDMODE_X; + private static _BILLBOARDMODE_Y; + private static _BILLBOARDMODE_Z; + private static _BILLBOARDMODE_ALL; + static BILLBOARDMODE_NONE: number; + static BILLBOARDMODE_X: number; + static BILLBOARDMODE_Y: number; + static BILLBOARDMODE_Z: number; + static BILLBOARDMODE_ALL: number; + definedFacingForward: boolean; + position: Vector3; + rotation: Vector3; + rotationQuaternion: Quaternion; + scaling: Vector3; + billboardMode: number; + visibility: number; + alphaIndex: number; + infiniteDistance: boolean; + isVisible: boolean; + isPickable: boolean; + showBoundingBox: boolean; + showSubMeshesBoundingBox: boolean; + onDispose: any; + isBlocker: boolean; + skeleton: Skeleton; + renderingGroupId: number; + material: Material; + receiveShadows: boolean; + actionManager: ActionManager; + renderOutline: boolean; + outlineColor: Color3; + outlineWidth: number; + renderOverlay: boolean; + overlayColor: Color3; + overlayAlpha: number; + hasVertexAlpha: boolean; + useVertexColors: boolean; + applyFog: boolean; + computeBonesUsingShaders: boolean; + useOctreeForRenderingSelection: boolean; + useOctreeForPicking: boolean; + useOctreeForCollisions: boolean; + layerMask: number; + alwaysSelectAsActiveMesh: boolean; + _physicImpostor: number; + _physicsMass: number; + _physicsFriction: number; + _physicRestitution: number; + private _checkCollisions; + ellipsoid: Vector3; + ellipsoidOffset: Vector3; + private _collider; + private _oldPositionForCollisions; + private _diffPositionForCollisions; + private _newPositionForCollisions; + onCollide: (collidedMesh: AbstractMesh) => void; + private _meshToBoneReferal; + edgesWidth: number; + edgesColor: Color4; + _edgesRenderer: EdgesRenderer; + private _localScaling; + private _localRotation; + private _localTranslation; + private _localBillboard; + private _localPivotScaling; + private _localPivotScalingRotation; + private _localMeshReferalTransform; + private _localWorld; + _worldMatrix: Matrix; + private _rotateYByPI; + private _absolutePosition; + private _collisionsTransformMatrix; + private _collisionsScalingMatrix; + _positions: Vector3[]; + private _isDirty; + _masterMesh: AbstractMesh; + _boundingInfo: BoundingInfo; + private _pivotMatrix; + _isDisposed: boolean; + _renderId: number; + subMeshes: SubMesh[]; + _submeshesOctree: Octree; + _intersectionsInProgress: AbstractMesh[]; + private _onAfterWorldMatrixUpdate; + private _isWorldMatrixFrozen; + _waitingActions: any; + _waitingFreezeWorldMatrix: boolean; + constructor(name: string, scene: Scene); + disableEdgesRendering(): void; + enableEdgesRendering(epsilon?: number, checkVerticesInsteadOfIndices?: boolean): void; + isBlocked: boolean; + getLOD(camera: Camera): AbstractMesh; + getTotalVertices(): number; + getIndices(): number[]; + getVerticesData(kind: string): number[]; + isVerticesDataPresent(kind: string): boolean; + getBoundingInfo(): BoundingInfo; + useBones: boolean; + _preActivate(): void; + _activate(renderId: number): void; + getWorldMatrix(): Matrix; + worldMatrixFromCache: Matrix; + absolutePosition: Vector3; + freezeWorldMatrix(): void; + unfreezeWorldMatrix(): void; + isWorldMatrixFrozen: boolean; + rotate(axis: Vector3, amount: number, space: Space): void; + translate(axis: Vector3, distance: number, space: Space): void; + getAbsolutePosition(): Vector3; + setAbsolutePosition(absolutePosition: Vector3): void; + /** + * Perform relative position change from the point of view of behind the front of the mesh. + * This is performed taking into account the meshes current rotation, so you do not have to care. + * Supports definition of mesh facing forward or backward. + * @param {number} amountRight + * @param {number} amountUp + * @param {number} amountForward + */ + movePOV(amountRight: number, amountUp: number, amountForward: number): void; + /** + * Calculate relative position change from the point of view of behind the front of the mesh. + * This is performed taking into account the meshes current rotation, so you do not have to care. + * Supports definition of mesh facing forward or backward. + * @param {number} amountRight + * @param {number} amountUp + * @param {number} amountForward + */ + calcMovePOV(amountRight: number, amountUp: number, amountForward: number): Vector3; + /** + * Perform relative rotation change from the point of view of behind the front of the mesh. + * Supports definition of mesh facing forward or backward. + * @param {number} flipBack + * @param {number} twirlClockwise + * @param {number} tiltRight + */ + rotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): void; + /** + * Calculate relative rotation change from the point of view of behind the front of the mesh. + * Supports definition of mesh facing forward or backward. + * @param {number} flipBack + * @param {number} twirlClockwise + * @param {number} tiltRight + */ + calcRotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): Vector3; + setPivotMatrix(matrix: Matrix): void; + getPivotMatrix(): Matrix; + _isSynchronized(): boolean; + _initCache(): void; + markAsDirty(property: string): void; + _updateBoundingInfo(): void; + _updateSubMeshesBoundingInfo(matrix: Matrix): void; + computeWorldMatrix(force?: boolean): Matrix; + /** + * If you'd like to be callbacked after the mesh position, rotation or scaling has been updated + * @param func: callback function to add + */ + registerAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void; + unregisterAfterWorldMatrixUpdate(func: (mesh: AbstractMesh) => void): void; + setPositionWithLocalVector(vector3: Vector3): void; + getPositionExpressedInLocalSpace(): Vector3; + locallyTranslate(vector3: Vector3): void; + lookAt(targetPoint: Vector3, yawCor: number, pitchCor: number, rollCor: number): void; + attachToBone(bone: Bone, affectedMesh: AbstractMesh): void; + detachFromBone(): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + isCompletelyInFrustum(camera?: Camera): boolean; + intersectsMesh(mesh: AbstractMesh, precise?: boolean): boolean; + intersectsPoint(point: Vector3): boolean; + setPhysicsState(impostor?: any, options?: PhysicsBodyCreationOptions): any; + getPhysicsImpostor(): number; + getPhysicsMass(): number; + getPhysicsFriction(): number; + getPhysicsRestitution(): number; + getPositionInCameraSpace(camera?: Camera): Vector3; + getDistanceToCamera(camera?: Camera): number; + applyImpulse(force: Vector3, contactPoint: Vector3): void; + setPhysicsLinkWith(otherMesh: Mesh, pivot1: Vector3, pivot2: Vector3, options?: any): void; + updatePhysicsBodyPosition(): void; + checkCollisions: boolean; + moveWithCollisions(velocity: Vector3): void; + private _onCollisionPositionChange; + /** + * This function will create an octree to help select the right submeshes for rendering, picking and collisions + * Please note that you must have a decent number of submeshes to get performance improvements when using octree + */ + createOrUpdateSubmeshesOctree(maxCapacity?: number, maxDepth?: number): Octree; + _collideForSubMesh(subMesh: SubMesh, transformMatrix: Matrix, collider: Collider): void; + _processCollisionsForSubMeshes(collider: Collider, transformMatrix: Matrix): void; + _checkCollision(collider: Collider): void; + _generatePointsArray(): boolean; + intersects(ray: Ray, fastCheck?: boolean): PickingInfo; + clone(name: string, newParent: Node, doNotCloneChildren?: boolean): AbstractMesh; + releaseSubMeshes(): void; + dispose(doNotRecurse?: boolean): void; + } +} + +declare module BABYLON { + class CSG { + private polygons; + matrix: Matrix; + position: Vector3; + rotation: Vector3; + rotationQuaternion: Quaternion; + scaling: Vector3; + static FromMesh(mesh: Mesh): CSG; + private static FromPolygons(polygons); + clone(): CSG; + private toPolygons(); + union(csg: CSG): CSG; + unionInPlace(csg: CSG): void; + subtract(csg: CSG): CSG; + subtractInPlace(csg: CSG): void; + intersect(csg: CSG): CSG; + intersectInPlace(csg: CSG): void; + inverse(): CSG; + inverseInPlace(): void; + copyTransformAttributes(csg: CSG): CSG; + buildMeshGeometry(name: string, scene: Scene, keepSubMeshes: boolean): Mesh; + toMesh(name: string, material: Material, scene: Scene, keepSubMeshes: boolean): Mesh; + } +} + +declare module BABYLON { + class Geometry implements IGetSetVerticesData { + id: string; + delayLoadState: number; + delayLoadingFile: string; + onGeometryUpdated: (geometry: Geometry, kind?: string) => void; + private _scene; + private _engine; + private _meshes; + private _totalVertices; + private _indices; + private _vertexBuffers; + private _isDisposed; + _delayInfo: any; + private _indexBuffer; + _boundingInfo: BoundingInfo; + _delayLoadingFunction: (any: any, geometry: Geometry) => void; + constructor(id: string, scene: Scene, vertexData?: VertexData, updatable?: boolean, mesh?: Mesh); + getScene(): Scene; + getEngine(): Engine; + isReady(): boolean; + setAllVerticesData(vertexData: VertexData, updatable?: boolean): void; + setVerticesData(kind: string, data: number[], updatable?: boolean, stride?: number): void; + updateVerticesDataDirectly(kind: string, data: Float32Array, offset: number): void; + updateVerticesData(kind: string, data: number[], updateExtends?: boolean): void; + getTotalVertices(): number; + getVerticesData(kind: string, copyWhenShared?: boolean): number[]; + getVertexBuffer(kind: string): VertexBuffer; + getVertexBuffers(): VertexBuffer[]; + isVerticesDataPresent(kind: string): boolean; + getVerticesDataKinds(): string[]; + setIndices(indices: number[], totalVertices?: number): void; + getTotalIndices(): number; + getIndices(copyWhenShared?: boolean): number[]; + getIndexBuffer(): any; + releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void; + applyToMesh(mesh: Mesh): void; + private _applyToMesh(mesh); + private notifyUpdate(kind?); + load(scene: Scene, onLoaded?: () => void): void; + isDisposed(): boolean; + dispose(): void; + copy(id: string): Geometry; + static ExtractFromMesh(mesh: Mesh, id: string): Geometry; + static RandomId(): string; + } + module Geometry.Primitives { + class _Primitive extends Geometry { + private _beingRegenerated; + private _canBeRegenerated; + constructor(id: string, scene: Scene, vertexData?: VertexData, canBeRegenerated?: boolean, mesh?: Mesh); + canBeRegenerated(): boolean; + regenerate(): void; + asNewGeometry(id: string): Geometry; + setAllVerticesData(vertexData: VertexData, updatable?: boolean): void; + setVerticesData(kind: string, data: number[], updatable?: boolean): void; + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Ribbon extends _Primitive { + pathArray: Vector3[][]; + closeArray: boolean; + closePath: boolean; + offset: number; + side: number; + constructor(id: string, scene: Scene, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Box extends _Primitive { + size: number; + side: number; + constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Sphere extends _Primitive { + segments: number; + diameter: number; + side: number; + constructor(id: string, scene: Scene, segments: number, diameter: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Cylinder extends _Primitive { + height: number; + diameterTop: number; + diameterBottom: number; + tessellation: number; + subdivisions: number; + side: number; + constructor(id: string, scene: Scene, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Torus extends _Primitive { + diameter: number; + thickness: number; + tessellation: number; + side: number; + constructor(id: string, scene: Scene, diameter: number, thickness: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Ground extends _Primitive { + width: number; + height: number; + subdivisions: number; + constructor(id: string, scene: Scene, width: number, height: number, subdivisions: number, canBeRegenerated?: boolean, mesh?: Mesh); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class TiledGround extends _Primitive { + xmin: number; + zmin: number; + xmax: number; + zmax: number; + subdivisions: { + w: number; + h: number; + }; + precision: { + w: number; + h: number; + }; + constructor(id: string, scene: Scene, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: { + w: number; + h: number; + }, precision: { + w: number; + h: number; + }, canBeRegenerated?: boolean, mesh?: Mesh); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class Plane extends _Primitive { + size: number; + side: number; + constructor(id: string, scene: Scene, size: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + class TorusKnot extends _Primitive { + radius: number; + tube: number; + radialSegments: number; + tubularSegments: number; + p: number; + q: number; + side: number; + constructor(id: string, scene: Scene, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, canBeRegenerated?: boolean, mesh?: Mesh, side?: number); + _regenerateVertexData(): VertexData; + copy(id: string): Geometry; + } + } +} + +declare module BABYLON { + class GroundMesh extends Mesh { + generateOctree: boolean; + private _worldInverse; + _subdivisions: number; + constructor(name: string, scene: Scene); + subdivisions: number; + optimize(chunksCount: number, octreeBlocksSize?: number): void; + getHeightAtCoordinates(x: number, z: number): number; + } +} + +declare module BABYLON { + /** + * Creates an instance based on a source mesh. + */ + class InstancedMesh extends AbstractMesh { + private _sourceMesh; + private _currentLOD; + constructor(name: string, source: Mesh); + receiveShadows: boolean; + material: Material; + visibility: number; + skeleton: Skeleton; + getTotalVertices(): number; + sourceMesh: Mesh; + getVerticesData(kind: string): number[]; + isVerticesDataPresent(kind: string): boolean; + getIndices(): number[]; + _positions: Vector3[]; + refreshBoundingInfo(): void; + _preActivate(): void; + _activate(renderId: number): void; + getLOD(camera: Camera): AbstractMesh; + _syncSubMeshes(): void; + _generatePointsArray(): boolean; + clone(name: string, newParent: Node, doNotCloneChildren?: boolean): InstancedMesh; + dispose(doNotRecurse?: boolean): void; + } +} + +declare module BABYLON { + class LinesMesh extends Mesh { + color: Color3; + alpha: number; + private _colorShader; + constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean); + material: Material; + isPickable: boolean; + checkCollisions: boolean; + _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void; + _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void; + intersects(ray: Ray, fastCheck?: boolean): any; + dispose(doNotRecurse?: boolean): void; + clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): LinesMesh; + } +} + +declare module BABYLON { + class _InstancesBatch { + mustReturn: boolean; + visibleInstances: InstancedMesh[][]; + renderSelf: boolean[]; + } + class Mesh extends AbstractMesh implements IGetSetVerticesData { + static _FRONTSIDE: number; + static _BACKSIDE: number; + static _DOUBLESIDE: number; + static _DEFAULTSIDE: number; + static _NO_CAP: number; + static _CAP_START: number; + static _CAP_END: number; + static _CAP_ALL: number; + static FRONTSIDE: number; + static BACKSIDE: number; + static DOUBLESIDE: number; + static DEFAULTSIDE: number; + static NO_CAP: number; + static CAP_START: number; + static CAP_END: number; + static CAP_ALL: number; + delayLoadState: number; + instances: InstancedMesh[]; + delayLoadingFile: string; + _binaryInfo: any; + private _LODLevels; + onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Mesh) => void; + _geometry: Geometry; + private _onBeforeRenderCallbacks; + private _onAfterRenderCallbacks; + _delayInfo: any; + _delayLoadingFunction: (any: any, mesh: Mesh) => void; + _visibleInstances: any; + private _renderIdForInstances; + private _batchCache; + private _worldMatricesInstancesBuffer; + private _worldMatricesInstancesArray; + private _instancesBufferSize; + _shouldGenerateFlatShading: boolean; + private _preActivateId; + private _sideOrientation; + private _areNormalsFrozen; + private _sourcePositions; + private _sourceNormals; + /** + * @constructor + * @param {string} name - The value used by scene.getMeshByName() to do a lookup. + * @param {Scene} scene - The scene to add this mesh to. + * @param {Node} parent - The parent of this mesh, if it has one + * @param {Mesh} source - An optional Mesh from which geometry is shared, cloned. + * @param {boolean} doNotCloneChildren - When cloning, skip cloning child meshes of source, default False. + * When false, achieved by calling a clone(), also passing False. + * This will make creation of children, recursive. + */ + constructor(name: string, scene: Scene, parent?: Node, source?: Mesh, doNotCloneChildren?: boolean); + hasLODLevels: boolean; + private _sortLODLevels(); + /** + * Add a mesh as LOD level triggered at the given distance. + * @param {number} distance - the distance from the center of the object to show this level + * @param {BABYLON.Mesh} mesh - the mesh to be added as LOD level + * @return {BABYLON.Mesh} this mesh (for chaining) + */ + addLODLevel(distance: number, mesh: Mesh): Mesh; + getLODLevelAtDistance(distance: number): Mesh; + /** + * Remove a mesh from the LOD array + * @param {BABYLON.Mesh} mesh - the mesh to be removed. + * @return {BABYLON.Mesh} this mesh (for chaining) + */ + removeLODLevel(mesh: Mesh): Mesh; + getLOD(camera: Camera, boundingSphere?: BoundingSphere): AbstractMesh; + geometry: Geometry; + getTotalVertices(): number; + getVerticesData(kind: string, copyWhenShared?: boolean): number[]; + getVertexBuffer(kind: any): VertexBuffer; + isVerticesDataPresent(kind: string): boolean; + getVerticesDataKinds(): string[]; + getTotalIndices(): number; + getIndices(copyWhenShared?: boolean): number[]; + isBlocked: boolean; + isReady(): boolean; + isDisposed(): boolean; + sideOrientation: number; + areNormalsFrozen: boolean; + /** This function affects parametric shapes on update only : ribbons, tubes, etc. It has no effect at all on other shapes */ + freezeNormals(): void; + /** This function affects parametric shapes on update only : ribbons, tubes, etc. It has no effect at all on other shapes */ + unfreezeNormals(): void; + _preActivate(): void; + _registerInstanceForRenderId(instance: InstancedMesh, renderId: number): void; + refreshBoundingInfo(): void; + _createGlobalSubMesh(): SubMesh; + subdivide(count: number): void; + setVerticesData(kind: any, data: any, updatable?: boolean, stride?: number): void; + updateVerticesData(kind: string, data: number[], updateExtends?: boolean, makeItUnique?: boolean): void; + updateVerticesDataDirectly(kind: string, data: Float32Array, offset?: number, makeItUnique?: boolean): void; + updateMeshPositions(positionFunction: any, computeNormals?: boolean): void; + makeGeometryUnique(): void; + setIndices(indices: number[], totalVertices?: number): void; + _bind(subMesh: SubMesh, effect: Effect, fillMode: number): void; + _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): void; + registerBeforeRender(func: (mesh: AbstractMesh) => void): void; + unregisterBeforeRender(func: (mesh: AbstractMesh) => void): void; + registerAfterRender(func: (mesh: AbstractMesh) => void): void; + unregisterAfterRender(func: (mesh: AbstractMesh) => void): void; + _getInstancesRenderList(subMeshId: number): _InstancesBatch; + _renderWithInstances(subMesh: SubMesh, fillMode: number, batch: _InstancesBatch, effect: Effect, engine: Engine): void; + _processRendering(subMesh: SubMesh, effect: Effect, fillMode: number, batch: _InstancesBatch, hardwareInstancedRendering: boolean, onBeforeDraw: (isInstance: boolean, world: Matrix) => void): void; + render(subMesh: SubMesh, enableAlphaMode: boolean): void; + getEmittedParticleSystems(): ParticleSystem[]; + getHierarchyEmittedParticleSystems(): ParticleSystem[]; + getChildren(): Node[]; + _checkDelayState(): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + setMaterialByID(id: string): void; + getAnimatables(): IAnimatable[]; + bakeTransformIntoVertices(transform: Matrix): void; + bakeCurrentTransformIntoVertices(): void; + _resetPointsArrayCache(): void; + _generatePointsArray(): boolean; + clone(name: string, newParent?: Node, doNotCloneChildren?: boolean): Mesh; + dispose(doNotRecurse?: boolean): void; + applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void): void; + applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number): void; + convertToFlatShadedMesh(): void; + flipFaces(flipNormals?: boolean): void; + createInstance(name: string): InstancedMesh; + synchronizeInstances(): void; + /** + * Simplify the mesh according to the given array of settings. + * Function will return immediately and will simplify async. + * @param settings a collection of simplification settings. + * @param parallelProcessing should all levels calculate parallel or one after the other. + * @param type the type of simplification to run. + * @param successCallback optional success callback to be called after the simplification finished processing all settings. + */ + simplify(settings: Array, parallelProcessing?: boolean, simplificationType?: SimplificationType, successCallback?: (mesh?: Mesh, submeshIndex?: number) => void): void; + /** + * Optimization of the mesh's indices, in case a mesh has duplicated vertices. + * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes. + * This should be used together with the simplification to avoid disappearing triangles. + * @param successCallback an optional success callback to be called after the optimization finished. + */ + optimizeIndices(successCallback?: (mesh?: Mesh) => void): void; + static CreateRibbon(name: string, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, scene: Scene, updatable?: boolean, sideOrientation?: number, ribbonInstance?: Mesh): Mesh; + static CreateDisc(name: string, radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreateBox(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreateBox(name: string, options: { + width?: number; + height?: number; + depth?: number; + faceUV?: Vector4[]; + faceColors?: Color4[]; + sideOrientation?: number; + updatable?: boolean; + }, scene: Scene): Mesh; + static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreateSphere(name: string, options: { + segments?: number; + diameterX?: number; + diameterY?: number; + diameterZ?: number; + sideOrientation?: number; + updatable?: boolean; + }, scene: any): Mesh; + static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene: Scene, updatable?: any, sideOrientation?: number): Mesh; + static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreateTorusKnot(name: string, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreateLines(name: string, points: Vector3[], scene: Scene, updatable?: boolean, linesInstance?: LinesMesh): LinesMesh; + static CreateDashedLines(name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene: Scene, updatable?: boolean, linesInstance?: LinesMesh): LinesMesh; + static ExtrudeShape(name: string, shape: Vector3[], path: Vector3[], scale: number, rotation: number, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, extrudedInstance?: Mesh): Mesh; + static ExtrudeShapeCustom(name: string, shape: Vector3[], path: Vector3[], scaleFunction: any, rotationFunction: any, ribbonCloseArray: boolean, ribbonClosePath: boolean, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, extrudedInstance?: Mesh): Mesh; + private static _ExtrudeShapeGeneric(name, shape, curve, scale, rotation, scaleFunction, rotateFunction, rbCA, rbCP, cap, custom, scene, updtbl, side, instance); + static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh; + static CreatePlane(name: string, options: { + width?: number; + height?: number; + sideOrientation?: number; + updatable?: boolean; + }, scene: Scene): Mesh; + static CreateGround(name: string, width: number, height: number, subdivisions: number, scene: Scene, updatable?: boolean): Mesh; + static CreateGround(name: string, options: { + width?: number; + height?: number; + subdivisions?: number; + sideOrientation?: number; + updatable?: boolean; + }, scene: any): Mesh; + static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: { + w: number; + h: number; + }, precision: { + w: number; + h: number; + }, scene: Scene, updatable?: boolean): Mesh; + static CreateGroundFromHeightMap(name: string, url: string, width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, scene: Scene, updatable?: boolean, onReady?: (mesh: GroundMesh) => void): GroundMesh; + static CreateTube(name: string, path: Vector3[], radius: number, tessellation: number, radiusFunction: { + (i: number, distance: number): number; + }, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, tubeInstance?: Mesh): Mesh; + static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle?: number): Mesh; + /** + * Update the vertex buffers by applying transformation from the bones + * @param {skeleton} skeleton to apply + */ + applySkeleton(skeleton: Skeleton): Mesh; + static MinMax(meshes: AbstractMesh[]): { + min: Vector3; + max: Vector3; + }; + static Center(meshesOrMinMaxVector: any): Vector3; + /** + * Merge the array of meshes into a single mesh for performance reasons. + * @param {Array} meshes - The vertices source. They should all be of the same material. Entries can empty + * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes + * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true. + * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class. + */ + static MergeMeshes(meshes: Array, disposeSource?: boolean, allow32BitsIndices?: boolean, meshSubclass?: Mesh): Mesh; + } +} + +declare module BABYLON { + interface IGetSetVerticesData { + isVerticesDataPresent(kind: string): boolean; + getVerticesData(kind: string, copyWhenShared?: boolean): number[]; + getIndices(copyWhenShared?: boolean): number[]; + setVerticesData(kind: string, data: number[], updatable?: boolean): void; + updateVerticesData(kind: string, data: number[], updateExtends?: boolean, makeItUnique?: boolean): void; + setIndices(indices: number[]): void; + } + class VertexData { + positions: number[]; + normals: number[]; + uvs: number[]; + uvs2: number[]; + uvs3: number[]; + uvs4: number[]; + uvs5: number[]; + uvs6: number[]; + colors: number[]; + matricesIndices: number[]; + matricesWeights: number[]; + indices: number[]; + set(data: number[], kind: string): void; + applyToMesh(mesh: Mesh, updatable?: boolean): void; + applyToGeometry(geometry: Geometry, updatable?: boolean): void; + updateMesh(mesh: Mesh, updateExtends?: boolean, makeItUnique?: boolean): void; + updateGeometry(geometry: Geometry, updateExtends?: boolean, makeItUnique?: boolean): void; + private _applyTo(meshOrGeometry, updatable?); + private _update(meshOrGeometry, updateExtends?, makeItUnique?); + transform(matrix: Matrix): void; + merge(other: VertexData): void; + static ExtractFromMesh(mesh: Mesh, copyWhenShared?: boolean): VertexData; + static ExtractFromGeometry(geometry: Geometry, copyWhenShared?: boolean): VertexData; + private static _ExtractFrom(meshOrGeometry, copyWhenShared?); + static CreateRibbon(pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, sideOrientation?: number): VertexData; + static CreateBox(options: { + width?: number; + height?: number; + depth?: number; + faceUV?: Vector4[]; + faceColors?: Color4[]; + sideOrientation?: number; + }): VertexData; + static CreateBox(size: number, sideOrientation?: number): VertexData; + static CreateSphere(options: { + segments?: number; + diameterX?: number; + diameterY?: number; + diameterZ?: number; + sideOrientation?: number; + }): VertexData; + static CreateSphere(segments: number, diameter?: number, sideOrientation?: number): VertexData; + static CreateCylinder(height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions?: number, sideOrientation?: number): VertexData; + static CreateTorus(diameter: any, thickness: any, tessellation: any, sideOrientation?: number): VertexData; + static CreateLines(points: Vector3[]): VertexData; + static CreateDashedLines(points: Vector3[], dashSize: number, gapSize: number, dashNb: number): VertexData; + static CreateGround(options: { + width?: number; + height?: number; + subdivisions?: number; + sideOrientation?: number; + }): VertexData; + static CreateGround(width: number, height: number, subdivisions?: number): VertexData; + static CreateTiledGround(xmin: number, zmin: number, xmax: number, zmax: number, subdivisions?: { + w: number; + h: number; + }, precision?: { + w: number; + h: number; + }): VertexData; + static CreateGroundFromHeightMap(width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, buffer: Uint8Array, bufferWidth: number, bufferHeight: number): VertexData; + static CreatePlane(options: { + width?: number; + height?: number; + sideOrientation?: number; + }): VertexData; + static CreatePlane(size: number, sideOrientation?: number): VertexData; + static CreateDisc(radius: number, tessellation: number, sideOrientation?: number): VertexData; + static CreateTorusKnot(radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, sideOrientation?: number): VertexData; + /** + * @param {any} - positions (number[] or Float32Array) + * @param {any} - indices (number[] or Uint16Array) + * @param {any} - normals (number[] or Float32Array) + */ + static ComputeNormals(positions: any, indices: any, normals: any): void; + private static _ComputeSides(sideOrientation, positions, indices, normals, uvs); + } +} + +declare module BABYLON.Internals { + class MeshLODLevel { + distance: number; + mesh: Mesh; + constructor(distance: number, mesh: Mesh); + } +} + +declare module BABYLON { + /** + * A simplifier interface for future simplification implementations. + */ + interface ISimplifier { + /** + * Simplification of a given mesh according to the given settings. + * Since this requires computation, it is assumed that the function runs async. + * @param settings The settings of the simplification, including quality and distance + * @param successCallback A callback that will be called after the mesh was simplified. + * @param errorCallback in case of an error, this callback will be called. optional. + */ + simplify(settings: ISimplificationSettings, successCallback: (simplifiedMeshes: Mesh) => void, errorCallback?: () => void): void; + } + /** + * Expected simplification settings. + * Quality should be between 0 and 1 (1 being 100%, 0 being 0%); + */ + interface ISimplificationSettings { + quality: number; + distance: number; + optimizeMesh?: boolean; + } + class SimplificationSettings implements ISimplificationSettings { + quality: number; + distance: number; + optimizeMesh: boolean; + constructor(quality: number, distance: number, optimizeMesh?: boolean); + } + interface ISimplificationTask { + settings: Array; + simplificationType: SimplificationType; + mesh: Mesh; + successCallback?: () => void; + parallelProcessing: boolean; + } + class SimplificationQueue { + private _simplificationArray; + running: any; + constructor(); + addTask(task: ISimplificationTask): void; + executeNext(): void; + runSimplification(task: ISimplificationTask): void; + private getSimplifier(task); + } + /** + * The implemented types of simplification. + * At the moment only Quadratic Error Decimation is implemented. + */ + enum SimplificationType { + QUADRATIC = 0, + } + class DecimationTriangle { + vertices: Array; + normal: Vector3; + error: Array; + deleted: boolean; + isDirty: boolean; + borderFactor: number; + deletePending: boolean; + originalOffset: number; + constructor(vertices: Array); + } + class DecimationVertex { + position: Vector3; + id: any; + q: QuadraticMatrix; + isBorder: boolean; + triangleStart: number; + triangleCount: number; + originalOffsets: Array; + constructor(position: Vector3, id: any); + updatePosition(newPosition: Vector3): void; + } + class QuadraticMatrix { + data: Array; + constructor(data?: Array); + det(a11: any, a12: any, a13: any, a21: any, a22: any, a23: any, a31: any, a32: any, a33: any): number; + addInPlace(matrix: QuadraticMatrix): void; + addArrayInPlace(data: Array): void; + add(matrix: QuadraticMatrix): QuadraticMatrix; + static FromData(a: number, b: number, c: number, d: number): QuadraticMatrix; + static DataFromNumbers(a: number, b: number, c: number, d: number): number[]; + } + class Reference { + vertexId: number; + triangleId: number; + constructor(vertexId: number, triangleId: number); + } + /** + * An implementation of the Quadratic Error simplification algorithm. + * Original paper : http://www1.cs.columbia.edu/~cs4162/html05s/garland97.pdf + * Ported mostly from QSlim and http://voxels.blogspot.de/2014/05/quadric-mesh-simplification-with-source.html to babylon JS + * @author RaananW + */ + class QuadraticErrorSimplification implements ISimplifier { + private _mesh; + private triangles; + private vertices; + private references; + private initialized; + private _reconstructedMesh; + syncIterations: number; + aggressiveness: number; + decimationIterations: number; + boundingBoxEpsilon: number; + constructor(_mesh: Mesh); + simplify(settings: ISimplificationSettings, successCallback: (simplifiedMesh: Mesh) => void): void; + private isTriangleOnBoundingBox(triangle); + private runDecimation(settings, submeshIndex, successCallback); + private initWithMesh(submeshIndex, callback, optimizeMesh?); + private init(callback); + private reconstructMesh(submeshIndex); + private initDecimatedMesh(); + private isFlipped(vertex1, vertex2, point, deletedArray, borderFactor, delTr); + private updateTriangles(origVertex, vertex, deletedArray, deletedTriangles); + private identifyBorder(); + private updateMesh(identifyBorders?); + private vertexError(q, point); + private calculateError(vertex1, vertex2, pointResult?, normalResult?, uvResult?, colorResult?); + } +} + +declare module BABYLON { + class Polygon { + static Rectangle(xmin: number, ymin: number, xmax: number, ymax: number): Vector2[]; + static Circle(radius: number, cx?: number, cy?: number, numberOfSides?: number): Vector2[]; + static Parse(input: string): Vector2[]; + static StartingAt(x: number, y: number): Path2; + } + class PolygonMeshBuilder { + private _swctx; + private _points; + private _outlinepoints; + private _holes; + private _name; + private _scene; + constructor(name: string, contours: Path2, scene: Scene); + constructor(name: string, contours: Vector2[], scene: Scene); + addHole(hole: Vector2[]): PolygonMeshBuilder; + build(updatable?: boolean, depth?: number): Mesh; + private addSide(positions, normals, uvs, indices, bounds, points, depth, flip); + } +} + +declare module BABYLON { + class SubMesh { + materialIndex: number; + verticesStart: number; + verticesCount: number; + indexStart: any; + indexCount: number; + linesIndexCount: number; + private _mesh; + private _renderingMesh; + private _boundingInfo; + private _linesIndexBuffer; + _lastColliderWorldVertices: Vector3[]; + _trianglePlanes: Plane[]; + _lastColliderTransformMatrix: Matrix; + _renderId: number; + _alphaIndex: number; + _distanceToCamera: number; + _id: number; + constructor(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: any, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean); + getBoundingInfo(): BoundingInfo; + getMesh(): AbstractMesh; + getRenderingMesh(): Mesh; + getMaterial(): Material; + refreshBoundingInfo(): void; + _checkCollision(collider: Collider): boolean; + updateBoundingInfo(world: Matrix): void; + isInFrustum(frustumPlanes: Plane[]): boolean; + render(enableAlphaMode: boolean): void; + getLinesIndexBuffer(indices: number[], engine: any): WebGLBuffer; + canIntersects(ray: Ray): boolean; + intersects(ray: Ray, positions: Vector3[], indices: number[], fastCheck?: boolean): IntersectionInfo; + clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh; + dispose(): void; + static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh): SubMesh; + } +} + +declare module BABYLON { + class VertexBuffer { + private _mesh; + private _engine; + private _buffer; + private _data; + private _updatable; + private _kind; + private _strideSize; + constructor(engine: any, data: number[], kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number); + isUpdatable(): boolean; + getData(): number[]; + getBuffer(): WebGLBuffer; + getStrideSize(): number; + create(data?: number[]): void; + update(data: number[]): void; + updateDirectly(data: Float32Array, offset: number): void; + dispose(): void; + private static _PositionKind; + private static _NormalKind; + private static _UVKind; + private static _UV2Kind; + private static _UV3Kind; + private static _UV4Kind; + private static _UV5Kind; + private static _UV6Kind; + private static _ColorKind; + private static _MatricesIndicesKind; + private static _MatricesWeightsKind; + static PositionKind: string; + static NormalKind: string; + static UVKind: string; + static UV2Kind: string; + static UV3Kind: string; + static UV4Kind: string; + static UV5Kind: string; + static UV6Kind: string; + static ColorKind: string; + static MatricesIndicesKind: string; + static MatricesWeightsKind: string; + } +} + +declare module BABYLON { + class Particle { + position: Vector3; + direction: Vector3; + color: Color4; + colorStep: Color4; + lifeTime: number; + age: number; + size: number; + angle: number; + angularSpeed: number; + copyTo(other: Particle): void; + } +} + +declare module BABYLON { + class ParticleSystem implements IDisposable { + name: string; + static BLENDMODE_ONEONE: number; + static BLENDMODE_STANDARD: number; + id: string; + renderingGroupId: number; + emitter: any; + emitRate: number; + manualEmitCount: number; + updateSpeed: number; + targetStopDuration: number; + disposeOnStop: boolean; + minEmitPower: number; + maxEmitPower: number; + minLifeTime: number; + maxLifeTime: number; + minSize: number; + maxSize: number; + minAngularSpeed: number; + maxAngularSpeed: number; + particleTexture: Texture; + layerMask: number; + onDispose: () => void; + updateFunction: (particles: Particle[]) => void; + blendMode: number; + forceDepthWrite: boolean; + gravity: Vector3; + direction1: Vector3; + direction2: Vector3; + minEmitBox: Vector3; + maxEmitBox: Vector3; + color1: Color4; + color2: Color4; + colorDead: Color4; + textureMask: Color4; + startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3) => void; + startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3) => void; + private particles; + private _capacity; + private _scene; + private _vertexDeclaration; + private _vertexStrideSize; + private _stockParticles; + private _newPartsExcess; + private _vertexBuffer; + private _indexBuffer; + private _vertices; + private _effect; + private _customEffect; + private _cachedDefines; + private _scaledColorStep; + private _colorDiff; + private _scaledDirection; + private _scaledGravity; + private _currentRenderId; + private _alive; + private _started; + private _stopped; + private _actualFrame; + private _scaledUpdateSpeed; + constructor(name: string, capacity: number, scene: Scene, customEffect?: Effect); + recycleParticle(particle: Particle): void; + getCapacity(): number; + isAlive(): boolean; + isStarted(): boolean; + start(): void; + stop(): void; + _appendParticleVertex(index: number, particle: Particle, offsetX: number, offsetY: number): void; + private _update(newParticles); + private _getEffect(); + animate(): void; + render(): number; + dispose(): void; + clone(name: string, newEmitter: any): ParticleSystem; + } +} + +declare module BABYLON { + interface IPhysicsEnginePlugin { + initialize(iterations?: number): any; + setGravity(gravity: Vector3): void; + runOneStep(delta: number): void; + registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any; + registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; + unregisterMesh(mesh: AbstractMesh): any; + applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; + createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean; + dispose(): void; + isSupported(): boolean; + updateBodyPosition(mesh: AbstractMesh): void; + } + interface PhysicsBodyCreationOptions { + mass: number; + friction: number; + restitution: number; + } + interface PhysicsCompoundBodyPart { + mesh: Mesh; + impostor: number; + } + class PhysicsEngine { + gravity: Vector3; + private _currentPlugin; + constructor(plugin?: IPhysicsEnginePlugin); + _initialize(gravity?: Vector3): void; + _runOneStep(delta: number): void; + _setGravity(gravity: Vector3): void; + _registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any; + _registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; + _unregisterMesh(mesh: AbstractMesh): void; + _applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; + _createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean; + _updateBodyPosition(mesh: AbstractMesh): void; + dispose(): void; + isSupported(): boolean; + static NoImpostor: number; + static SphereImpostor: number; + static BoxImpostor: number; + static PlaneImpostor: number; + static MeshImpostor: number; + static CapsuleImpostor: number; + static ConeImpostor: number; + static CylinderImpostor: number; + static ConvexHullImpostor: number; + static Epsilon: number; + } +} + +declare module BABYLON { + class BoundingBoxRenderer { + frontColor: Color3; + backColor: Color3; + showBackLines: boolean; + renderList: SmartArray; + private _scene; + private _colorShader; + private _vb; + private _ib; + constructor(scene: Scene); + private _prepareRessources(); + reset(): void; + render(): void; + dispose(): void; + } +} + +declare module BABYLON { + class DepthRenderer { + private _scene; + private _depthMap; + private _effect; + private _viewMatrix; + private _projectionMatrix; + private _transformMatrix; + private _worldViewProjection; + private _cachedDefines; + constructor(scene: Scene, type?: number); + isReady(subMesh: SubMesh, useInstances: boolean): boolean; + getDepthMap(): RenderTargetTexture; + dispose(): void; + } +} + +declare module BABYLON { + class EdgesRenderer { + private _source; + private _linesPositions; + private _linesNormals; + private _linesIndices; + private _epsilon; + private _indicesCount; + private _lineShader; + private _vb0; + private _vb1; + private _ib; + private _buffers; + private _checkVerticesInsteadOfIndices; + constructor(source: AbstractMesh, epsilon?: number, checkVerticesInsteadOfIndices?: boolean); + private _prepareRessources(); + dispose(): void; + private _processEdgeForAdjacencies(pa, pb, p0, p1, p2); + private _processEdgeForAdjacenciesWithVertices(pa, pb, p0, p1, p2); + private _checkEdge(faceIndex, edge, faceNormals, p0, p1); + _generateEdgesLines(): void; + render(): void; + } +} + +declare module BABYLON { + class OutlineRenderer { + private _scene; + private _effect; + private _cachedDefines; + constructor(scene: Scene); + render(subMesh: SubMesh, batch: _InstancesBatch, useOverlay?: boolean): void; + isReady(subMesh: SubMesh, useInstances: boolean): boolean; + } +} + +declare module BABYLON { + class RenderingGroup { + index: number; + private _scene; + private _opaqueSubMeshes; + private _transparentSubMeshes; + private _alphaTestSubMeshes; + private _activeVertices; + constructor(index: number, scene: Scene); + render(customRenderFunction: (opaqueSubMeshes: SmartArray, transparentSubMeshes: SmartArray, alphaTestSubMeshes: SmartArray) => void): boolean; + prepare(): void; + dispatch(subMesh: SubMesh): void; + } +} + +declare module BABYLON { + class RenderingManager { + static MAX_RENDERINGGROUPS: number; + private _scene; + private _renderingGroups; + private _depthBufferAlreadyCleaned; + constructor(scene: Scene); + private _renderParticles(index, activeMeshes); + private _renderSprites(index); + private _clearDepthBuffer(); + render(customRenderFunction: (opaqueSubMeshes: SmartArray, transparentSubMeshes: SmartArray, alphaTestSubMeshes: SmartArray) => void, activeMeshes: AbstractMesh[], renderParticles: boolean, renderSprites: boolean): void; + reset(): void; + dispatch(subMesh: SubMesh): void; + } +} + +declare module BABYLON { + class AnaglyphPostProcess extends PostProcess { + constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class BlackAndWhitePostProcess extends PostProcess { + constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class BlurPostProcess extends PostProcess { + direction: Vector2; + blurWidth: number; + constructor(name: string, direction: Vector2, blurWidth: number, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class ColorCorrectionPostProcess extends PostProcess { + private _colorTableTexture; + constructor(name: string, colorTableUrl: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class ConvolutionPostProcess extends PostProcess { + kernel: number[]; + constructor(name: string, kernel: number[], ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + static EdgeDetect0Kernel: number[]; + static EdgeDetect1Kernel: number[]; + static EdgeDetect2Kernel: number[]; + static SharpenKernel: number[]; + static EmbossKernel: number[]; + static GaussianKernel: number[]; + } +} + +declare module BABYLON { + class DisplayPassPostProcess extends PostProcess { + constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class FilterPostProcess extends PostProcess { + kernelMatrix: Matrix; + constructor(name: string, kernelMatrix: Matrix, ratio: number, camera?: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class FxaaPostProcess extends PostProcess { + texelWidth: number; + texelHeight: number; + constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class HDRRenderingPipeline extends PostProcessRenderPipeline implements IDisposable { + /** + * Public members + */ + /** + * Gaussian blur coefficient + * @type {number} + */ + gaussCoeff: number; + /** + * Gaussian blur mean + * @type {number} + */ + gaussMean: number; + /** + * Gaussian blur standard deviation + * @type {number} + */ + gaussStandDev: number; + /** + * Exposure, controls the overall intensity of the pipeline + * @type {number} + */ + exposure: number; + /** + * Minimum luminance that the post-process can output. Luminance is >= 0 + * @type {number} + */ + minimumLuminance: number; + /** + * Maximum luminance that the post-process can output. Must be suprerior to minimumLuminance + * @type {number} + */ + maximumLuminance: number; + /** + * Increase rate for luminance: eye adaptation speed to dark + * @type {number} + */ + luminanceIncreaserate: number; + /** + * Decrease rate for luminance: eye adaptation speed to bright + * @type {number} + */ + luminanceDecreaseRate: number; + /** + * Minimum luminance needed to compute HDR + * @type {number} + */ + brightThreshold: number; + /** + * Private members + */ + private _guassianBlurHPostProcess; + private _guassianBlurVPostProcess; + private _brightPassPostProcess; + private _textureAdderPostProcess; + private _downSampleX4PostProcess; + private _originalPostProcess; + private _hdrPostProcess; + private _hdrCurrentLuminance; + private _hdrOutputLuminance; + static LUM_STEPS: number; + private _downSamplePostProcesses; + private _scene; + private _needUpdate; + /** + * @constructor + * @param {string} name - The rendering pipeline name + * @param {BABYLON.Scene} scene - The scene linked to this pipeline + * @param {any} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5) + * @param {BABYLON.PostProcess} originalPostProcess - the custom original color post-process. Must be "reusable". Can be null. + * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to + */ + constructor(name: string, scene: Scene, ratio: number, originalPostProcess?: PostProcess, cameras?: Camera[]); + /** + * Tells the pipeline to update its post-processes + */ + update(): void; + /** + * Returns the current calculated luminance + */ + getCurrentLuminance(): number; + /** + * Returns the currently drawn luminance + */ + getOutputLuminance(): number; + /** + * Releases the rendering pipeline and its internal effects. Detaches pipeline from cameras + */ + dispose(): void; + /** + * Creates the HDR post-process and computes the luminance adaptation + */ + private _createHDRPostProcess(scene, ratio); + /** + * Texture Adder post-process + */ + private _createTextureAdderPostProcess(scene, ratio); + /** + * Down sample X4 post-process + */ + private _createDownSampleX4PostProcess(scene, ratio); + /** + * Bright pass post-process + */ + private _createBrightPassPostProcess(scene, ratio); + /** + * Luminance generator. Creates the luminance post-process and down sample post-processes + */ + private _createLuminanceGeneratorPostProcess(scene); + /** + * Gaussian blur post-processes. Horizontal and Vertical + */ + private _createGaussianBlurPostProcess(scene, ratio); + } +} + +declare module BABYLON { + class LensRenderingPipeline extends PostProcessRenderPipeline { + /** + * The chromatic aberration PostProcess id in the pipeline + * @type {string} + */ + LensChromaticAberrationEffect: string; + /** + * The highlights enhancing PostProcess id in the pipeline + * @type {string} + */ + HighlightsEnhancingEffect: string; + /** + * The depth-of-field PostProcess id in the pipeline + * @type {string} + */ + LensDepthOfFieldEffect: string; + private _scene; + private _depthTexture; + private _grainTexture; + private _chromaticAberrationPostProcess; + private _highlightsPostProcess; + private _depthOfFieldPostProcess; + private _edgeBlur; + private _grainAmount; + private _chromaticAberration; + private _distortion; + private _highlightsGain; + private _highlightsThreshold; + private _dofDistance; + private _dofAperture; + private _dofDarken; + private _dofPentagon; + private _blurNoise; + /** + * @constructor + * + * Effect parameters are as follow: + * { + * chromatic_aberration: number; // from 0 to x (1 for realism) + * edge_blur: number; // from 0 to x (1 for realism) + * distortion: number; // from 0 to x (1 for realism) + * grain_amount: number; // from 0 to 1 + * grain_texture: BABYLON.Texture; // texture to use for grain effect; if unset, use random B&W noise + * dof_focus_distance: number; // depth-of-field: focus distance; unset to disable (disabled by default) + * dof_aperture: number; // depth-of-field: focus blur bias (default: 1) + * dof_darken: number; // depth-of-field: darken that which is out of focus (from 0 to 1, disabled by default) + * dof_pentagon: boolean; // depth-of-field: makes a pentagon-like "bokeh" effect + * dof_gain: number; // depth-of-field: highlights gain; unset to disable (disabled by default) + * dof_threshold: number; // depth-of-field: highlights threshold (default: 1) + * blur_noise: boolean; // add a little bit of noise to the blur (default: true) + * } + * Note: if an effect parameter is unset, effect is disabled + * + * @param {string} name - The rendering pipeline name + * @param {object} parameters - An object containing all parameters (see above) + * @param {BABYLON.Scene} scene - The scene linked to this pipeline + * @param {number} ratio - The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5) + * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to + */ + constructor(name: string, parameters: any, scene: Scene, ratio?: number, cameras?: Camera[]); + setEdgeBlur(amount: number): void; + disableEdgeBlur(): void; + setGrainAmount(amount: number): void; + disableGrain(): void; + setChromaticAberration(amount: number): void; + disableChromaticAberration(): void; + setEdgeDistortion(amount: number): void; + disableEdgeDistortion(): void; + setFocusDistance(amount: number): void; + disableDepthOfField(): void; + setAperture(amount: number): void; + setDarkenOutOfFocus(amount: number): void; + enablePentagonBokeh(): void; + disablePentagonBokeh(): void; + enableNoiseBlur(): void; + disableNoiseBlur(): void; + setHighlightsGain(amount: number): void; + setHighlightsThreshold(amount: number): void; + disableHighlights(): void; + /** + * Removes the internal pipeline assets and detaches the pipeline from the scene cameras + */ + dispose(disableDepthRender?: boolean): void; + private _createChromaticAberrationPostProcess(ratio); + private _createHighlightsPostProcess(ratio); + private _createDepthOfFieldPostProcess(ratio); + private _createGrainTexture(); + } +} + +declare module BABYLON { + class PassPostProcess extends PostProcess { + constructor(name: string, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + } +} + +declare module BABYLON { + class PostProcess { + name: string; + onApply: (effect: Effect) => void; + onBeforeRender: (effect: Effect) => void; + onAfterRender: (effect: Effect) => void; + onSizeChanged: () => void; + onActivate: (camera: Camera) => void; + width: number; + height: number; + renderTargetSamplingMode: number; + clearColor: Color4; + private _camera; + private _scene; + private _engine; + private _renderRatio; + private _reusable; + private _textureType; + _textures: SmartArray; + _currentRenderTextureInd: number; + private _effect; + constructor(name: string, fragmentUrl: string, parameters: string[], samplers: string[], ratio: number | any, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean, defines?: string, textureType?: number); + isReusable(): boolean; + activate(camera: Camera, sourceTexture?: WebGLTexture): void; + apply(): Effect; + dispose(camera?: Camera): void; + } +} + +declare module BABYLON { + class PostProcessManager { + private _scene; + private _indexBuffer; + private _vertexDeclaration; + private _vertexStrideSize; + private _vertexBuffer; + constructor(scene: Scene); + private _prepareBuffers(); + _prepareFrame(sourceTexture?: WebGLTexture): boolean; + directRender(postProcesses: PostProcess[], targetTexture?: WebGLTexture): void; + _finalizeFrame(doNotPresent?: boolean, targetTexture?: WebGLTexture, postProcesses?: PostProcess[]): void; + dispose(): void; + } +} + +declare module BABYLON { + class RefractionPostProcess extends PostProcess { + color: Color3; + depth: number; + colorLevel: number; + private _refRexture; + constructor(name: string, refractionTextureUrl: string, color: Color3, depth: number, colorLevel: number, ratio: number, camera: Camera, samplingMode?: number, engine?: Engine, reusable?: boolean); + dispose(camera: Camera): void; + } +} + +declare module BABYLON { + class SSAORenderingPipeline extends PostProcessRenderPipeline { + /** + * The PassPostProcess id in the pipeline that contains the original scene color + * @type {string} + */ + SSAOOriginalSceneColorEffect: string; + /** + * The SSAO PostProcess id in the pipeline + * @type {string} + */ + SSAORenderEffect: string; + /** + * The horizontal blur PostProcess id in the pipeline + * @type {string} + */ + SSAOBlurHRenderEffect: string; + /** + * The vertical blur PostProcess id in the pipeline + * @type {string} + */ + SSAOBlurVRenderEffect: string; + /** + * The PostProcess id in the pipeline that combines the SSAO-Blur output with the original scene color (SSAOOriginalSceneColorEffect) + * @type {string} + */ + SSAOCombineRenderEffect: string; + /** + * The output strength of the SSAO post-process. Default value is 1.0. + * @type {number} + */ + totalStrength: number; + /** + * The radius around the analyzed pixel used by the SSAO post-process. Default value is 0.0002 + * @type {number} + */ + radius: number; + /** + * Related to fallOff, used to interpolate SSAO samples (first interpolate function input) based on the occlusion difference of each pixel + * Must not be equal to fallOff and superior to fallOff. + * Default value is 0.0075 + * @type {number} + */ + area: number; + /** + * Related to area, used to interpolate SSAO samples (second interpolate function input) based on the occlusion difference of each pixel + * Must not be equal to area and inferior to area. + * Default value is 0.0002 + * @type {number} + */ + fallOff: number; + private _scene; + private _depthTexture; + private _randomTexture; + private _originalColorPostProcess; + private _ssaoPostProcess; + private _blurHPostProcess; + private _blurVPostProcess; + private _ssaoCombinePostProcess; + private _firstUpdate; + /** + * @constructor + * @param {string} name - The rendering pipeline name + * @param {BABYLON.Scene} scene - The scene linked to this pipeline + * @param {any} ratio - The size of the postprocesses. Can be a number shared between passes or an object for more precision: { ssaoRatio: 0.5, combineRatio: 1.0 } + * @param {BABYLON.Camera[]} cameras - The array of cameras that the rendering pipeline will be attached to + */ + constructor(name: string, scene: Scene, ratio: any, cameras?: Camera[]); + /** + * Returns the horizontal blur PostProcess + * @return {BABYLON.BlurPostProcess} The horizontal blur post-process + */ + getBlurHPostProcess(): BlurPostProcess; + /** + * Returns the vertical blur PostProcess + * @return {BABYLON.BlurPostProcess} The vertical blur post-process + */ + getBlurVPostProcess(): BlurPostProcess; + /** + * Removes the internal pipeline assets and detatches the pipeline from the scene cameras + */ + dispose(disableDepthRender?: boolean): void; + private _createSSAOPostProcess(ratio); + private _createSSAOCombinePostProcess(ratio); + private _createRandomTexture(); + } +} + +declare module BABYLON { + class StereoscopicInterlacePostProcess extends PostProcess { + private _stepSize; + constructor(name: string, camB: Camera, postProcessA: PostProcess, isStereoscopicHoriz: boolean, samplingMode?: number); + } +} + +declare module BABYLON { + enum TonemappingOperator { + Hable = 0, + Reinhard = 1, + HejiDawson = 2, + Photographic = 3, + } + class TonemapPostProcess extends PostProcess { + private _operator; + private _exposureAdjustment; + constructor(name: string, operator: TonemappingOperator, exposureAdjustment: number, camera: Camera, samplingMode?: number, engine?: Engine, textureFormat?: number); + } +} + +declare module BABYLON { + class VolumetricLightScatteringPostProcess extends PostProcess { + private _volumetricLightScatteringPass; + private _volumetricLightScatteringRTT; + private _viewPort; + private _screenCoordinates; + private _cachedDefines; + private _customMeshPosition; + /** + * Set if the post-process should use a custom position for the light source (true) or the internal mesh position (false) + * @type {boolean} + */ + useCustomMeshPosition: boolean; + /** + * If the post-process should inverse the light scattering direction + * @type {boolean} + */ + invert: boolean; + /** + * The internal mesh used by the post-process + * @type {boolean} + */ + mesh: Mesh; + /** + * Set to true to use the diffuseColor instead of the diffuseTexture + * @type {boolean} + */ + useDiffuseColor: boolean; + /** + * Array containing the excluded meshes not rendered in the internal pass + */ + excludedMeshes: AbstractMesh[]; + /** + * Controls the overall intensity of the post-process + * @type {number} + */ + exposure: number; + /** + * Dissipates each sample's contribution in range [0, 1] + * @type {number} + */ + decay: number; + /** + * Controls the overall intensity of each sample + * @type {number} + */ + weight: number; + /** + * Controls the density of each sample + * @type {number} + */ + density: number; + /** + * @constructor + * @param {string} name - The post-process name + * @param {any} ratio - The size of the post-process and/or internal pass (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5) + * @param {BABYLON.Camera} camera - The camera that the post-process will be attached to + * @param {BABYLON.Mesh} mesh - The mesh used to create the light scattering + * @param {number} samples - The post-process quality, default 100 + * @param {number} samplingMode - The post-process filtering mode + * @param {BABYLON.Engine} engine - The babylon engine + * @param {boolean} reusable - If the post-process is reusable + * @param {BABYLON.Scene} scene - The constructor needs a scene reference to initialize internal components. If "camera" is null (RenderPipelineà, "scene" must be provided + */ + constructor(name: string, ratio: any, camera: Camera, mesh?: Mesh, samples?: number, samplingMode?: number, engine?: Engine, reusable?: boolean, scene?: Scene); + isReady(subMesh: SubMesh, useInstances: boolean): boolean; + /** + * Sets the new light position for light scattering effect + * @param {BABYLON.Vector3} The new custom light position + */ + setCustomMeshPosition(position: Vector3): void; + /** + * Returns the light position for light scattering effect + * @return {BABYLON.Vector3} The custom light position + */ + getCustomMeshPosition(): Vector3; + /** + * Disposes the internal assets and detaches the post-process from the camera + */ + dispose(camera: Camera): void; + /** + * Returns the render target texture used by the post-process + * @return {BABYLON.RenderTargetTexture} The render target texture used by the post-process + */ + getPass(): RenderTargetTexture; + private _meshExcluded(mesh); + private _createPass(scene, ratio); + private _updateMeshScreenCoordinates(scene); + /** + * Creates a default mesh for the Volumeric Light Scattering post-process + * @param {string} The mesh name + * @param {BABYLON.Scene} The scene where to create the mesh + * @return {BABYLON.Mesh} the default mesh + */ + static CreateDefaultMesh(name: string, scene: Scene): Mesh; + } +} + +declare module BABYLON { + class VRDistortionCorrectionPostProcess extends PostProcess { + aspectRatio: number; + private _isRightEye; + private _distortionFactors; + private _postProcessScaleFactor; + private _lensCenterOffset; + private _scaleIn; + private _scaleFactor; + private _lensCenter; + constructor(name: string, camera: Camera, isRightEye: boolean, vrMetrics: VRCameraMetrics); + } +} + +declare module BABYLON { + class Sprite { + name: string; + position: Vector3; + color: Color4; + width: number; + height: number; + angle: number; + cellIndex: number; + invertU: number; + invertV: number; + disposeWhenFinishedAnimating: boolean; + animations: Animation[]; + private _animationStarted; + private _loopAnimation; + private _fromIndex; + private _toIndex; + private _delay; + private _direction; + private _frameCount; + private _manager; + private _time; + size: number; + constructor(name: string, manager: SpriteManager); + playAnimation(from: number, to: number, loop: boolean, delay: number): void; + stopAnimation(): void; + _animate(deltaTime: number): void; + dispose(): void; + } +} + +declare module BABYLON { + class SpriteManager { + name: string; + cellSize: number; + sprites: Sprite[]; + renderingGroupId: number; + layerMask: number; + onDispose: () => void; + fogEnabled: boolean; + private _capacity; + private _spriteTexture; + private _epsilon; + private _scene; + private _vertexDeclaration; + private _vertexStrideSize; + private _vertexBuffer; + private _indexBuffer; + private _vertices; + private _effectBase; + private _effectFog; + constructor(name: string, imgUrl: string, capacity: number, cellSize: number, scene: Scene, epsilon?: number, samplingMode?: number); + private _appendSpriteVertex(index, sprite, offsetX, offsetY, rowSize); + render(): void; + dispose(): void; + } +} + +declare module BABYLON.Internals { + class AndOrNotEvaluator { + static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean; + private static _HandleParenthesisContent(parenthesisContent, evaluateCallback); + private static _SimplifyNegation(booleanString); + } +} + +declare module BABYLON { + interface IAssetTask { + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + run(scene: Scene, onSuccess: () => void, onError: () => void): any; + } + class MeshAssetTask implements IAssetTask { + name: string; + meshesNames: any; + rootUrl: string; + sceneFilename: string; + loadedMeshes: Array; + loadedParticleSystems: Array; + loadedSkeletons: Array; + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + constructor(name: string, meshesNames: any, rootUrl: string, sceneFilename: string); + run(scene: Scene, onSuccess: () => void, onError: () => void): void; + } + class TextFileAssetTask implements IAssetTask { + name: string; + url: string; + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + text: string; + constructor(name: string, url: string); + run(scene: Scene, onSuccess: () => void, onError: () => void): void; + } + class BinaryFileAssetTask implements IAssetTask { + name: string; + url: string; + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + data: ArrayBuffer; + constructor(name: string, url: string); + run(scene: Scene, onSuccess: () => void, onError: () => void): void; + } + class ImageAssetTask implements IAssetTask { + name: string; + url: string; + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + image: HTMLImageElement; + constructor(name: string, url: string); + run(scene: Scene, onSuccess: () => void, onError: () => void): void; + } + class TextureAssetTask implements IAssetTask { + name: string; + url: string; + noMipmap: boolean; + invertY: boolean; + samplingMode: number; + onSuccess: (task: IAssetTask) => void; + onError: (task: IAssetTask) => void; + isCompleted: boolean; + texture: Texture; + constructor(name: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number); + run(scene: Scene, onSuccess: () => void, onError: () => void): void; + } + class AssetsManager { + private _tasks; + private _scene; + private _waitingTasksCount; + onFinish: (tasks: IAssetTask[]) => void; + onTaskSuccess: (task: IAssetTask) => void; + onTaskError: (task: IAssetTask) => void; + useDefaultLoadingScreen: boolean; + constructor(scene: Scene); + addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string): IAssetTask; + addTextFileTask(taskName: string, url: string): IAssetTask; + addBinaryFileTask(taskName: string, url: string): IAssetTask; + addImageTask(taskName: string, url: string): IAssetTask; + addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode?: number): IAssetTask; + private _decreaseWaitingTasksCount(); + private _runTask(task); + reset(): AssetsManager; + load(): AssetsManager; + } +} + +declare module BABYLON { + class Database { + private callbackManifestChecked; + private currentSceneUrl; + private db; + private enableSceneOffline; + private enableTexturesOffline; + private manifestVersionFound; + private mustUpdateRessources; + private hasReachedQuota; + private isSupported; + private idbFactory; + static IsUASupportingBlobStorage: boolean; + static IDBStorageEnabled: boolean; + constructor(urlToScene: string, callbackManifestChecked: (checked: boolean) => any); + static parseURL: (url: string) => string; + static ReturnFullUrlLocation: (url: string) => string; + checkManifestFile(): void; + openAsync(successCallback: any, errorCallback: any): void; + loadImageFromDB(url: string, image: HTMLImageElement): void; + private _loadImageFromDBAsync(url, image, notInDBCallback); + private _saveImageIntoDBAsync(url, image); + private _checkVersionFromDB(url, versionLoaded); + private _loadVersionFromDBAsync(url, callback, updateInDBCallback); + private _saveVersionIntoDBAsync(url, callback); + private loadFileFromDB(url, sceneLoaded, progressCallBack, errorCallback, useArrayBuffer?); + private _loadFileFromDBAsync(url, callback, notInDBCallback, useArrayBuffer?); + private _saveFileIntoDBAsync(url, callback, progressCallback, useArrayBuffer?); + } +} + +declare module BABYLON { + class FilesInput { + private _engine; + private _currentScene; + private _canvas; + private _sceneLoadedCallback; + private _progressCallback; + private _additionnalRenderLoopLogicCallback; + private _textureLoadingCallback; + private _startingProcessingFilesCallback; + private _elementToMonitor; + static FilesTextures: any[]; + static FilesToLoad: any[]; + private _sceneFileToLoad; + private _filesToLoad; + constructor(p_engine: Engine, p_scene: Scene, p_canvas: HTMLCanvasElement, p_sceneLoadedCallback: any, p_progressCallback: any, p_additionnalRenderLoopLogicCallback: any, p_textureLoadingCallback: any, p_startingProcessingFilesCallback: any); + monitorElementForDragNDrop(p_elementToMonitor: HTMLElement): void; + private renderFunction(); + private drag(e); + private drop(eventDrop); + loadFiles(event: any): void; + reload(): void; + } +} + +declare module BABYLON { + class Gamepads { + private babylonGamepads; + private oneGamepadConnected; + private isMonitoring; + private gamepadEventSupported; + private gamepadSupportAvailable; + private _callbackGamepadConnected; + private buttonADataURL; + private static gamepadDOMInfo; + constructor(ongamedpadconnected: (gamepad: Gamepad) => void); + private _insertGamepadDOMInstructions(); + private _insertGamepadDOMNotSupported(); + dispose(): void; + private _onGamepadConnected(evt); + private _addNewGamepad(gamepad); + private _onGamepadDisconnected(evt); + private _startMonitoringGamepads(); + private _stopMonitoringGamepads(); + private _checkGamepadsStatus(); + private _updateGamepadObjects(); + } + class StickValues { + x: any; + y: any; + constructor(x: any, y: any); + } + class Gamepad { + id: string; + index: number; + browserGamepad: any; + private _leftStick; + private _rightStick; + private _onleftstickchanged; + private _onrightstickchanged; + constructor(id: string, index: number, browserGamepad: any); + onleftstickchanged(callback: (values: StickValues) => void): void; + onrightstickchanged(callback: (values: StickValues) => void): void; + leftStick: StickValues; + rightStick: StickValues; + update(): void; + } + class GenericPad extends Gamepad { + id: string; + index: number; + gamepad: any; + private _buttons; + private _onbuttondown; + private _onbuttonup; + onbuttondown(callback: (buttonPressed: number) => void): void; + onbuttonup(callback: (buttonReleased: number) => void): void; + constructor(id: string, index: number, gamepad: any); + private _setButtonValue(newValue, currentValue, buttonIndex); + update(): void; + } + enum Xbox360Button { + A = 0, + B = 1, + X = 2, + Y = 3, + Start = 4, + Back = 5, + LB = 6, + RB = 7, + LeftStick = 8, + RightStick = 9, + } + enum Xbox360Dpad { + Up = 0, + Down = 1, + Left = 2, + Right = 3, + } + class Xbox360Pad extends Gamepad { + private _leftTrigger; + private _rightTrigger; + private _onlefttriggerchanged; + private _onrighttriggerchanged; + private _onbuttondown; + private _onbuttonup; + private _ondpaddown; + private _ondpadup; + private _buttonA; + private _buttonB; + private _buttonX; + private _buttonY; + private _buttonBack; + private _buttonStart; + private _buttonLB; + private _buttonRB; + private _buttonLeftStick; + private _buttonRightStick; + private _dPadUp; + private _dPadDown; + private _dPadLeft; + private _dPadRight; + onlefttriggerchanged(callback: (value: number) => void): void; + onrighttriggerchanged(callback: (value: number) => void): void; + leftTrigger: number; + rightTrigger: number; + onbuttondown(callback: (buttonPressed: Xbox360Button) => void): void; + onbuttonup(callback: (buttonReleased: Xbox360Button) => void): void; + ondpaddown(callback: (dPadPressed: Xbox360Dpad) => void): void; + ondpadup(callback: (dPadReleased: Xbox360Dpad) => void): void; + private _setButtonValue(newValue, currentValue, buttonType); + private _setDPadValue(newValue, currentValue, buttonType); + buttonA: number; + buttonB: number; + buttonX: number; + buttonY: number; + buttonStart: number; + buttonBack: number; + buttonLB: number; + buttonRB: number; + buttonLeftStick: number; + buttonRightStick: number; + dPadUp: number; + dPadDown: number; + dPadLeft: number; + dPadRight: number; + update(): void; + } +} +interface Navigator { + getGamepads(func?: any): any; + webkitGetGamepads(func?: any): any; + msGetGamepads(func?: any): any; + webkitGamepads(func?: any): any; +} + +declare module BABYLON { + class SceneOptimization { + priority: number; + apply: (scene: Scene) => boolean; + constructor(priority?: number); + } + class TextureOptimization extends SceneOptimization { + priority: number; + maximumSize: number; + constructor(priority?: number, maximumSize?: number); + apply: (scene: Scene) => boolean; + } + class HardwareScalingOptimization extends SceneOptimization { + priority: number; + maximumScale: number; + private _currentScale; + constructor(priority?: number, maximumScale?: number); + apply: (scene: Scene) => boolean; + } + class ShadowsOptimization extends SceneOptimization { + apply: (scene: Scene) => boolean; + } + class PostProcessesOptimization extends SceneOptimization { + apply: (scene: Scene) => boolean; + } + class LensFlaresOptimization extends SceneOptimization { + apply: (scene: Scene) => boolean; + } + class ParticlesOptimization extends SceneOptimization { + apply: (scene: Scene) => boolean; + } + class RenderTargetsOptimization extends SceneOptimization { + apply: (scene: Scene) => boolean; + } + class MergeMeshesOptimization extends SceneOptimization { + static _UpdateSelectionTree: boolean; + static UpdateSelectionTree: boolean; + private _canBeMerged; + apply: (scene: Scene, updateSelectionTree?: boolean) => boolean; + } + class SceneOptimizerOptions { + targetFrameRate: number; + trackerDuration: number; + optimizations: SceneOptimization[]; + constructor(targetFrameRate?: number, trackerDuration?: number); + static LowDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions; + static ModerateDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions; + static HighDegradationAllowed(targetFrameRate?: number): SceneOptimizerOptions; + } + class SceneOptimizer { + static _CheckCurrentState(scene: Scene, options: SceneOptimizerOptions, currentPriorityLevel: number, onSuccess?: () => void, onFailure?: () => void): void; + static OptimizeAsync(scene: Scene, options?: SceneOptimizerOptions, onSuccess?: () => void, onFailure?: () => void): void; + } +} + +declare module BABYLON { + class SceneSerializer { + static Serialize(scene: Scene): any; + static SerializeMesh(toSerialize: any, withParents?: boolean, withChildren?: boolean): any; + } +} + +declare module BABYLON { + class SmartArray { + data: Array; + length: number; + private _id; + private _duplicateId; + constructor(capacity: number); + push(value: any): void; + pushNoDuplicate(value: any): void; + sort(compareFn: any): void; + reset(): void; + concat(array: any): void; + concatWithNoDuplicate(array: any): void; + indexOf(value: any): number; + private static _GlobalId; + } +} + +declare module BABYLON { + class SmartCollection { + count: number; + items: any; + private _keys; + private _initialCapacity; + constructor(capacity?: number); + add(key: any, item: any): number; + remove(key: any): number; + removeItemOfIndex(index: number): number; + indexOf(key: any): number; + item(key: any): any; + getAllKeys(): any[]; + getKeyByIndex(index: number): any; + getItemByIndex(index: number): any; + empty(): void; + forEach(block: (item: any) => void): void; + } +} + +declare module BABYLON { + class Tags { + static EnableFor(obj: any): void; + static DisableFor(obj: any): void; + static HasTags(obj: any): boolean; + static GetTags(obj: any): any; + static AddTagsTo(obj: any, tagsString: string): void; + static _AddTagTo(obj: any, tag: string): void; + static RemoveTagsFrom(obj: any, tagsString: string): void; + static _RemoveTagFrom(obj: any, tag: string): void; + static MatchesQuery(obj: any, tagsQuery: string): boolean; + } +} + +declare module BABYLON.Internals { + interface DDSInfo { + width: number; + height: number; + mipmapCount: number; + isFourCC: boolean; + isRGB: boolean; + isLuminance: boolean; + isCube: boolean; + } + class DDSTools { + static GetDDSInfo(arrayBuffer: any): DDSInfo; + private static GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer); + private static GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer); + private static GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer); + static UploadDDSLevels(gl: WebGLRenderingContext, ext: any, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number): void; + } +} + +declare module BABYLON.Internals { + class TGATools { + private static _TYPE_NO_DATA; + private static _TYPE_INDEXED; + private static _TYPE_RGB; + private static _TYPE_GREY; + private static _TYPE_RLE_INDEXED; + private static _TYPE_RLE_RGB; + private static _TYPE_RLE_GREY; + private static _ORIGIN_MASK; + private static _ORIGIN_SHIFT; + private static _ORIGIN_BL; + private static _ORIGIN_BR; + private static _ORIGIN_UL; + private static _ORIGIN_UR; + static GetTGAHeader(data: Uint8Array): any; + static UploadContent(gl: WebGLRenderingContext, data: Uint8Array): void; + static _getImageData8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + static _getImageData16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + static _getImageData24bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + static _getImageData32bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + static _getImageDataGrey8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + static _getImageDataGrey16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array; + } +} + +declare module BABYLON { + interface IAnimatable { + animations: Array; + } + interface ISize { + width: number; + height: number; + } + class Tools { + static BaseUrl: string; + static ToHex(i: number): string; + static SetImmediate(action: () => void): void; + static IsExponantOfTwo(value: number): boolean; + static GetExponantOfTwo(value: number, max: number): number; + static GetFilename(path: string): string; + static GetDOMTextContent(element: HTMLElement): string; + static ToDegrees(angle: number): number; + static ToRadians(angle: number): number; + static ExtractMinAndMaxIndexed(positions: number[], indices: number[], indexStart: number, indexCount: number): { + minimum: Vector3; + maximum: Vector3; + }; + static ExtractMinAndMax(positions: number[], start: number, count: number): { + minimum: Vector3; + maximum: Vector3; + }; + static MakeArray(obj: any, allowsNullUndefined?: boolean): Array; + static GetPointerPrefix(): string; + static QueueNewFrame(func: any): void; + static RequestFullscreen(element: any): void; + static ExitFullscreen(): void; + static CleanUrl(url: string): string; + static LoadImage(url: string, onload: any, onerror: any, database: any): HTMLImageElement; + static LoadFile(url: string, callback: (data: any) => void, progressCallBack?: () => void, database?: any, useArrayBuffer?: boolean, onError?: () => void): void; + static ReadFileAsDataURL(fileToLoad: any, callback: any, progressCallback: any): void; + static ReadFile(fileToLoad: any, callback: any, progressCallBack: any, useArrayBuffer?: boolean): void; + static Clamp(value: number, min?: number, max?: number): number; + static Sign(value: number): number; + static Format(value: number, decimals?: number): string; + static CheckExtends(v: Vector3, min: Vector3, max: Vector3): void; + static WithinEpsilon(a: number, b: number, epsilon?: number): boolean; + static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void; + static IsEmpty(obj: any): boolean; + static RegisterTopRootEvents(events: { + name: string; + handler: EventListener; + }[]): void; + static UnregisterTopRootEvents(events: { + name: string; + handler: EventListener; + }[]): void; + static DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: (data: String) => void): void; + static CreateScreenshot(engine: Engine, camera: Camera, size: any, successCallback?: (data: String) => void): void; + static ValidateXHRData(xhr: XMLHttpRequest, dataType?: number): boolean; + private static _NoneLogLevel; + private static _MessageLogLevel; + private static _WarningLogLevel; + private static _ErrorLogLevel; + private static _LogCache; + static errorsCount: number; + static OnNewCacheEntry: (entry: string) => void; + static NoneLogLevel: number; + static MessageLogLevel: number; + static WarningLogLevel: number; + static ErrorLogLevel: number; + static AllLogLevel: number; + private static _AddLogEntry(entry); + private static _FormatMessage(message); + static Log: (message: string) => void; + private static _LogDisabled(message); + private static _LogEnabled(message); + static Warn: (message: string) => void; + private static _WarnDisabled(message); + private static _WarnEnabled(message); + static Error: (message: string) => void; + private static _ErrorDisabled(message); + private static _ErrorEnabled(message); + static LogCache: string; + static ClearLogCache(): void; + static LogLevels: number; + private static _PerformanceNoneLogLevel; + private static _PerformanceUserMarkLogLevel; + private static _PerformanceConsoleLogLevel; + private static _performance; + static PerformanceNoneLogLevel: number; + static PerformanceUserMarkLogLevel: number; + static PerformanceConsoleLogLevel: number; + static PerformanceLogLevel: number; + static _StartPerformanceCounterDisabled(counterName: string, condition?: boolean): void; + static _EndPerformanceCounterDisabled(counterName: string, condition?: boolean): void; + static _StartUserMark(counterName: string, condition?: boolean): void; + static _EndUserMark(counterName: string, condition?: boolean): void; + static _StartPerformanceConsole(counterName: string, condition?: boolean): void; + static _EndPerformanceConsole(counterName: string, condition?: boolean): void; + static StartPerformanceCounter: (counterName: string, condition?: boolean) => void; + static EndPerformanceCounter: (counterName: string, condition?: boolean) => void; + static Now: number; + static GetFps(): number; + } + /** + * An implementation of a loop for asynchronous functions. + */ + class AsyncLoop { + iterations: number; + private _fn; + private _successCallback; + index: number; + private _done; + /** + * Constroctor. + * @param iterations the number of iterations. + * @param _fn the function to run each iteration + * @param _successCallback the callback that will be called upon succesful execution + * @param offset starting offset. + */ + constructor(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number); + /** + * Execute the next iteration. Must be called after the last iteration was finished. + */ + executeNext(): void; + /** + * Break the loop and run the success callback. + */ + breakLoop(): void; + /** + * Helper function + */ + static Run(iterations: number, _fn: (asyncLoop: AsyncLoop) => void, _successCallback: () => void, offset?: number): AsyncLoop; + /** + * A for-loop that will run a given number of iterations synchronous and the rest async. + * @param iterations total number of iterations + * @param syncedIterations number of synchronous iterations in each async iteration. + * @param fn the function to call each iteration. + * @param callback a success call back that will be called when iterating stops. + * @param breakFunction a break condition (optional) + * @param timeout timeout settings for the setTimeout function. default - 0. + * @constructor + */ + static SyncAsyncForLoop(iterations: number, syncedIterations: number, fn: (iteration: number) => void, callback: () => void, breakFunction?: () => boolean, timeout?: number): void; + } +} + +declare module BABYLON { + enum JoystickAxis { + X = 0, + Y = 1, + Z = 2, + } + class VirtualJoystick { + reverseLeftRight: boolean; + reverseUpDown: boolean; + deltaPosition: Vector3; + pressed: boolean; + private static _globalJoystickIndex; + private static vjCanvas; + private static vjCanvasContext; + private static vjCanvasWidth; + private static vjCanvasHeight; + private static halfWidth; + private static halfHeight; + private _action; + private _axisTargetedByLeftAndRight; + private _axisTargetedByUpAndDown; + private _joystickSensibility; + private _inversedSensibility; + private _rotationSpeed; + private _inverseRotationSpeed; + private _rotateOnAxisRelativeToMesh; + private _joystickPointerID; + private _joystickColor; + private _joystickPointerPos; + private _joystickPreviousPointerPos; + private _joystickPointerStartPos; + private _deltaJoystickVector; + private _leftJoystick; + private _joystickIndex; + private _touches; + private _onPointerDownHandlerRef; + private _onPointerMoveHandlerRef; + private _onPointerUpHandlerRef; + private _onPointerOutHandlerRef; + private _onResize; + constructor(leftJoystick?: boolean); + setJoystickSensibility(newJoystickSensibility: number): void; + private _onPointerDown(e); + private _onPointerMove(e); + private _onPointerUp(e); + /** + * Change the color of the virtual joystick + * @param newColor a string that must be a CSS color value (like "red") or the hexa value (like "#FF0000") + */ + setJoystickColor(newColor: string): void; + setActionOnTouch(action: () => any): void; + setAxisForLeftRight(axis: JoystickAxis): void; + setAxisForUpDown(axis: JoystickAxis): void; + private _clearCanvas(); + private _drawVirtualJoystick(); + releaseCanvas(): void; + } +} + +declare module BABYLON { + class VRDeviceOrientationFreeCamera extends FreeCamera { + _alpha: number; + _beta: number; + _gamma: number; + private _offsetOrientation; + private _deviceOrientationHandler; + constructor(name: string, position: Vector3, scene: Scene, compensateDistorsion?: boolean); + _onOrientationEvent(evt: DeviceOrientationEvent): void; + attachControl(element: HTMLElement, noPreventDefault?: boolean): void; + detachControl(element: HTMLElement): void; + } +} + +declare var HMDVRDevice: any; +declare var PositionSensorVRDevice: any; +declare module BABYLON { + class WebVRFreeCamera extends FreeCamera { + _hmdDevice: any; + _sensorDevice: any; + _cacheState: any; + _cacheQuaternion: Quaternion; + _cacheRotation: Vector3; + _vrEnabled: boolean; + constructor(name: string, position: Vector3, scene: Scene, compensateDistorsion?: boolean); + private _getWebVRDevices(devices); + _checkInputs(): void; + attachControl(element: HTMLElement, noPreventDefault?: boolean): void; + detachControl(element: HTMLElement): void; + } +} + +declare module BABYLON { + interface IOctreeContainer { + blocks: Array>; + } + class Octree { + maxDepth: number; + blocks: Array>; + dynamicContent: T[]; + private _maxBlockCapacity; + private _selectionContent; + private _creationFunc; + constructor(creationFunc: (entry: T, block: OctreeBlock) => void, maxBlockCapacity?: number, maxDepth?: number); + update(worldMin: Vector3, worldMax: Vector3, entries: T[]): void; + addMesh(entry: T): void; + select(frustumPlanes: Plane[], allowDuplicate?: boolean): SmartArray; + intersects(sphereCenter: Vector3, sphereRadius: number, allowDuplicate?: boolean): SmartArray; + intersectsRay(ray: Ray): SmartArray; + static _CreateBlocks(worldMin: Vector3, worldMax: Vector3, entries: T[], maxBlockCapacity: number, currentDepth: number, maxDepth: number, target: IOctreeContainer, creationFunc: (entry: T, block: OctreeBlock) => void): void; + static CreationFuncForMeshes: (entry: AbstractMesh, block: OctreeBlock) => void; + static CreationFuncForSubMeshes: (entry: SubMesh, block: OctreeBlock) => void; + } +} + +declare module BABYLON { + class OctreeBlock { + entries: T[]; + blocks: Array>; + private _depth; + private _maxDepth; + private _capacity; + private _minPoint; + private _maxPoint; + private _boundingVectors; + private _creationFunc; + constructor(minPoint: Vector3, maxPoint: Vector3, capacity: number, depth: number, maxDepth: number, creationFunc: (entry: T, block: OctreeBlock) => void); + capacity: number; + minPoint: Vector3; + maxPoint: Vector3; + addEntry(entry: T): void; + addEntries(entries: T[]): void; + select(frustumPlanes: Plane[], selection: SmartArray, allowDuplicate?: boolean): void; + intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArray, allowDuplicate?: boolean): void; + intersectsRay(ray: Ray, selection: SmartArray): void; + createInnerBlocks(): void; + } +} + +declare module BABYLON { + class ShadowGenerator { + private static _FILTER_NONE; + private static _FILTER_VARIANCESHADOWMAP; + private static _FILTER_POISSONSAMPLING; + private static _FILTER_BLURVARIANCESHADOWMAP; + static FILTER_NONE: number; + static FILTER_VARIANCESHADOWMAP: number; + static FILTER_POISSONSAMPLING: number; + static FILTER_BLURVARIANCESHADOWMAP: number; + private _filter; + blurScale: number; + private _blurBoxOffset; + private _bias; + private _lightDirection; + bias: number; + blurBoxOffset: number; + filter: number; + useVarianceShadowMap: boolean; + usePoissonSampling: boolean; + useBlurVarianceShadowMap: boolean; + private _light; + private _scene; + private _shadowMap; + private _shadowMap2; + private _darkness; + private _transparencyShadow; + private _effect; + private _viewMatrix; + private _projectionMatrix; + private _transformMatrix; + private _worldViewProjection; + private _cachedPosition; + private _cachedDirection; + private _cachedDefines; + private _currentRenderID; + private _downSamplePostprocess; + private _boxBlurPostprocess; + private _mapSize; + constructor(mapSize: number, light: IShadowLight); + isReady(subMesh: SubMesh, useInstances: boolean): boolean; + getShadowMap(): RenderTargetTexture; + getShadowMapForRendering(): RenderTargetTexture; + getLight(): IShadowLight; + getTransformMatrix(): Matrix; + getDarkness(): number; + setDarkness(darkness: number): void; + setTransparencyShadow(hasShadow: boolean): void; + private _packHalf(depth); + dispose(): void; + } +} + +declare module BABYLON.Internals { +} + +declare module BABYLON { + class BaseTexture { + name: string; + delayLoadState: number; + hasAlpha: boolean; + getAlphaFromRGB: boolean; + level: number; + isCube: boolean; + isRenderTarget: boolean; + animations: Animation[]; + onDispose: () => void; + coordinatesIndex: number; + coordinatesMode: number; + wrapU: number; + wrapV: number; + uScale: number; + vScale: number; + anisotropicFilteringLevel: number; + _cachedAnisotropicFilteringLevel: number; + private _scene; + _texture: WebGLTexture; + constructor(scene: Scene); + getScene(): Scene; + getTextureMatrix(): Matrix; + getReflectionTextureMatrix(): Matrix; + getInternalTexture(): WebGLTexture; + isReady(): boolean; + getSize(): ISize; + getBaseSize(): ISize; + scale(ratio: number): void; + canRescale: boolean; + _removeFromCache(url: string, noMipmap: boolean): void; + _getFromCache(url: string, noMipmap: boolean, sampling?: number): WebGLTexture; + delayLoad(): void; + releaseInternalTexture(): void; + clone(): BaseTexture; + dispose(): void; + } +} + +declare module BABYLON { + class CubeTexture extends BaseTexture { + url: string; + coordinatesMode: number; + private _noMipmap; + private _extensions; + private _textureMatrix; + constructor(rootUrl: string, scene: Scene, extensions?: string[], noMipmap?: boolean); + clone(): CubeTexture; + delayLoad(): void; + getReflectionTextureMatrix(): Matrix; + } +} + +declare module BABYLON { + class DynamicTexture extends Texture { + private _generateMipMaps; + private _canvas; + private _context; + constructor(name: string, options: any, scene: Scene, generateMipMaps: boolean, samplingMode?: number); + canRescale: boolean; + scale(ratio: number): void; + getContext(): CanvasRenderingContext2D; + clear(): void; + update(invertY?: boolean): void; + drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string, invertY?: boolean, update?: boolean): void; + clone(): DynamicTexture; + } +} + +declare module BABYLON { + class MirrorTexture extends RenderTargetTexture { + mirrorPlane: Plane; + private _transformMatrix; + private _mirrorMatrix; + private _savedViewMatrix; + constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean); + clone(): MirrorTexture; + } +} + +declare module BABYLON { + class RawTexture extends Texture { + format: number; + constructor(data: ArrayBufferView, width: number, height: number, format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number); + update(data: ArrayBufferView): void; + static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; + static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; + static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; + static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; + static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; + } +} + +declare module BABYLON { + class RenderTargetTexture extends Texture { + renderList: AbstractMesh[]; + renderParticles: boolean; + renderSprites: boolean; + coordinatesMode: number; + onBeforeRender: () => void; + onAfterRender: () => void; + onAfterUnbind: () => void; + onClear: (engine: Engine) => void; + activeCamera: Camera; + customRenderFunction: (opaqueSubMeshes: SmartArray, transparentSubMeshes: SmartArray, alphaTestSubMeshes: SmartArray, beforeTransparents?: () => void) => void; + private _size; + _generateMipMaps: boolean; + private _renderingManager; + _waitingRenderList: string[]; + private _doNotChangeAspectRatio; + private _currentRefreshId; + private _refreshRate; + constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, doNotChangeAspectRatio?: boolean, type?: number); + resetRefreshCounter(): void; + refreshRate: number; + _shouldRender(): boolean; + isReady(): boolean; + getRenderSize(): number; + canRescale: boolean; + scale(ratio: number): void; + resize(size: any, generateMipMaps?: boolean): void; + render(useCameraPostProcess?: boolean, dumpForDebug?: boolean): void; + clone(): RenderTargetTexture; + } +} + +declare module BABYLON { + class Texture extends BaseTexture { + static NEAREST_SAMPLINGMODE: number; + static BILINEAR_SAMPLINGMODE: number; + static TRILINEAR_SAMPLINGMODE: number; + static EXPLICIT_MODE: number; + static SPHERICAL_MODE: number; + static PLANAR_MODE: number; + static CUBIC_MODE: number; + static PROJECTION_MODE: number; + static SKYBOX_MODE: number; + static CLAMP_ADDRESSMODE: number; + static WRAP_ADDRESSMODE: number; + static MIRROR_ADDRESSMODE: number; + url: string; + uOffset: number; + vOffset: number; + uScale: number; + vScale: number; + uAng: number; + vAng: number; + wAng: number; + private _noMipmap; + _invertY: boolean; + private _rowGenerationMatrix; + private _cachedTextureMatrix; + private _projectionModeMatrix; + private _t0; + private _t1; + private _t2; + private _cachedUOffset; + private _cachedVOffset; + private _cachedUScale; + private _cachedVScale; + private _cachedUAng; + private _cachedVAng; + private _cachedWAng; + private _cachedCoordinatesMode; + _samplingMode: number; + private _buffer; + private _deleteBuffer; + constructor(url: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void, buffer?: any, deleteBuffer?: boolean); + delayLoad(): void; + updateSamplingMode(samplingMode: number): void; + private _prepareRowForTextureGeneration(x, y, z, t); + getTextureMatrix(): Matrix; + getReflectionTextureMatrix(): Matrix; + clone(): Texture; + static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode?: number, onLoad?: () => void, onError?: () => void): Texture; + } +} + +declare module BABYLON { + class VideoTexture extends Texture { + video: HTMLVideoElement; + private _autoLaunch; + private _lastUpdate; + constructor(name: string, urls: string[], scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number); + update(): boolean; + } +} + +declare module BABYLON { + class CannonJSPlugin implements IPhysicsEnginePlugin { + checkWithEpsilon: (value: number) => number; + private _world; + private _registeredMeshes; + private _physicsMaterials; + initialize(iterations?: number): void; + private _checkWithEpsilon(value); + runOneStep(delta: number): void; + setGravity(gravity: Vector3): void; + registerMesh(mesh: AbstractMesh, impostor: number, options?: PhysicsBodyCreationOptions): any; + private _createSphere(radius, mesh, options?); + private _createBox(x, y, z, mesh, options?); + private _createPlane(mesh, options?); + private _createConvexPolyhedron(rawVerts, rawFaces, mesh, options?); + private _addMaterial(friction, restitution); + private _createRigidBodyFromShape(shape, mesh, mass, friction, restitution); + registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; + private _unbindBody(body); + unregisterMesh(mesh: AbstractMesh): void; + applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; + updateBodyPosition: (mesh: AbstractMesh) => void; + createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3): boolean; + dispose(): void; + isSupported(): boolean; + } +} + +declare module BABYLON { + class OimoJSPlugin implements IPhysicsEnginePlugin { + private _world; + private _registeredMeshes; + private _checkWithEpsilon(value); + initialize(iterations?: number): void; + setGravity(gravity: Vector3): void; + registerMesh(mesh: AbstractMesh, impostor: number, options: PhysicsBodyCreationOptions): any; + registerMeshesAsCompound(parts: PhysicsCompoundBodyPart[], options: PhysicsBodyCreationOptions): any; + private _createBodyAsCompound(part, options, initialMesh); + unregisterMesh(mesh: AbstractMesh): void; + private _unbindBody(body); + /** + * Update the body position according to the mesh position + * @param mesh + */ + updateBodyPosition: (mesh: AbstractMesh) => void; + applyImpulse(mesh: AbstractMesh, force: Vector3, contactPoint: Vector3): void; + createLink(mesh1: AbstractMesh, mesh2: AbstractMesh, pivot1: Vector3, pivot2: Vector3, options?: any): boolean; + dispose(): void; + isSupported(): boolean; + private _getLastShape(body); + runOneStep(time: number): void; + } +} + +declare module BABYLON { + class PostProcessRenderEffect { + private _engine; + private _postProcesses; + private _getPostProcess; + private _singleInstance; + private _cameras; + private _indicesForCamera; + private _renderPasses; + private _renderEffectAsPasses; + _name: string; + applyParameters: (postProcess: PostProcess) => void; + constructor(engine: Engine, name: string, getPostProcess: () => PostProcess, singleInstance?: boolean); + _update(): void; + addPass(renderPass: PostProcessRenderPass): void; + removePass(renderPass: PostProcessRenderPass): void; + addRenderEffectAsPass(renderEffect: PostProcessRenderEffect): void; + getPass(passName: string): void; + emptyPasses(): void; + _attachCameras(cameras: Camera): any; + _attachCameras(cameras: Camera[]): any; + _detachCameras(cameras: Camera): any; + _detachCameras(cameras: Camera[]): any; + _enable(cameras: Camera): any; + _enable(cameras: Camera[]): any; + _disable(cameras: Camera): any; + _disable(cameras: Camera[]): any; + getPostProcess(camera?: Camera): PostProcess; + private _linkParameters(); + private _linkTextures(effect); + } +} + +declare module BABYLON { + class PostProcessRenderPass { + private _enabled; + private _renderList; + private _renderTexture; + private _scene; + private _refCount; + _name: string; + constructor(scene: Scene, name: string, size: number, renderList: Mesh[], beforeRender: () => void, afterRender: () => void); + _incRefCount(): number; + _decRefCount(): number; + _update(): void; + setRenderList(renderList: Mesh[]): void; + getRenderTexture(): RenderTargetTexture; + } +} + +declare module BABYLON { + class PostProcessRenderPipeline { + private _engine; + private _renderEffects; + private _renderEffectsForIsolatedPass; + private _cameras; + _name: string; + private static PASS_EFFECT_NAME; + private static PASS_SAMPLER_NAME; + constructor(engine: Engine, name: string); + addEffect(renderEffect: PostProcessRenderEffect): void; + _enableEffect(renderEffectName: string, cameras: Camera): any; + _enableEffect(renderEffectName: string, cameras: Camera[]): any; + _disableEffect(renderEffectName: string, cameras: Camera): any; + _disableEffect(renderEffectName: string, cameras: Camera[]): any; + _attachCameras(cameras: Camera, unique: boolean): any; + _attachCameras(cameras: Camera[], unique: boolean): any; + _detachCameras(cameras: Camera): any; + _detachCameras(cameras: Camera[]): any; + _enableDisplayOnlyPass(passName: any, cameras: Camera): any; + _enableDisplayOnlyPass(passName: any, cameras: Camera[]): any; + _disableDisplayOnlyPass(cameras: Camera): any; + _disableDisplayOnlyPass(cameras: Camera[]): any; + _update(): void; + } +} + +declare module BABYLON { + class PostProcessRenderPipelineManager { + private _renderPipelines; + constructor(); + addPipeline(renderPipeline: PostProcessRenderPipeline): void; + attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera, unique?: boolean): any; + attachCamerasToRenderPipeline(renderPipelineName: string, cameras: Camera[], unique?: boolean): any; + detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera): any; + detachCamerasFromRenderPipeline(renderPipelineName: string, cameras: Camera[]): any; + enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any; + enableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any; + disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera): any; + disableEffectInPipeline(renderPipelineName: string, renderEffectName: string, cameras: Camera[]): any; + enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera): any; + enableDisplayOnlyPassInPipeline(renderPipelineName: string, passName: string, cameras: Camera[]): any; + disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera): any; + disableDisplayOnlyPassInPipeline(renderPipelineName: string, cameras: Camera[]): any; + update(): void; + } +} + +declare module BABYLON { + class CustomProceduralTexture extends ProceduralTexture { + private _animate; + private _time; + private _config; + private _texturePath; + constructor(name: string, texturePath: any, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + private loadJson(jsonUrl); + isReady(): boolean; + render(useCameraPostProcess?: boolean): void; + updateTextures(): void; + updateShaderUniforms(): void; + animate: boolean; + } +} + +declare module BABYLON { + class ProceduralTexture extends Texture { + private _size; + _generateMipMaps: boolean; + isEnabled: boolean; + private _doNotChangeAspectRatio; + private _currentRefreshId; + private _refreshRate; + private _vertexBuffer; + private _indexBuffer; + private _effect; + private _vertexDeclaration; + private _vertexStrideSize; + private _uniforms; + private _samplers; + private _fragment; + _textures: Texture[]; + private _floats; + private _floatsArrays; + private _colors3; + private _colors4; + private _vectors2; + private _vectors3; + private _matrices; + private _fallbackTexture; + private _fallbackTextureUsed; + constructor(name: string, size: any, fragment: any, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + reset(): void; + isReady(): boolean; + resetRefreshCounter(): void; + setFragment(fragment: any): void; + refreshRate: number; + _shouldRender(): boolean; + getRenderSize(): number; + resize(size: any, generateMipMaps: any): void; + private _checkUniform(uniformName); + setTexture(name: string, texture: Texture): ProceduralTexture; + setFloat(name: string, value: number): ProceduralTexture; + setFloats(name: string, value: number[]): ProceduralTexture; + setColor3(name: string, value: Color3): ProceduralTexture; + setColor4(name: string, value: Color4): ProceduralTexture; + setVector2(name: string, value: Vector2): ProceduralTexture; + setVector3(name: string, value: Vector3): ProceduralTexture; + setMatrix(name: string, value: Matrix): ProceduralTexture; + render(useCameraPostProcess?: boolean): void; + clone(): ProceduralTexture; + dispose(): void; + } +} + +declare module BABYLON { + class WoodProceduralTexture extends ProceduralTexture { + private _ampScale; + private _woodColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + ampScale: number; + woodColor: Color3; + } + class FireProceduralTexture extends ProceduralTexture { + private _time; + private _speed; + private _autoGenerateTime; + private _fireColors; + private _alphaThreshold; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + render(useCameraPostProcess?: boolean): void; + static PurpleFireColors: Color3[]; + static GreenFireColors: Color3[]; + static RedFireColors: Color3[]; + static BlueFireColors: Color3[]; + fireColors: Color3[]; + time: number; + speed: Vector2; + alphaThreshold: number; + } + class CloudProceduralTexture extends ProceduralTexture { + private _skyColor; + private _cloudColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + skyColor: Color4; + cloudColor: Color4; + } + class GrassProceduralTexture extends ProceduralTexture { + private _grassColors; + private _herb1; + private _herb2; + private _herb3; + private _groundColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + grassColors: Color3[]; + groundColor: Color3; + } + class RoadProceduralTexture extends ProceduralTexture { + private _roadColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + roadColor: Color3; + } + class BrickProceduralTexture extends ProceduralTexture { + private _numberOfBricksHeight; + private _numberOfBricksWidth; + private _jointColor; + private _brickColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + numberOfBricksHeight: number; + numberOfBricksWidth: number; + jointColor: Color3; + brickColor: Color3; + } + class MarbleProceduralTexture extends ProceduralTexture { + private _numberOfTilesHeight; + private _numberOfTilesWidth; + private _amplitude; + private _marbleColor; + private _jointColor; + constructor(name: string, size: number, scene: Scene, fallbackTexture?: Texture, generateMipMaps?: boolean); + updateShaderUniforms(): void; + numberOfTilesHeight: number; + numberOfTilesWidth: number; + jointColor: Color3; + marbleColor: Color3; + } +} diff --git a/backbone-relational/backbone-relational.d.ts b/backbone-relational/backbone-relational.d.ts index 4f4aa45cc..af8e4e31f 100644 --- a/backbone-relational/backbone-relational.d.ts +++ b/backbone-relational/backbone-relational.d.ts @@ -35,15 +35,15 @@ declare module Backbone { toJSON():any; - setup(); + static setup(); - build(attributes:any, options?:any); + static build(attributes:any, options?:any); - findOrCreate(attributes:string, options?:any); + static findOrCreate(attributes:string, options?:any); - findOrCreate(attributes:number, options?:any); + static findOrCreate(attributes:number, options?:any); - findOrCreate(attributes:any, options?:any); + static findOrCreate(attributes:any, options?:any); } export class Relation extends Model { @@ -147,13 +147,13 @@ declare module Backbone { resolveIdForItem(type:any, item:any):any; - find(type:any, item:string):RelationalModel; + static find(type:any, item:string):RelationalModel; - find(type:any, item:number):RelationalModel; + static find(type:any, item:number):RelationalModel; - find(type:any, item:RelationalModel):RelationalModel; + static find(type:any, item:RelationalModel):RelationalModel; - find(type:any, item:any):RelationalModel; + static find(type:any, item:any):RelationalModel; register(model:RelationalModel):void; @@ -169,3 +169,4 @@ declare module Backbone { } } + diff --git a/backbone.localstorage/backbone.localstorage-tests.ts b/backbone.localstorage/backbone.localstorage-tests.ts new file mode 100644 index 000000000..0d44897a8 --- /dev/null +++ b/backbone.localstorage/backbone.localstorage-tests.ts @@ -0,0 +1,6 @@ +/// + +var store: Store = new Store('testStore'); +store.findAll(); + +store.save(); diff --git a/backbone.localstorage/backbone.localstorage.d.ts b/backbone.localstorage/backbone.localstorage.d.ts new file mode 100644 index 000000000..122c47587 --- /dev/null +++ b/backbone.localstorage/backbone.localstorage.d.ts @@ -0,0 +1,51 @@ +// Type definitions for backbone.localStorage 1.0.0 +// Project: https://github.com/jeromegn/Backbone.localStorage +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Backbone { + interface Serializer { + serialize(item: any): any; + deserialize(data: any): any; + } + + class LocalStorage { + name: string; + serializer: Serializer; + records: string[]; + + constructor(name: string, serializer?: Serializer); + + save(): void; + + // Add a model, giving it a (hopefully)-unique GUID, if it doesn't already + // have an id of it's own. + create(model: any): any; + + // Update a model by replacing its copy in `this.data`. + update(model: any): any; + + // Retrieve a model from `this.data` by id. + find(model: any): any; + + // Return the array of all models currently in storage. + findAll(): any; + + // Delete a model from `this.data`, returning it. + destroy(model: T): T; + + localStorage(): any; + + // Clear localStorage for specific collection. + _clear(): void; + + _storageSize(): number; + + _itemName(id: any): string; + } +} + +import Store = Backbone.LocalStorage; + diff --git a/backbone/backbone-global.d.ts b/backbone/backbone-global.d.ts index 764aa83d7..c16e1a59e 100644 --- a/backbone/backbone-global.d.ts +++ b/backbone/backbone-global.d.ts @@ -43,6 +43,7 @@ declare module Backbone { interface PersistenceOptions { url?: string; + data?: any; beforeSend?: (jqxhr: JQueryXHR) => void; success?: (modelOrCollection?: any, response?: any, options?: any) => void; error?: (modelOrCollection?: any, jqxhr?: JQueryXHR, options?: any) => void; diff --git a/bcrypt-nodejs/bcrypt-nodejs-tests.ts b/bcrypt-nodejs/bcrypt-nodejs-tests.ts new file mode 100644 index 000000000..2a151c1c7 --- /dev/null +++ b/bcrypt-nodejs/bcrypt-nodejs-tests.ts @@ -0,0 +1,30 @@ +/// + +import bCrypt = require("bcrypt-nodejs"); + +function test_sync() { + var salt1 = bCrypt.genSaltSync(); + var salt2 = bCrypt.genSaltSync(8); + + var hash1 = bCrypt.hashSync('super secret'); + var hash2 = bCrypt.hashSync('super secret', salt1); + + var compare1 = bCrypt.compareSync('super secret', hash1); + + var rounds1 = bCrypt.getRounds(hash2); +} + +function test_async() { + var cbString = (error: Error, result: string) => {}; + var cbVoid = () => {}; + var cbBoolean = (error: Error, result: boolean) => {}; + + bCrypt.genSalt(8, cbString); + + var salt = bCrypt.genSaltSync(); + bCrypt.hash('super secret', salt, cbString); + bCrypt.hash('super secret', salt, cbVoid, cbString); + + var hash = bCrypt.hashSync('super secret'); + bCrypt.compare('super secret', hash, cbBoolean); +} \ No newline at end of file diff --git a/bcrypt-nodejs/bcrypt-nodejs.d.ts b/bcrypt-nodejs/bcrypt-nodejs.d.ts new file mode 100644 index 000000000..32b735d68 --- /dev/null +++ b/bcrypt-nodejs/bcrypt-nodejs.d.ts @@ -0,0 +1,68 @@ +// Type definitions for bcrypt-nodejs +// Project: https://github.com/shaneGirish/bcrypt-nodejs +// Definitions by: David Broder-Rodgers +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "bcrypt-nodejs" { + /** + * Generate a salt synchronously + * @param rounds Number of rounds to process the data for (default - 10) + * @return Generated salt + */ + export function genSaltSync(rounds?: number): string; + + /** + * Generate a salt asynchronously + * @param rounds Number of rounds to process the data for (default - 10) + * @param callback Callback with error and resulting salt, to be fired once the salt has been generated + */ + export function genSalt(rounds: number, callback: (error: Error, result: string) => void): void; + + /** + * Generate a hash synchronously + * @param data Data to be encrypted + * @param salt Salt to be used in encryption (default - new salt generated with 10 rounds) + * @return Generated hash + */ + export function hashSync(data: string, salt?: string): string; + + /** + * Generate a hash asynchronously + * @param data Data to be encrypted + * @param salt Salt to be used in encryption + * @param callback Callback with error and hashed result, to be fired once the data has been encrypted + */ + export function hash(data: string, salt: string, callback: (error: Error, result: string) => void): void; + + /** + * Generate a hash asynchronously + * @param data Data to be encrypted + * @param salt Salt to be used in encryption + * @param progressCallback Callback to be fired multiple times during the hash calculation to signify progress + * @param callback Callback with error and hashed result, to be fired once the data has been encrypted + */ + export function hash(data: string, salt: string, progressCallback: () => void, callback: (error: Error, result: string) => void): void; + + /** + * Compares data with a hash synchronously + * @param data Data to be compared + * @param hash Hash to be compared to + * @return true if matching, false otherwise + */ + export function compareSync(data: string, hash: string): boolean; + + /** + * Compares data with a hash asynchronously + * @param data Data to be compared + * @param hash Hash to be compared to + * @param callback Callback with error and match result, to be fired once the data has been compared + */ + export function compare(data: string, hash: string, callback: (error: Error, result: boolean) => void): void; + + /** + * Get number of rounds used for hash + * @param hash Hash from which the number of rounds used should be extracted + * @return number of rounds used to encrypt a given hash + */ + export function getRounds(hash: string): number; +} diff --git a/bezier-easing/bezier-easing-tests.ts b/bezier-easing/bezier-easing-tests.ts new file mode 100644 index 000000000..eab1fb4f1 --- /dev/null +++ b/bezier-easing/bezier-easing-tests.ts @@ -0,0 +1,21 @@ +/// + +function test_create_from_array() { + let easing: BezierEasing = BezierEasing([0, 0, 1, 0.5]); +} + +function test_create_from_params() { + let easing: BezierEasing = BezierEasing(0, 0, 1, 0.5); +} + +function test_create_from_builtins() { + let easing: BezierEasing = BezierEasing.css['ease-in']; +} + +function test_methods() { + let easing: BezierEasing = BezierEasing.css['ease-in']; + let easedRatio: number = easing.get(0.5); + let points: Array = easing.getPoints(); + let stringified: string = easing.toString(); + let asCSS: string = easing.toCSS(); +} diff --git a/bezier-easing/bezier-easing.d.ts b/bezier-easing/bezier-easing.d.ts new file mode 100644 index 000000000..695368e7a --- /dev/null +++ b/bezier-easing/bezier-easing.d.ts @@ -0,0 +1,24 @@ +// Type definitions for bezier-easing +// Project: https://github.com/gre/bezier-easing +// Definitions by: brian ridley +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare interface BezierEasing { + get(ratio: number): number; + getPoints(): Array; + toString(): string; + toCSS(): string; +} + +declare function BezierEasing(points: Array): BezierEasing; +declare function BezierEasing(a: number, b: number, c: number, d: number): BezierEasing; + +declare namespace BezierEasing { + let css: { + 'ease': BezierEasing, + 'linear': BezierEasing, + 'ease-in': BezierEasing, + 'ease-out': BezierEasing, + 'ease-in-out': BezierEasing + }; +} diff --git a/bluebird/bluebird-tests.ts b/bluebird/bluebird-tests.ts index bd4f46fc4..b1829c52e 100644 --- a/bluebird/bluebird-tests.ts +++ b/bluebird/bluebird-tests.ts @@ -85,15 +85,15 @@ var bazProm: Promise; // - - - - - - - - - - - - - - - - - -var numThen: Promise.Thenable; -var strThen: Promise.Thenable; -var anyThen: Promise.Thenable; -var boolThen: Promise.Thenable; -var objThen: Promise.Thenable; -var voidThen: Promise.Thenable; +var numThen: PromiseLike; +var strThen: PromiseLike; +var anyThen: PromiseLike; +var boolThen: PromiseLike; +var objThen: PromiseLike; +var voidThen: PromiseLike; -var fooThen: Promise.Thenable; -var barThen: Promise.Thenable; +var fooThen: PromiseLike; +var barThen: PromiseLike; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -106,12 +106,12 @@ var barArrProm: Promise; // - - - - - - - - - - - - - - - - - -var numArrThen: Promise.Thenable; -var strArrThen: Promise.Thenable; -var anyArrThen: Promise.Thenable; +var numArrThen: PromiseLike; +var strArrThen: PromiseLike; +var anyArrThen: PromiseLike; -var fooArrThen: Promise.Thenable; -var barArrThen: Promise.Thenable; +var fooArrThen: PromiseLike; +var barArrThen: PromiseLike; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -124,18 +124,18 @@ var barPromArr: Promise[]; // - - - - - - - - - - - - - - - - - -var numThenArr: Promise.Thenable[]; -var strThenArr: Promise.Thenable[]; -var anyThenArr: Promise.Thenable[]; +var numThenArr: PromiseLike[]; +var strThenArr: PromiseLike[]; +var anyThenArr: PromiseLike[]; -var fooThenArr: Promise.Thenable[]; -var barThenArr: Promise.Thenable[]; +var fooThenArr: PromiseLike[]; +var barThenArr: PromiseLike[]; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // booya! -var fooThenArrThen: Promise.Thenable[]>; -var barThenArrThen: Promise.Thenable[]>; +var fooThenArrThen: PromiseLike[]>; +var barThenArrThen: PromiseLike[]>; var fooResolver: Promise.Resolver; var barResolver: Promise.Resolver; @@ -607,19 +607,19 @@ Promise.all([fooProm, barProm, fooProm]).then(result => { //TODO fix collection inference -barArrProm = fooProm.map((item: Foo, index: number, arrayLength: number) => { +barArrProm = fooArrProm.map((item: Foo, index: number, arrayLength: number) => { return bar; }); -barArrProm = fooProm.map((item: Foo) => { +barArrProm = fooArrProm.map((item: Foo) => { return bar; }); -barArrProm = fooProm.map((item: Foo, index: number, arrayLength: number) => { +barArrProm = fooArrProm.map((item: Foo, index: number, arrayLength: number) => { return bar; }, { concurrency: 1 }); -barArrProm = fooProm.map((item: Foo) => { +barArrProm = fooArrProm.map((item: Foo) => { return bar; }, { concurrency: 1 @@ -627,10 +627,20 @@ barArrProm = fooProm.map((item: Foo) => { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -barProm = fooProm.reduce((memo: Bar, item: Foo, index: number, arrayLength: number) => { +barArrProm = fooArrProm.mapSeries((item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = fooArrProm.mapSeries((item: Foo) => { + return bar; +}); + + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +barProm = fooArrProm.reduce((memo: Bar, item: Foo, index: number, arrayLength: number) => { return memo; }); -barProm = fooProm.reduce((memo: Bar, item: Foo) => { +barProm = fooArrProm.reduce((memo: Bar, item: Foo) => { return memo; }, bar); @@ -756,6 +766,13 @@ func = Promise.promisify(f, obj); obj = Promise.promisifyAll(obj); anyProm = Promise.fromNode(callback => nodeCallbackFunc(callback)); anyProm = Promise.fromNode(callback => nodeCallbackFuncErrorOnly(callback)); +anyProm = Promise.fromNode(callback => nodeCallbackFunc(callback), {multiArgs : true}); +anyProm = Promise.fromNode(callback => nodeCallbackFuncErrorOnly(callback), {multiArgs : true}); + +anyProm = Promise.fromCallback(callback => nodeCallbackFunc(callback)); +anyProm = Promise.fromCallback(callback => nodeCallbackFuncErrorOnly(callback)); +anyProm = Promise.fromCallback(callback => nodeCallbackFunc(callback), {multiArgs : true}); +anyProm = Promise.fromCallback(callback => nodeCallbackFuncErrorOnly(callback), {multiArgs : true}); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1008,6 +1025,81 @@ barArrProm = Promise.map(fooArr, (item: Foo, index: number, arrayLength: number) concurrency: 1 }); +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// mapSeries() + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooThenArrThen + +barArrProm = Promise.mapSeries(fooThenArrThen, (item: Foo) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooThenArrThen, (item: Foo) => { + return barThen; +}); +barArrProm = Promise.mapSeries(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooArrThen + +barArrProm = Promise.mapSeries(fooArrThen, (item: Foo) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooArrThen, (item: Foo) => { + return barThen; +}); +barArrProm = Promise.mapSeries(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}); + + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooThenArr + +barArrProm = Promise.mapSeries(fooThenArr, (item: Foo) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooThenArr, (item: Foo) => { + return barThen; +}); +barArrProm = Promise.mapSeries(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}); + + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooArr + +barArrProm = Promise.mapSeries(fooArr, (item: Foo) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooArr, (item: Foo) => { + return barThen; +}); +barArrProm = Promise.mapSeries(fooArr, (item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooArr, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}); + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // reduce() diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index f3420957a..023eab7aa 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -1,6 +1,6 @@ // Type definitions for bluebird 2.0.0 // Project: https://github.com/petkaantonov/bluebird -// Definitions by: Bart van der Schoor +// Definitions by: Bart van der Schoor , falsandtru // Definitions: https://github.com/borisyankov/DefinitelyTyped // ES6 model with generics overload was sourced and trans-multiplied from es6-promises.d.ts @@ -16,737 +16,767 @@ // TODO verify support to have no return statement in handlers to get a Promise (more overloads?) -declare class Promise implements Promise.Thenable, Promise.Inspection { - /** - * Create a new promise. The passed in function will receive functions `resolve` and `reject` as its arguments which can be called to seal the fate of the created promise. - */ - constructor(callback: (resolve: (thenableOrResult?: R | Promise.Thenable) => void, reject: (error: any) => void) => void); - - /** - * Promises/A+ `.then()` with progress handler. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise. - */ - then(onFulfill: (value: R) => U|Promise.Thenable, onReject?: (error: any) => U|Promise.Thenable, onProgress?: (note: any) => any): Promise; - then(onFulfill: (value: R) => U|Promise.Thenable, onReject?: (error: any) => void|Promise.Thenable, onProgress?: (note: any) => any): Promise; - - /** - * This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler. - * - * Alias `.caught();` for compatibility with earlier ECMAScript version. - */ - catch(onReject?: (error: any) => R|Promise.Thenable|void|Promise.Thenable): Promise; - caught(onReject?: (error: any) => R|Promise.Thenable|void|Promise.Thenable): Promise; - - catch(onReject?: (error: any) => U|Promise.Thenable): Promise; - caught(onReject?: (error: any) => U|Promise.Thenable): Promise; - - /** - * This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called. - * - * This method also supports predicate-based filters. If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument. The return result of the predicate will be used determine whether the error handler should be called. - * - * Alias `.caught();` for compatibility with earlier ECMAScript version. - */ - catch(predicate: (error: any) => boolean, onReject: (error: any) => R|Promise.Thenable|void|Promise.Thenable): Promise; - caught(predicate: (error: any) => boolean, onReject: (error: any) => R|Promise.Thenable|void|Promise.Thenable): Promise; - - catch(predicate: (error: any) => boolean, onReject: (error: any) => U|Promise.Thenable): Promise; - caught(predicate: (error: any) => boolean, onReject: (error: any) => U|Promise.Thenable): Promise; - - catch(ErrorClass: Function, onReject: (error: any) => R|Promise.Thenable|void|Promise.Thenable): Promise; - caught(ErrorClass: Function, onReject: (error: any) => R|Promise.Thenable|void|Promise.Thenable): Promise; - - catch(ErrorClass: Function, onReject: (error: any) => U|Promise.Thenable): Promise; - caught(ErrorClass: Function, onReject: (error: any) => U|Promise.Thenable): Promise; - - - /** - * Like `.catch` but instead of catching all types of exceptions, it only catches those that don't originate from thrown errors but rather from explicit rejections. - */ - error(onReject: (reason: any) => Promise.Thenable): Promise; - error(onReject: (reason: any) => U): Promise; - - /** - * Pass a handler that will be called regardless of this promise's fate. Returns a new promise chained from this promise. There are special semantics for `.finally()` in that the final value cannot be modified from the handler. - * - * Alias `.lastly();` for compatibility with earlier ECMAScript version. - */ - finally(handler: () => Promise.Thenable): Promise; - finally(handler: () => U): Promise; - - lastly(handler: () => Promise.Thenable): Promise; - lastly(handler: () => U): Promise; - - /** - * Create a promise that follows this promise, but is bound to the given `thisArg` value. A bound promise will call its handlers with the bound value set to `this`. Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise. - */ - bind(thisArg: any): Promise; - - /** - * Like `.then()`, but any unhandled rejection that ends up here will be thrown as an error. - */ - done(onFulfilled: (value: R) => Promise.Thenable, onRejected: (error: any) => Promise.Thenable, onProgress?: (note: any) => any): void; - done(onFulfilled: (value: R) => Promise.Thenable, onRejected?: (error: any) => U, onProgress?: (note: any) => any): void; - done(onFulfilled: (value: R) => U, onRejected: (error: any) => Promise.Thenable, onProgress?: (note: any) => any): void; - done(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U, onProgress?: (note: any) => any): void; - - /** - * Like `.finally()`, but not called for rejections. - */ - tap(onFulFill: (value: R) => Promise.Thenable): Promise; - tap(onFulfill: (value: R) => U): Promise; - - /** - * Shorthand for `.then(null, null, handler);`. Attach a progress handler that will be called if this promise is progressed. Returns a new promise chained from this promise. - */ - progressed(handler: (note: any) => any): Promise; - - /** - * Same as calling `Promise.delay(this, ms)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - delay(ms: number): Promise; - - /** - * Returns a promise that will be fulfilled with this promise's fulfillment value or rejection reason. However, if this promise is not fulfilled or rejected within `ms` milliseconds, the returned promise is rejected with a `Promise.TimeoutError` instance. - * - * You may specify a custom error message with the `message` parameter. - */ - timeout(ms: number, message?: string): Promise; - - /** - * Register a node-style callback on this promise. When this promise is is either fulfilled or rejected, the node callback will be called back with the node.js convention where error reason is the first argument and success value is the second argument. The error argument will be `null` in case of success. - * Returns back this promise instead of creating a new one. If the `callback` argument is not a function, this method does not do anything. - */ - nodeify(callback: (err: any, value?: R) => void, options?: Promise.SpreadOption): Promise; - nodeify(...sink: any[]): Promise; - - /** - * Marks this promise as cancellable. Promises by default are not cancellable after v0.11 and must be marked as such for `.cancel()` to have any effect. Marking a promise as cancellable is infectious and you don't need to remark any descendant promise. - */ - cancellable(): Promise; - - /** - * Cancel this promise. The cancellation will propagate to farthest cancellable ancestor promise which is still pending. - * - * That ancestor will then be rejected with a `CancellationError` (get a reference from `Promise.CancellationError`) object as the rejection reason. - * - * In a promise rejection handler you may check for a cancellation by seeing if the reason object has `.name === "Cancel"`. - * - * Promises are by default not cancellable. Use `.cancellable()` to mark a promise as cancellable. - */ - // TODO what to do with this? - cancel(reason?: any): Promise; - - /** - * Like `.then()`, but cancellation of the the returned promise or any of its descendant will not propagate cancellation to this promise or this promise's ancestors. - */ - fork(onFulfilled: (value: R) => Promise.Thenable, onRejected: (error: any) => Promise.Thenable, onProgress?: (note: any) => any): Promise; - fork(onFulfilled: (value: R) => Promise.Thenable, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise; - fork(onFulfilled: (value: R) => U, onRejected: (error: any) => Promise.Thenable, onProgress?: (note: any) => any): Promise; - fork(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise; - - /** - * Create an uncancellable promise based on this promise. - */ - uncancellable(): Promise; - - /** - * See if this promise can be cancelled. - */ - isCancellable(): boolean; - - /** - * See if this `promise` has been fulfilled. - */ - isFulfilled(): boolean; - - /** - * See if this `promise` has been rejected. - */ - isRejected(): boolean; - - /** - * See if this `promise` is still defer. - */ - isPending(): boolean; - - /** - * See if this `promise` is resolved -> either fulfilled or rejected. - */ - isResolved(): boolean; - - /** - * Get the fulfillment value of the underlying promise. Throws if the promise isn't fulfilled yet. - * - * throws `TypeError` - */ - value(): R; - - /** - * Get the rejection reason for the underlying promise. Throws if the promise isn't rejected yet. - * - * throws `TypeError` - */ - reason(): any; - - /** - * Synchronously inspect the state of this `promise`. The `PromiseInspection` will represent the state of the promise as snapshotted at the time of calling `.inspect()`. - */ - inspect(): Promise.Inspection; - - /** - * This is a convenience method for doing: - * - * - * promise.then(function(obj){ - * return obj[propertyName].call(obj, arg...); - * }); - * - */ - call(propertyName: string, ...args: any[]): Promise; - - /** - * This is a convenience method for doing: - * - * - * promise.then(function(obj){ - * return obj[propertyName]; - * }); - * - */ - // TODO find way to fix get() - // get(propertyName: string): Promise; - - /** - * Convenience method for: - * - * - * .then(function() { - * return value; - * }); - * - * - * in the case where `value` doesn't change its value. That means `value` is bound at the time of calling `.return()` - * - * Alias `.thenReturn();` for compatibility with earlier ECMAScript version. - */ - return(): Promise; - thenReturn(): Promise; - return(value: U): Promise; - thenReturn(value: U): Promise; - - /** - * Convenience method for: - * - * - * .then(function() { - * throw reason; - * }); - * - * Same limitations apply as with `.return()`. - * - * Alias `.thenThrow();` for compatibility with earlier ECMAScript version. - */ - throw(reason: Error): Promise; - thenThrow(reason: Error): Promise; - - /** - * Convert to String. - */ - toString(): string; - - /** - * This is implicitly called by `JSON.stringify` when serializing the object. Returns a serialized representation of the `Promise`. - */ - toJSON(): Object; - - /** - * Like calling `.then`, but the fulfillment value or rejection reason is assumed to be an array, which is flattened to the formal parameters of the handlers. - */ - // TODO how to model instance.spread()? like Q? - spread(onFulfill: Function, onReject?: (reason: any) => Promise.Thenable): Promise; - spread(onFulfill: Function, onReject?: (reason: any) => U): Promise; - /* - // TODO or something like this? - spread(onFulfill: (...values: W[]) => Promise.Thenable, onReject?: (reason: any) => Promise.Thenable): Promise; - spread(onFulfill: (...values: W[]) => Promise.Thenable, onReject?: (reason: any) => U): Promise; - spread(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => Promise.Thenable): Promise; - spread(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => U): Promise; - */ - /** - * Same as calling `Promise.all(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - all(): Promise; - - /** - * Same as calling `Promise.props(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO how to model instance.props()? - props(): Promise; - - /** - * Same as calling `Promise.settle(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - settle(): Promise[]>; - - /** - * Same as calling `Promise.any(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - any(): Promise; - - /** - * Same as calling `Promise.some(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - some(count: number): Promise; - - /** - * Same as calling `Promise.race(thisPromise, count)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - race(): Promise; - - /** - * Same as calling `Promise.map(thisPromise, mapper)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - map(mapper: (item: Q, index: number, arrayLength: number) => Promise.Thenable, options?: Promise.ConcurrencyOption): Promise; - map(mapper: (item: Q, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; - - /** - * Same as calling `Promise.reduce(thisPromise, Function reducer, initialValue)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - reduce(reducer: (memo: U, item: Q, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; - reduce(reducer: (memo: U, item: Q, index: number, arrayLength: number) => U, initialValue?: U): Promise; - - /** - * Same as calling ``Promise.filter(thisPromise, filterer)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - filter(filterer: (item: U, index: number, arrayLength: number) => Promise.Thenable, options?: Promise.ConcurrencyOption): Promise; - filter(filterer: (item: U, index: number, arrayLength: number) => boolean, options?: Promise.ConcurrencyOption): Promise; - - /** - * Same as calling ``Promise.each(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - each(iterator: (item: R, index: number, arrayLength: number) => U | Promise.Thenable): Promise; - - /** - * Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise. - * - * Note about second argument: if it's specifically a true array, its values become respective arguments for the function call. Otherwise it is passed as is as the first argument for the function call. - * - * Alias for `attempt();` for compatibility with earlier ECMAScript version. - */ - static try(fn: () => Promise.Thenable, args?: any[], ctx?: any): Promise; - static try(fn: () => R, args?: any[], ctx?: any): Promise; - - static attempt(fn: () => Promise.Thenable, args?: any[], ctx?: any): Promise; - static attempt(fn: () => R, args?: any[], ctx?: any): Promise; - - /** - * Returns a new function that wraps the given function `fn`. The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function. - * This method is convenient when a function can sometimes return synchronously or throw synchronously. - */ - static method(fn: Function): Function; - - /** - * Create a promise that is resolved with the given `value`. If `value` is a thenable or promise, the returned promise will assume its state. - */ - static resolve(): Promise; - static resolve(value: Promise.Thenable): Promise; - static resolve(value: R): Promise; - - /** - * Create a promise that is rejected with the given `reason`. - */ - static reject(reason: any): Promise; - static reject(reason: any): Promise; - - /** - * Create a promise with undecided fate and return a `PromiseResolver` to control it. See resolution?: Promise(#promise-resolution). - */ - static defer(): Promise.Resolver; - - /** - * Cast the given `value` to a trusted promise. If `value` is already a trusted `Promise`, it is returned as is. If `value` is not a thenable, a fulfilled is: Promise returned with `value` as its fulfillment value. If `value` is a thenable (Promise-like object, like those returned by jQuery's `$.ajax`), returns a trusted that: Promise assimilates the state of the thenable. - */ - static cast(value: Promise.Thenable): Promise; - static cast(value: R): Promise; - - /** - * Sugar for `Promise.resolve(undefined).bind(thisArg);`. See `.bind()`. - */ - static bind(thisArg: any): Promise; - - /** - * See if `value` is a trusted Promise. - */ - static is(value: any): boolean; - - /** - * Call this right after the library is loaded to enabled long stack traces. Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have alread been created. Long stack traces imply a substantial performance penalty, around 4-5x for throughput and 0.5x for latency. - */ - static longStackTraces(): void; - - /** - * Returns a promise that will be fulfilled with `value` (or `undefined`) after given `ms` milliseconds. If `value` is a promise, the delay will start counting down when it is fulfilled and the returned promise will be fulfilled with the fulfillment value of the `value` promise. - */ - // TODO enable more overloads - static delay(value: Promise.Thenable, ms: number): Promise; - static delay(value: R, ms: number): Promise; - static delay(ms: number): Promise; - - /** - * Returns a function that will wrap the given `nodeFunction`. Instead of taking a callback, the returned function will return a promise whose fate is decided by the callback behavior of the given node function. The node function should conform to node.js convention of accepting a callback as last argument and calling that callback with error as the first argument and success value on the second argument. - * - * If the `nodeFunction` calls its callback with multiple success values, the fulfillment value will be an array of them. - * - * If you pass a `receiver`, the `nodeFunction` will be called as a method on the `receiver`. - */ - static promisify(func: (callback: (err:any, result: T) => void) => void, receiver?: any): () => Promise; - static promisify(func: (arg1: A1, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1) => Promise; - static promisify(func: (arg1: A1, arg2: A2, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2) => Promise; - static promisify(func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3) => Promise; - static promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Promise; - static promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Promise; - static promisify(nodeFunction: Function, receiver?: any): Function; - - /** - * Promisifies the entire object by going through the object's properties and creating an async equivalent of each function on the object and its prototype chain. The promisified method name will be the original method name postfixed with `Async`. Returns the input object. - * - * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method. - */ - // TODO how to model promisifyAll? - static promisifyAll(target: Object, options?: Promise.PromisifyAllOptions): any; - - - /** - * Returns a promise that is resolved by a node style callback function. - */ - static fromNode(resolver: (callback: (err: any, result?: any) => void) => void): Promise; - - /** - * Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. - */ - // TODO fix coroutine GeneratorFunction - static coroutine(generatorFunction: Function): Function; - - /** - * Spawn a coroutine which may yield promises to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. - */ - // TODO fix spawn GeneratorFunction - static spawn(generatorFunction: Function): Promise; - - /** - * This is relevant to browser environments with no module loader. - * - * Release control of the `Promise` namespace to whatever it was before this library was loaded. Returns a reference to the library namespace so you can attach it to something else. - */ - static noConflict(): typeof Promise; - - /** - * Add `handler` as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or `console.error` in browsers. - * - * Passing no value or a non-function will have the effect of removing any kind of handling for possibly unhandled rejections. - */ - static onPossiblyUnhandledRejection(handler: (reason: any) => any): void; - - /** - * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are fulfilled. The promise's fulfillment value is an array with fulfillment values at respective positions to the original array. If any promise in the array rejects, the returned promise is rejected with the rejection reason. - */ - // TODO enable more overloads - // promise of array with promises of value - static all(values: Promise.Thenable[]>): Promise; - // promise of array with values - static all(values: Promise.Thenable): Promise; - // array with promises of value - static all(values: Promise.Thenable[]): Promise; +declare var Promise: PromiseConstructor; + +interface PromiseConstructor { + /** + * Create a new promise. The passed in function will receive functions `resolve` and `reject` as its arguments which can be called to seal the fate of the created promise. + */ + new (callback: (resolve: (thenableOrResult?: T | PromiseLike) => void, reject: (error: any) => void) => void): Promise; + + // Ideally, we'd define e.g. "export class RangeError extends Error {}", + // but as Error is defined as an interface (not a class), TypeScript doesn't + // allow extending Error, only implementing it. + // However, if we want to catch() only a specific error type, we need to pass + // a constructor function to it. So, as a workaround, we define them here as such. + RangeError(): RangeError; + CancellationError(): Promise.CancellationError; + TimeoutError(): Promise.TimeoutError; + TypeError(): Promise.TypeError; + RejectionError(): Promise.RejectionError; + OperationalError(): Promise.OperationalError; + + /** + * Changes how bluebird schedules calls a-synchronously. + * + * @param scheduler Should be a function that asynchronously schedules + * the calling of the passed in function + */ + setScheduler(scheduler: (callback: (...args: any[]) => void) => void): void; + + /** + * Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise. + * + * Note about second argument: if it's specifically a true array, its values become respective arguments for the function call. Otherwise it is passed as is as the first argument for the function call. + * + * Alias for `attempt();` for compatibility with earlier ECMAScript version. + */ + try(fn: () => PromiseLike, args?: any[], ctx?: any): Promise; + try(fn: () => T, args?: any[], ctx?: any): Promise; + + attempt(fn: () => PromiseLike, args?: any[], ctx?: any): Promise; + attempt(fn: () => T, args?: any[], ctx?: any): Promise; + + /** + * Returns a new function that wraps the given function `fn`. The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function. + * This method is convenient when a function can sometimes return synchronously or throw synchronously. + */ + method(fn: Function): Function; + + /** + * Create a promise that is resolved with the given `value`. If `value` is a thenable or promise, the returned promise will assume its state. + */ + resolve(): Promise; + resolve(value: PromiseLike): Promise; + resolve(value: T): Promise; + + /** + * Create a promise that is rejected with the given `reason`. + */ + reject(reason: any): Promise; + reject(reason: any): Promise; + + /** + * Create a promise with undecided fate and return a `PromiseResolver` to control it. See resolution?: Promise(#promise-resolution). + */ + defer(): Promise.Resolver; + + /** + * Cast the given `value` to a trusted promise. If `value` is already a trusted `Promise`, it is returned as is. If `value` is not a thenable, a fulfilled is: Promise returned with `value` as its fulfillment value. If `value` is a thenable (Promise-like object, like those returned by jQuery's `$.ajax`), returns a trusted that: Promise assimilates the state of the thenable. + */ + cast(value: PromiseLike): Promise; + cast(value: T): Promise; + + /** + * Sugar for `Promise.resolve(undefined).bind(thisArg);`. See `.bind()`. + */ + bind(thisArg: any): Promise; + + /** + * See if `value` is a trusted Promise. + */ + is(value: any): boolean; + + /** + * Call this right after the library is loaded to enabled long stack traces. Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have alread been created. Long stack traces imply a substantial performance penalty, around 4-5x for throughput and 0.5x for latency. + */ + longStackTraces(): void; + + /** + * Returns a promise that will be fulfilled with `value` (or `undefined`) after given `ms` milliseconds. If `value` is a promise, the delay will start counting down when it is fulfilled and the returned promise will be fulfilled with the fulfillment value of the `value` promise. + */ + // TODO enable more overloads + delay(value: PromiseLike, ms: number): Promise; + delay(value: T, ms: number): Promise; + delay(ms: number): Promise; + + /** + * Returns a function that will wrap the given `nodeFunction`. Instead of taking a callback, the returned function will return a promise whose fate is decided by the callback behavior of the given node function. The node function should conform to node.js convention of accepting a callback as last argument and calling that callback with error as the first argument and success value on the second argument. + * + * If the `nodeFunction` calls its callback with multiple success values, the fulfillment value will be an array of them. + * + * If you pass a `receiver`, the `nodeFunction` will be called as a method on the `receiver`. + */ + promisify(func: (callback: (err: any, result: T) => void) => void, receiver?: any): () => Promise; + promisify(func: (arg1: A1, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1) => Promise; + promisify(func: (arg1: A1, arg2: A2, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2) => Promise; + promisify(func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3) => Promise; + promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Promise; + promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Promise; + promisify(nodeFunction: Function, receiver?: any): Function; + + /** + * Promisifies the entire object by going through the object's properties and creating an async equivalent of each function on the object and its prototype chain. The promisified method name will be the original method name postfixed with `Async`. Returns the input object. + * + * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method. + */ + // TODO how to model promisifyAll? + promisifyAll(target: Object, options?: Promise.PromisifyAllOptions): any; + + + /** + * Returns a promise that is resolved by a node style callback function. + */ + fromNode(resolver: (callback: (err: any, result?: any) => void) => void, options? : {multiArgs? : boolean}): Promise; + fromCallback(resolver: (callback: (err: any, result?: any) => void) => void, options? : {multiArgs? : boolean}): Promise; + + /** + * Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. + */ + // TODO fix coroutine GeneratorFunction + coroutine(generatorFunction: Function): Function; + + /** + * Spawn a coroutine which may yield promises to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. + */ + // TODO fix spawn GeneratorFunction + spawn(generatorFunction: Function): Promise; + + /** + * This is relevant to browser environments with no module loader. + * + * Release control of the `Promise` namespace to whatever it was before this library was loaded. Returns a reference to the library namespace so you can attach it to something else. + */ + noConflict(): typeof Promise; + + /** + * Add `handler` as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or `console.error` in browsers. + * + * Passing no value or a non-function will have the effect of removing any kind of handling for possibly unhandled rejections. + */ + onPossiblyUnhandledRejection(handler: (reason: any) => any): void; + + /** + * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are fulfilled. The promise's fulfillment value is an array with fulfillment values at respective positions to the original array. If any promise in the array rejects, the returned promise is rejected with the rejection reason. + */ + // TODO enable more overloads + // promise of array with promises of value + all(values: PromiseLike[]>): Promise; + // promise of array with values + all(values: PromiseLike): Promise; + // array with promises of value + all(values: PromiseLike[]): Promise; // array with promises of different types - static all(values: [Promise.Thenable, Promise.Thenable]): Promise<[T1, T2]>; - static all(values: [Promise.Thenable, Promise.Thenable, Promise.Thenable]): Promise<[T1, T2, T3]>; - static all(values: [Promise.Thenable, Promise.Thenable, Promise.Thenable, Promise.Thenable]): Promise<[T1, T2, T3, T4]>; - static all(values: [Promise.Thenable, Promise.Thenable, Promise.Thenable, Promise.Thenable, Promise.Thenable]): Promise<[T1, T2, T3, T4, T5]>; - // array with values - static all(values: R[]): Promise; + all(values: [PromiseLike, PromiseLike]): Promise<[T1, T2]>; + all(values: [PromiseLike, PromiseLike, PromiseLike]): Promise<[T1, T2, T3]>; + all(values: [PromiseLike, PromiseLike, PromiseLike, PromiseLike]): Promise<[T1, T2, T3, T4]>; + all(values: [PromiseLike, PromiseLike, PromiseLike, PromiseLike, PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; + // array with values + all(values: T[]): Promise; - /** - * Like ``Promise.all`` but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled. The promise's fulfillment value is an object with fulfillment values at respective keys to the original object. If any promise in the object rejects, the returned promise is rejected with the rejection reason. - * - * If `object` is a trusted `Promise`, then it will be treated as a promise for object rather than for its properties. All other objects are treated for their properties as is returned by `Object.keys` - the object's own enumerable properties. - * - * *The original object is not modified.* - */ - // TODO verify this is correct - // trusted promise for object - static props(object: Promise): Promise; - // object - static props(object: Object): Promise; + /** + * Like ``Promise.all`` but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled. The promise's fulfillment value is an object with fulfillment values at respective keys to the original object. If any promise in the object rejects, the returned promise is rejected with the rejection reason. + * + * If `object` is a trusted `Promise`, then it will be treated as a promise for object rather than for its properties. All other objects are treated for their properties as is returned by `Object.keys` - the object's own enumerable properties. + * + * *The original object is not modified.* + */ + // TODO verify this is correct + // trusted promise for object + props(object: Promise): Promise; + // object + props(object: Object): Promise; - /** - * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are either fulfilled or rejected. The fulfillment value is an array of ``PromiseInspection`` instances at respective positions in relation to the input array. - * - * *original: The array is not modified. The input array sparsity is retained in the resulting array.* - */ - // promise of array with promises of value - static settle(values: Promise.Thenable[]>): Promise[]>; - // promise of array with values - static settle(values: Promise.Thenable): Promise[]>; - // array with promises of value - static settle(values: Promise.Thenable[]): Promise[]>; - // array with values - static settle(values: R[]): Promise[]>; + /** + * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are either fulfilled or rejected. The fulfillment value is an array of ``PromiseInspection`` instances at respective positions in relation to the input array. + * + * *original: The array is not modified. The input array sparsity is retained in the resulting array.* + */ + // promise of array with promises of value + settle(values: PromiseLike[]>): Promise[]>; + // promise of array with values + settle(values: PromiseLike): Promise[]>; + // array with promises of value + settle(values: PromiseLike[]): Promise[]>; + // array with values + settle(values: T[]): Promise[]>; - /** - * Like `Promise.some()`, with 1 as `count`. However, if the promise fulfills, the fulfillment value is not an array of 1 but the value directly. - */ - // promise of array with promises of value - static any(values: Promise.Thenable[]>): Promise; - // promise of array with values - static any(values: Promise.Thenable): Promise; - // array with promises of value - static any(values: Promise.Thenable[]): Promise; - // array with values - static any(values: R[]): Promise; + /** + * Like `Promise.some()`, with 1 as `count`. However, if the promise fulfills, the fulfillment value is not an array of 1 but the value directly. + */ + // promise of array with promises of value + any(values: PromiseLike[]>): Promise; + // promise of array with values + any(values: PromiseLike): Promise; + // array with promises of value + any(values: PromiseLike[]): Promise; + // array with values + any(values: T[]): Promise; - /** - * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled or rejected as soon as a promise in the array is fulfilled or rejected with the respective rejection reason or fulfillment value. - * - * **Note** If you pass empty array or a sparse array with no values, or a promise/thenable for such, it will be forever pending. - */ - // promise of array with promises of value - static race(values: Promise.Thenable[]>): Promise; - // promise of array with values - static race(values: Promise.Thenable): Promise; - // array with promises of value - static race(values: Promise.Thenable[]): Promise; - // array with values - static race(values: R[]): Promise; + /** + * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled or rejected as soon as a promise in the array is fulfilled or rejected with the respective rejection reason or fulfillment value. + * + * **Note** If you pass empty array or a sparse array with no values, or a promise/thenable for such, it will be forever pending. + */ + // promise of array with promises of value + race(values: PromiseLike[]>): Promise; + // promise of array with values + race(values: PromiseLike): Promise; + // array with promises of value + race(values: PromiseLike[]): Promise; + // array with values + race(values: T[]): Promise; - /** - * Initiate a competetive race between multiple promises or values (values will become immediately fulfilled promises). When `count` amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of the winners in order of resolution. - * - * If too many promises are rejected so that the promise can never become fulfilled, it will be immediately rejected with an array of rejection reasons in the order they were thrown in. - * - * *The original array is not modified.* - */ - // promise of array with promises of value - static some(values: Promise.Thenable[]>, count: number): Promise; - // promise of array with values - static some(values: Promise.Thenable, count: number): Promise; - // array with promises of value - static some(values: Promise.Thenable[], count: number): Promise; - // array with values - static some(values: R[], count: number): Promise; + /** + * Initiate a competetive race between multiple promises or values (values will become immediately fulfilled promises). When `count` amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of the winners in order of resolution. + * + * If too many promises are rejected so that the promise can never become fulfilled, it will be immediately rejected with an array of rejection reasons in the order they were thrown in. + * + * *The original array is not modified.* + */ + // promise of array with promises of value + some(values: PromiseLike[]>, count: number): Promise; + // promise of array with values + some(values: PromiseLike, count: number): Promise; + // array with promises of value + some(values: PromiseLike[], count: number): Promise; + // array with values + some(values: T[], count: number): Promise; - /** - * Like `Promise.all()` but instead of having to pass an array, the array is generated from the passed variadic arguments. - */ - // variadic array with promises of value - static join(...values: Promise.Thenable[]): Promise; - // variadic array with values - static join(...values: R[]): Promise; + /** + * Like `Promise.all()` but instead of having to pass an array, the array is generated from the passed variadic arguments. + */ + // variadic array with promises of value + join(...values: PromiseLike[]): Promise; + // variadic array with values + join(...values: T[]): Promise; - /** - * Map an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `mapper` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. - * - * If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well. - * - * *The original array is not modified.* - */ - // promise of array with promises of value - static map(values: Promise.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable, options?: Promise.ConcurrencyOption): Promise; - static map(values: Promise.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; + /** + * Map an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `mapper` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. + * + * If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well. + * + * *The original array is not modified.* + */ + // promise of array with promises of value + map(values: PromiseLike[]>, mapper: (item: T, index: number, arrayLength: number) => PromiseLike, options?: Promise.ConcurrencyOption): Promise; + map(values: PromiseLike[]>, mapper: (item: T, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; - // promise of array with values - static map(values: Promise.Thenable, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable, options?: Promise.ConcurrencyOption): Promise; - static map(values: Promise.Thenable, mapper: (item: R, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; + // promise of array with values + map(values: PromiseLike, mapper: (item: T, index: number, arrayLength: number) => PromiseLike, options?: Promise.ConcurrencyOption): Promise; + map(values: PromiseLike, mapper: (item: T, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; - // array with promises of value - static map(values: Promise.Thenable[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable, options?: Promise.ConcurrencyOption): Promise; - static map(values: Promise.Thenable[], mapper: (item: R, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; + // array with promises of value + map(values: PromiseLike[], mapper: (item: T, index: number, arrayLength: number) => PromiseLike, options?: Promise.ConcurrencyOption): Promise; + map(values: PromiseLike[], mapper: (item: T, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; - // array with values - static map(values: R[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable, options?: Promise.ConcurrencyOption): Promise; - static map(values: R[], mapper: (item: R, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; + // array with values + map(values: T[], mapper: (item: T, index: number, arrayLength: number) => PromiseLike, options?: Promise.ConcurrencyOption): Promise; + map(values: T[], mapper: (item: T, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; - /** - * Reduce an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `reducer` function with the signature `(total, current, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. - * - * If the reducer function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. - * - * *The original array is not modified. If no `intialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned. If `initialValue` is given and the array doesn't have at least 1 item, `initialValue` is returned.* - */ - // promise of array with promises of value - static reduce(values: Promise.Thenable[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; - static reduce(values: Promise.Thenable[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + /** + * Similar to `map` with concurrency set to 1 but guaranteed to execute in sequential order + * + * If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well. + * + * *The original array is not modified.* + */ + // promise of array with promises of value + mapSeries(values: PromiseLike[]>, mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike): Promise; - // promise of array with values - static reduce(values: Promise.Thenable, reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; - static reduce(values: Promise.Thenable, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + // promise of array with values + mapSeries(values: PromiseLike, mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike): Promise; - // array with promises of value - static reduce(values: Promise.Thenable[], reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; - static reduce(values: Promise.Thenable[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + // array with promises of value + mapSeries(values: PromiseLike[], mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike): Promise; - // array with values - static reduce(values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable, initialValue?: U): Promise; - static reduce(values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise; + // array with values + mapSeries(values: R[], mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike): Promise; + - /** - * Filter an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `filterer` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. - * - * The return values from the filtered functions are coerced to booleans, with the exception of promises and thenables which are awaited for their eventual result. - * - * *The original array is not modified. - */ - // promise of array with promises of value - static filter(values: Promise.Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable, option?: Promise.ConcurrencyOption): Promise; - static filter(values: Promise.Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; + /** + * Reduce an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `reducer` function with the signature `(total, current, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. + * + * If the reducer function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. + * + * *The original array is not modified. If no `intialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned. If `initialValue` is given and the array doesn't have at least 1 item, `initialValue` is returned.* + */ + // promise of array with promises of value + reduce(values: PromiseLike[]>, reducer: (total: U, current: T, index: number, arrayLength: number) => PromiseLike, initialValue?: U): Promise; + reduce(values: PromiseLike[]>, reducer: (total: U, current: T, index: number, arrayLength: number) => U, initialValue?: U): Promise; - // promise of array with values - static filter(values: Promise.Thenable, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable, option?: Promise.ConcurrencyOption): Promise; - static filter(values: Promise.Thenable, filterer: (item: R, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; + // promise of array with values + reduce(values: PromiseLike, reducer: (total: U, current: T, index: number, arrayLength: number) => PromiseLike, initialValue?: U): Promise; + reduce(values: PromiseLike, reducer: (total: U, current: T, index: number, arrayLength: number) => U, initialValue?: U): Promise; - // array with promises of value - static filter(values: Promise.Thenable[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable, option?: Promise.ConcurrencyOption): Promise; - static filter(values: Promise.Thenable[], filterer: (item: R, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; + // array with promises of value + reduce(values: PromiseLike[], reducer: (total: U, current: T, index: number, arrayLength: number) => PromiseLike, initialValue?: U): Promise; + reduce(values: PromiseLike[], reducer: (total: U, current: T, index: number, arrayLength: number) => U, initialValue?: U): Promise; - // array with values - static filter(values: R[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable, option?: Promise.ConcurrencyOption): Promise; - static filter(values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; + // array with values + reduce(values: T[], reducer: (total: U, current: T, index: number, arrayLength: number) => PromiseLike, initialValue?: U): Promise; + reduce(values: T[], reducer: (total: U, current: T, index: number, arrayLength: number) => U, initialValue?: U): Promise; - /** - * Iterate over an array, or a promise of an array, which contains promises (or a mix of promises and values) with the given iterator function with the signature (item, index, value) where item is the resolved value of a respective promise in the input array. Iteration happens serially. If any promise in the input array is rejected the returned promise is rejected as well. - * - * Resolves to the original array unmodified, this method is meant to be used for side effects. If the iterator function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. - */ - // promise of array with promises of value - static each(values: Promise.Thenable[]>, iterator: (item: R, index: number, arrayLength: number) => U | Promise.Thenable): Promise; - // array with promises of value - static each(values: Promise.Thenable[], iterator: (item: R, index: number, arrayLength: number) => U | Promise.Thenable): Promise; - // array with values OR promise of array with values - static each(values: R[] | Promise.Thenable, iterator: (item: R, index: number, arrayLength: number) => U | Promise.Thenable): Promise; + /** + * Filter an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `filterer` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. + * + * The return values from the filtered functions are coerced to booleans, with the exception of promises and thenables which are awaited for their eventual result. + * + * *The original array is not modified. + */ + // promise of array with promises of value + filter(values: PromiseLike[]>, filterer: (item: T, index: number, arrayLength: number) => PromiseLike, option?: Promise.ConcurrencyOption): Promise; + filter(values: PromiseLike[]>, filterer: (item: T, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; + + // promise of array with values + filter(values: PromiseLike, filterer: (item: T, index: number, arrayLength: number) => PromiseLike, option?: Promise.ConcurrencyOption): Promise; + filter(values: PromiseLike, filterer: (item: T, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; + + // array with promises of value + filter(values: PromiseLike[], filterer: (item: T, index: number, arrayLength: number) => PromiseLike, option?: Promise.ConcurrencyOption): Promise; + filter(values: PromiseLike[], filterer: (item: T, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; + + // array with values + filter(values: T[], filterer: (item: T, index: number, arrayLength: number) => PromiseLike, option?: Promise.ConcurrencyOption): Promise; + filter(values: T[], filterer: (item: T, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; + + /** + * Iterate over an array, or a promise of an array, which contains promises (or a mix of promises and values) with the given iterator function with the signature (item, index, value) where item is the resolved value of a respective promise in the input array. Iteration happens serially. If any promise in the input array is rejected the returned promise is rejected as well. + * + * Resolves to the original array unmodified, this method is meant to be used for side effects. If the iterator function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. + */ + // promise of array with promises of value + each(values: PromiseLike[]>, iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike): Promise; + // array with promises of value + each(values: PromiseLike[], iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike): Promise; + // array with values OR promise of array with values + each(values: T[] | PromiseLike, iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike): Promise; } -declare module Promise { - export interface RangeError extends Error { - } - export interface CancellationError extends Error { - } - export interface TimeoutError extends Error { - } - export interface TypeError extends Error { - } - export interface RejectionError extends Error { - } - export interface OperationalError extends Error { - } +interface Promise extends PromiseLike, Promise.Inspection { + /** + * Promises/A+ `.then()` with progress handler. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise. + */ + then(onFulfill: (value: T) => U | PromiseLike, onReject?: (error: any) => U | PromiseLike, onProgress?: (note: any) => any): Promise; + then(onFulfill: (value: T) => U | PromiseLike, onReject?: (error: any) => void | PromiseLike, onProgress?: (note: any) => any): Promise; - export interface ConcurrencyOption { - concurrency: number; - } - export interface SpreadOption { - spread: boolean; - } - export interface PromisifyAllOptions { - suffix?: string; - filter?: (name: string, func: Function, target?: any, passesDefaultFilter?: boolean) => boolean; - // The promisifier gets a reference to the original method and should return a function which returns a promise - promisifier?: (originalMethod: Function) => () => Thenable ; - } + /** + * This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler. + * + * Alias `.caught();` for compatibility with earlier ECMAScript version. + */ + catch(onReject?: (error: any) => T | PromiseLike | void | PromiseLike): Promise; + caught(onReject?: (error: any) => T | PromiseLike | void | PromiseLike): Promise; - // Ideally, we'd define e.g. "export class RangeError extends Error {}", - // but as Error is defined as an interface (not a class), TypeScript doesn't - // allow extending Error, only implementing it. - // However, if we want to catch() only a specific error type, we need to pass - // a constructor function to it. So, as a workaround, we define them here as such. - export function RangeError(): RangeError; - export function CancellationError(): CancellationError; - export function TimeoutError(): TimeoutError; - export function TypeError(): TypeError; - export function RejectionError(): RejectionError; - export function OperationalError(): OperationalError; + catch(onReject?: (error: any) => U | PromiseLike): Promise; + caught(onReject?: (error: any) => U | PromiseLike): Promise; - export interface Thenable { - then(onFulfilled: (value: R) => U|Thenable, onRejected?: (error: any) => U|Thenable): Thenable; - then(onFulfilled: (value: R) => U|Thenable, onRejected?: (error: any) => void|Thenable): Thenable; - } + /** + * This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called. + * + * This method also supports predicate-based filters. If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument. The return result of the predicate will be used determine whether the error handler should be called. + * + * Alias `.caught();` for compatibility with earlier ECMAScript version. + */ + catch(predicate: (error: any) => boolean, onReject: (error: any) => T | PromiseLike | void | PromiseLike): Promise; + caught(predicate: (error: any) => boolean, onReject: (error: any) => T | PromiseLike | void | PromiseLike): Promise; - export interface Resolver { - /** - * Returns a reference to the controlled promise that can be passed to clients. - */ - promise: Promise; + catch(predicate: (error: any) => boolean, onReject: (error: any) => U | PromiseLike): Promise; + caught(predicate: (error: any) => boolean, onReject: (error: any) => U | PromiseLike): Promise; - /** - * Resolve the underlying promise with `value` as the resolution value. If `value` is a thenable or a promise, the underlying promise will assume its state. - */ - resolve(value: R): void; - resolve(): void; + catch(ErrorClass: Function, onReject: (error: any) => T | PromiseLike | void | PromiseLike): Promise; + caught(ErrorClass: Function, onReject: (error: any) => T | PromiseLike | void | PromiseLike): Promise; - /** - * Reject the underlying promise with `reason` as the rejection reason. - */ - reject(reason: any): void; + catch(ErrorClass: Function, onReject: (error: any) => U | PromiseLike): Promise; + caught(ErrorClass: Function, onReject: (error: any) => U | PromiseLike): Promise; - /** - * Progress the underlying promise with `value` as the progression value. - */ - progress(value: any): void; - /** - * Gives you a callback representation of the `PromiseResolver`. Note that this is not a method but a property. The callback accepts error object in first argument and success values on the 2nd parameter and the rest, I.E. node js conventions. - * - * If the the callback is called with multiple success values, the resolver fullfills its promise with an array of the values. - */ - // TODO specify resolver callback - callback: (err: any, value: R, ...values: R[]) => void; - } + /** + * Like `.catch` but instead of catching all types of exceptions, it only catches those that don't originate from thrown errors but rather from explicit rejections. + */ + error(onReject: (reason: any) => PromiseLike): Promise; + error(onReject: (reason: any) => U): Promise; - export interface Inspection { - /** - * See if the underlying promise was fulfilled at the creation time of this inspection object. - */ - isFulfilled(): boolean; + /** + * Pass a handler that will be called regardless of this promise's fate. Returns a new promise chained from this promise. There are special semantics for `.finally()` in that the final value cannot be modified from the handler. + * + * Alias `.lastly();` for compatibility with earlier ECMAScript version. + */ + finally(handler: () => PromiseLike): Promise; + finally(handler: () => U): Promise; - /** - * See if the underlying promise was rejected at the creation time of this inspection object. - */ - isRejected(): boolean; + lastly(handler: () => PromiseLike): Promise; + lastly(handler: () => U): Promise; - /** - * See if the underlying promise was defer at the creation time of this inspection object. - */ - isPending(): boolean; + /** + * Create a promise that follows this promise, but is bound to the given `thisArg` value. A bound promise will call its handlers with the bound value set to `this`. Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise. + */ + bind(thisArg: any): Promise; - /** - * Get the fulfillment value of the underlying promise. Throws if the promise wasn't fulfilled at the creation time of this inspection object. - * - * throws `TypeError` - */ - value(): R; + /** + * Like `.then()`, but any unhandled rejection that ends up here will be thrown as an error. + */ + done(onFulfilled: (value: T) => PromiseLike, onRejected: (error: any) => PromiseLike, onProgress?: (note: any) => any): void; + done(onFulfilled: (value: T) => PromiseLike, onRejected?: (error: any) => U, onProgress?: (note: any) => any): void; + done(onFulfilled: (value: T) => U, onRejected: (error: any) => PromiseLike, onProgress?: (note: any) => any): void; + done(onFulfilled?: (value: T) => U, onRejected?: (error: any) => U, onProgress?: (note: any) => any): void; - /** - * Get the rejection reason for the underlying promise. Throws if the promise wasn't rejected at the creation time of this inspection object. - * - * throws `TypeError` - */ - reason(): any; - } + /** + * Like `.finally()`, but not called for rejections. + */ + tap(onFulFill: (value: T) => PromiseLike): Promise; + tap(onFulfill: (value: T) => U): Promise; - /** - * Changes how bluebird schedules calls a-synchronously. - * - * @param scheduler Should be a function that asynchronously schedules - * the calling of the passed in function - */ - export function setScheduler(scheduler: (callback: (...args: any[]) => void) => void): void; + /** + * Shorthand for `.then(null, null, handler);`. Attach a progress handler that will be called if this promise is progressed. Returns a new promise chained from this promise. + */ + progressed(handler: (note: any) => any): Promise; + + /** + * Same as calling `Promise.delay(this, ms)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + delay(ms: number): Promise; + + /** + * Returns a promise that will be fulfilled with this promise's fulfillment value or rejection reason. However, if this promise is not fulfilled or rejected within `ms` milliseconds, the returned promise is rejected with a `Promise.TimeoutError` instance. + * + * You may specify a custom error message with the `message` parameter. + */ + timeout(ms: number, message?: string): Promise; + + /** + * Register a node-style callback on this promise. When this promise is is either fulfilled or rejected, the node callback will be called back with the node.js convention where error reason is the first argument and success value is the second argument. The error argument will be `null` in case of success. + * Returns back this promise instead of creating a new one. If the `callback` argument is not a function, this method does not do anything. + */ + nodeify(callback: (err: any, value?: T) => void, options?: Promise.SpreadOption): Promise; + nodeify(...sink: any[]): Promise; + + /** + * Marks this promise as cancellable. Promises by default are not cancellable after v0.11 and must be marked as such for `.cancel()` to have any effect. Marking a promise as cancellable is infectious and you don't need to remark any descendant promise. + */ + cancellable(): Promise; + + /** + * Cancel this promise. The cancellation will propagate to farthest cancellable ancestor promise which is still pending. + * + * That ancestor will then be rejected with a `CancellationError` (get a reference from `Promise.CancellationError`) object as the rejection reason. + * + * In a promise rejection handler you may check for a cancellation by seeing if the reason object has `.name === "Cancel"`. + * + * Promises are by default not cancellable. Use `.cancellable()` to mark a promise as cancellable. + */ + // TODO what to do with this? + cancel(reason?: any): Promise; + + /** + * Like `.then()`, but cancellation of the the returned promise or any of its descendant will not propagate cancellation to this promise or this promise's ancestors. + */ + fork(onFulfilled: (value: T) => PromiseLike, onRejected: (error: any) => PromiseLike, onProgress?: (note: any) => any): Promise; + fork(onFulfilled: (value: T) => PromiseLike, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise; + fork(onFulfilled: (value: T) => U, onRejected: (error: any) => PromiseLike, onProgress?: (note: any) => any): Promise; + fork(onFulfilled?: (value: T) => U, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise; + + /** + * Create an uncancellable promise based on this promise. + */ + uncancellable(): Promise; + + /** + * See if this promise can be cancelled. + */ + isCancellable(): boolean; + + /** + * See if this `promise` has been fulfilled. + */ + isFulfilled(): boolean; + + /** + * See if this `promise` has been rejected. + */ + isRejected(): boolean; + + /** + * See if this `promise` is still defer. + */ + isPending(): boolean; + + /** + * See if this `promise` is resolved -> either fulfilled or rejected. + */ + isResolved(): boolean; + + /** + * Get the fulfillment value of the underlying promise. Throws if the promise isn't fulfilled yet. + * + * throws `TypeError` + */ + value(): T; + + /** + * Get the rejection reason for the underlying promise. Throws if the promise isn't rejected yet. + * + * throws `TypeError` + */ + reason(): any; + + /** + * Synchronously inspect the state of this `promise`. The `PromiseInspection` will represent the state of the promise as snapshotted at the time of calling `.inspect()`. + */ + inspect(): Promise.Inspection; + + /** + * This is a convenience method for doing: + * + * + * promise.then(function(obj){ + * return obj[propertyName].call(obj, arg...); + * }); + * + */ + call(propertyName: string, ...args: any[]): Promise; + + /** + * This is a convenience method for doing: + * + * + * promise.then(function(obj){ + * return obj[propertyName]; + * }); + * + */ + // TODO find way to fix get() + // get(propertyName: string): Promise; + + /** + * Convenience method for: + * + * + * .then(function() { + * return value; + * }); + * + * + * in the case where `value` doesn't change its value. That means `value` is bound at the time of calling `.return()` + * + * Alias `.thenReturn();` for compatibility with earlier ECMAScript version. + */ + return(): Promise; + thenReturn(): Promise; + return(value: U): Promise; + thenReturn(value: U): Promise; + + /** + * Convenience method for: + * + * + * .then(function() { + * throw reason; + * }); + * + * Same limitations apply as with `.return()`. + * + * Alias `.thenThrow();` for compatibility with earlier ECMAScript version. + */ + throw(reason: Error): Promise; + thenThrow(reason: Error): Promise; + + /** + * Convert to String. + */ + toString(): string; + + /** + * This is implicitly called by `JSON.stringify` when serializing the object. Returns a serialized representation of the `Promise`. + */ + toJSON(): Object; + + /** + * Like calling `.then`, but the fulfillment value or rejection reason is assumed to be an array, which is flattened to the formal parameters of the handlers. + */ + // TODO how to model instance.spread()? like Q? + spread(onFulfill: Function, onReject?: (reason: any) => PromiseLike): Promise; + spread(onFulfill: Function, onReject?: (reason: any) => U): Promise; + /* + // TODO or something like this? + spread(onFulfill: (...values: W[]) => PromiseLike, onReject?: (reason: any) => PromiseLike): Promise; + spread(onFulfill: (...values: W[]) => PromiseLike, onReject?: (reason: any) => U): Promise; + spread(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => PromiseLike): Promise; + spread(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => U): Promise; + */ + /** + * Same as calling `Promise.all(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + all(): Promise; + + /** + * Same as calling `Promise.props(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO how to model instance.props()? + props(): Promise; + + /** + * Same as calling `Promise.settle(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + settle(): Promise[]>; + + /** + * Same as calling `Promise.any(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + any(): Promise; + + /** + * Same as calling `Promise.some(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + some(count: number): Promise; + + /** + * Same as calling `Promise.race(thisPromise, count)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + race(): Promise; + + /** + * Same as calling `Promise.map(thisPromise, mapper)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + map(mapper: (item: Q, index: number, arrayLength: number) => PromiseLike, options?: Promise.ConcurrencyOption): Promise; + map(mapper: (item: Q, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; + + /** + * Same as `Promise.mapSeries(thisPromise, mapper)`. + */ + // TODO type inference from array-resolving promise? + mapSeries(mapper: (item: Q, index: number, arrayLength: number) => U | PromiseLike): Promise; + + /** + * Same as calling `Promise.reduce(thisPromise, Function reducer, initialValue)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + reduce(reducer: (memo: U, item: Q, index: number, arrayLength: number) => PromiseLike, initialValue?: U): Promise; + reduce(reducer: (memo: U, item: Q, index: number, arrayLength: number) => U, initialValue?: U): Promise; + + /** + * Same as calling ``Promise.filter(thisPromise, filterer)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + filter(filterer: (item: U, index: number, arrayLength: number) => PromiseLike, options?: Promise.ConcurrencyOption): Promise; + filter(filterer: (item: U, index: number, arrayLength: number) => boolean, options?: Promise.ConcurrencyOption): Promise; + + /** + * Same as calling ``Promise.each(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + each(iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike): Promise; +} + +/** + * Don't use variable namespace such as variables, functions, and classes. + * If you use this namespace, it will conflict in es6. + */ +declare namespace Promise { + export interface RangeError extends Error { + } + export interface CancellationError extends Error { + } + export interface TimeoutError extends Error { + } + export interface TypeError extends Error { + } + export interface RejectionError extends Error { + } + export interface OperationalError extends Error { + } + + export interface ConcurrencyOption { + concurrency: number; + } + export interface SpreadOption { + spread: boolean; + } + export interface PromisifyAllOptions { + suffix?: string; + filter?: (name: string, func: Function, target?: any, passesDefaultFilter?: boolean) => boolean; + // The promisifier gets a reference to the original method and should return a function which returns a promise + promisifier?: (originalMethod: Function) => () => PromiseLike; + } + + export interface Resolver { + /** + * Returns a reference to the controlled promise that can be passed to clients. + */ + promise: Promise; + + /** + * Resolve the underlying promise with `value` as the resolution value. If `value` is a thenable or a promise, the underlying promise will assume its state. + */ + resolve(value: T): void; + resolve(): void; + + /** + * Reject the underlying promise with `reason` as the rejection reason. + */ + reject(reason: any): void; + + /** + * Progress the underlying promise with `value` as the progression value. + */ + progress(value: any): void; + + /** + * Gives you a callback representation of the `PromiseResolver`. Note that this is not a method but a property. The callback accepts error object in first argument and success values on the 2nd parameter and the rest, I.E. node js conventions. + * + * If the the callback is called with multiple success values, the resolver fullfills its promise with an array of the values. + */ + // TODO specify resolver callback + callback: (err: any, value: T, ...values: T[]) => void; + } + + export interface Inspection { + /** + * See if the underlying promise was fulfilled at the creation time of this inspection object. + */ + isFulfilled(): boolean; + + /** + * See if the underlying promise was rejected at the creation time of this inspection object. + */ + isRejected(): boolean; + + /** + * See if the underlying promise was defer at the creation time of this inspection object. + */ + isPending(): boolean; + + /** + * Get the fulfillment value of the underlying promise. Throws if the promise wasn't fulfilled at the creation time of this inspection object. + * + * throws `TypeError` + */ + value(): T; + + /** + * Get the rejection reason for the underlying promise. Throws if the promise wasn't rejected at the creation time of this inspection object. + * + * throws `TypeError` + */ + reason(): any; + } } declare module 'bluebird' { - export = Promise; + export = Promise; } diff --git a/breeze/breeze.d.ts b/breeze/breeze.d.ts index 2a60df6d8..1cc587c2f 100644 --- a/breeze/breeze.d.ts +++ b/breeze/breeze.d.ts @@ -392,6 +392,7 @@ declare module breeze { constructor(config?: EntityManagerOptions); constructor(config?: string); + acceptChanges(): void; addEntity(entity: Entity): Entity; attachEntity(entity: Entity, entityState?: EntityStateSymbol, mergeStrategy?: MergeStrategySymbol): Entity; clear(): void; diff --git a/chai/chai-3.2.0-tests.ts b/chai/chai-3.2.0-tests.ts new file mode 100644 index 000000000..9b646b152 --- /dev/null +++ b/chai/chai-3.2.0-tests.ts @@ -0,0 +1,1948 @@ +/// +import chai = require('chai'); + +// ReSharper disable WrongExpressionStatement + +var expect = chai.expect; +var assert = chai.assert; +var should = chai.should(); +declare var err: Function; + +function chaiVersion() { + expect(chai).to.have.property('version'); + (<{}>chai).should.have.property('version'); +} + +function assertion() { + expect('test').to.be.a('string'); + 'test'.should.be.a('string'); + expect('foo').to.equal('foo'); + 'foo'.should.equal('foo'); + should.equal('foo', 'foo'); +} + +function fail() { + err(() => { + should.fail('foo', 'bar'); + }, 'expected fail to throw an AssertionError'); + err(() => { + should.fail('foo', 'bar', 'should fail'); + }, 'expected fail to throw an AssertionError'); + err(() => { + should.fail('foo', 'bar', 'should fail', 'equal'); + }, 'expected fail to throw an AssertionError'); + + err(() => { + expect.fail('foo', 'bar'); + }, 'expected fail to throw an AssertionError'); + err(() => { + expect.fail('foo', 'bar', 'should fail'); + }, 'expected fail to throw an AssertionError'); + err(() => { + expect.fail('foo', 'bar', 'should fail', 'equal'); + }, 'expected fail to throw an AssertionError'); +} + +// ReSharper disable once InconsistentNaming +function _true() { + expect(true).to.be.true; + true.should.be.true; + expect(false).to.not.be.true; + false.should.not.be.true; + expect(1).to.not.be.true; + (1).should.not.be.true; + + err(() => { + expect('test').to.be.true; + 'test'.should.be.true; + }, 'expected \'test\' to be true'); +} + +function ok() { + expect(true).to.be.ok; + true.should.be.ok; + expect(false).to.not.be.ok; + false.should.not.be.ok; + expect(1).to.be.ok; + (1).should.be.ok; + expect(0).to.not.be.ok; + (0).should.not.be.ok; + + err(() => { + expect('').to.be.ok; + ''.should.be.ok; + }, 'expected \'\' to be truthy'); + + err(() => { + expect('test').to.not.be.ok; + 'test'.should.not.be.ok; + }, 'expected \'test\' to be falsy'); +} + +function _false() { + expect(false).to.be.false; + false.should.be.false; + expect(true).to.not.be.false; + true.should.not.be.false; + expect(0).to.not.be.false; + (0).should.not.be.false; + + err(() => { + expect('').to.be.false; + ''.should.be.false; + }, 'expected \'\' to be false'); +} + +function _null() { + expect(null).to.be.null; + should.equal(null, null); + expect(false).to.not.be.null; + false.should.not.be.null; + + err(() => { + expect('').to.be.null; + ''.should.be.null; + }, 'expected \'\' to be null'); +} + +function _undefined() { + expect(undefined).to.be.undefined; + should.equal(undefined, undefined); + expect(null).to.not.be.undefined; + should.not.equal(null, undefined); + + err(() => { + expect('').to.be.undefined; + ''.should.be.undefined; + }, 'expected \'\' to be undefined'); +} + +function _NaN() { + expect(NaN).to.be.NaN; + expect(12).to.be.not.NaN; + expect("NaN").to.be.not.NaN; + (NaN).should.be.NaN; + (12).should.be.not.NaN; + ("NaN").should.be.not.NaN; +} + +function exist() { + var foo = 'bar'; + expect(foo).to.exist; + should.exist(foo); + expect(void (0)).to.not.exist; + should.not.exist(void (0)); +} + +function argumentsTest() { + var args = arguments; + expect(args).to.be.arguments; + args.should.be.arguments; + expect([]).to.not.be.arguments; + [].should.not.be.arguments; + expect(args).to.be.an('arguments').and.be.arguments; + args.should.be.an('arguments').and.be.arguments; + expect([]).to.be.an('array').and.not.be.Arguments; + [].should.be.an('array').and.not.be.Arguments; +} + +function equal() { + expect(undefined).to.equal(void (0)); + should.equal(undefined, void (0)); +} + +function _typeof() { + expect('test').to.be.a('string'); + 'test'.should.be.a('string'); + + err(() => { + expect('test').to.not.be.a('string'); + 'test'.should.not.be.a('string'); + }, 'expected \'test\' not to be a string'); + + expect(arguments).to.be.an('arguments'); + arguments.should.be.an('arguments'); + + expect(5).to.be.a('number'); + (5).should.be.a('number'); + + expect(new Number(1)).to.be.a('number'); + (new Number(1)).should.be.a('number'); + expect(Number(1)).to.be.a('number'); + Number(1).should.be.a('number'); + expect(true).to.be.a('boolean'); + true.should.be.a('boolean'); + expect(new Array()).to.be.a('array'); + (new Array()).should.be.a('array'); + expect(new Object()).to.be.a('object'); + (new Object()).should.be.a('object'); + expect({}).to.be.a('object'); + ({}).should.be.a('object'); + expect([]).to.be.a('array'); + [].should.be.a('array'); + expect(() => { }).to.be.a('function'); + (() => { }).should.be.a('function'); + expect(null).to.be.a('null'); + // N.B. previous line has no should equivalent + + err(() => { + expect(5).to.not.be.a('number', 'blah'); + (5).should.not.be.a('number', 'blah'); + }, 'blah: expected 5 not to be a number'); +} + +class Foo { } +function _instanceof() { + expect(new Foo()).to.be.an.instanceof(Foo); + (new Foo()).should.be.an.instanceof(Foo); + + err(() => { + expect(3).to.an.instanceof(Foo, 'blah'); + (3).should.an.instanceof(Foo, 'blah'); + }, 'blah: expected 3 to be an instance of Foo'); +} + +function within() { + expect(5).to.be.within(5, 10); + (5).should.be.within(5, 10); + expect(5).to.be.within(3, 6); + (5).should.be.within(3, 6); + expect(5).to.be.within(3, 5); + (5).should.be.within(3, 5); + expect(5).to.not.be.within(1, 3); + (5).should.not.be.within(1, 3); + expect('foo').to.have.length.within(2, 4); + 'foo'.should.have.length.within(2, 4); + expect([1, 2, 3]).to.have.length.within(2, 4); + [1, 2, 3].should.have.length.within(2, 4); + + err(() => { + expect(5).to.not.be.within(4, 6, 'blah'); + (5).should.not.be.within(4, 6, 'blah'); + }, 'blah: expected 5 to not be within 4..6', 'blah'); + + err(() => { + expect(10).to.be.within(50, 100, 'blah'); + (10).should.be.within(50, 100, 'blah'); + }, 'blah: expected 10 to be within 50..100'); + + err(() => { + expect('foo').to.have.length.within(5, 7, 'blah'); + 'foo'.should.have.length.within(5, 7, 'blah'); + }, 'blah: expected \'foo\' to have a length within 5..7'); + + err(() => { + expect([1, 2, 3]).to.have.length.within(5, 7, 'blah'); + [1, 2, 3].should.have.length.within(5, 7, 'blah'); + }, 'blah: expected [ 1, 2, 3 ] to have a length within 5..7'); +} + +function above() { + expect(5).to.be.above(2); + (5).should.be.above(2); + expect(5).to.be.greaterThan(2); + (5).should.be.greaterThan(2); + expect(5).to.not.be.above(5); + (5).should.not.be.above(5); + expect(5).to.not.be.above(6); + (5).should.not.be.above(6); + expect('foo').to.have.length.above(2); + 'foo'.should.have.length.above(2); + expect([1, 2, 3]).to.have.length.above(2); + [1, 2, 3].should.have.length.above(2); + + err(() => { + expect(5).to.be.above(6, 'blah'); + (5).should.be.above(6, 'blah'); + }, 'blah: expected 5 to be above 6', 'blah'); + + err(() => { + expect(10).to.not.be.above(6, 'blah'); + (10).should.not.be.above(6, 'blah'); + }, 'blah: expected 10 to be at most 6'); + + err(() => { + expect('foo').to.have.length.above(4, 'blah'); + 'foo'.should.have.length.above(4, 'blah'); + }, 'blah: expected \'foo\' to have a length above 4 but got 3'); + + err(() => { + expect([1, 2, 3]).to.have.length.above(4, 'blah'); + [1, 2, 3].should.have.length.above(4, 'blah'); + }, 'blah: expected [ 1, 2, 3 ] to have a length above 4 but got 3'); +} + +function least() { + expect(5).to.be.at.least(2); + (5).should.be.at.least(2); + expect(5).to.be.at.least(5); + (5).should.be.at.least(5); + expect(5).to.not.be.at.least(6); + (5).should.not.be.at.least(6); + expect('foo').to.have.length.of.at.least(2); + 'foo'.should.have.length.of.at.least(2); + expect([1, 2, 3]).to.have.length.of.at.least(2); + [1, 2, 3].should.have.length.of.at.least(2); + + err(() => { + expect(5).to.be.at.least(6, 'blah'); + (5).should.be.at.least(6, 'blah'); + }, 'blah: expected 5 to be at least 6', 'blah'); + + err(() => { + expect(10).to.not.be.at.least(6, 'blah'); + (10).should.not.be.at.least(6, 'blah'); + }, 'blah: expected 10 to be below 6'); + + err(() => { + expect('foo').to.have.length.of.at.least(4, 'blah'); + 'foo'.should.have.length.of.at.least(4, 'blah'); + }, 'blah: expected \'foo\' to have a length at least 4 but got 3'); + + err(() => { + expect([1, 2, 3]).to.have.length.of.at.least(4, 'blah'); + [1, 2, 3].should.have.length.of.at.least(4, 'blah'); + }, 'blah: expected [ 1, 2, 3 ] to have a length at least 4 but got 3'); + + err(() => { + expect([1, 2, 3, 4]).to.not.have.length.of.at.least(4, 'blah'); + [1, 2, 3, 4].should.not.have.length.of.at.least(4, 'blah'); + }, 'blah: expected [ 1, 2, 3, 4 ] to have a length below 4'); +} + +function below() { + expect(2).to.be.below(5); + (2).should.be.below(5); + expect(2).to.be.lessThan(5); + (2).should.be.lessThan(5); + expect(2).to.not.be.below(2); + (2).should.not.be.below(2); + expect(2).to.not.be.below(1); + (2).should.not.be.below(1); + expect('foo').to.have.length.below(4); + 'foo'.should.have.length.below(4); + expect([1, 2, 3]).to.have.length.below(4); + [1, 2, 3].should.have.length.below(4); + + err(() => { + expect(6).to.be.below(5, 'blah'); + (6).should.be.below(5, 'blah'); + }, 'blah: expected 6 to be below 5'); + + err(() => { + expect(6).to.not.be.below(10, 'blah'); + (6).should.not.be.below(10, 'blah'); + }, 'blah: expected 6 to be at least 10'); + + err(() => { + expect('foo').to.have.length.below(2, 'blah'); + 'foo'.should.have.length.below(2, 'blah'); + }, 'blah: expected \'foo\' to have a length below 2 but got 3'); + + err(() => { + expect([1, 2, 3]).to.have.length.below(2, 'blah'); + [1, 2, 3].should.have.length.below(2, 'blah'); + }, 'blah: expected [ 1, 2, 3 ] to have a length below 2 but got 3'); +} + +function most() { + expect(2).to.be.at.most(5); + (2).should.be.at.most(5); + expect(2).to.be.at.most(2); + (2).should.be.at.most(2); + expect(2).to.not.be.at.most(1); + (2).should.not.be.at.most(1); + expect(2).to.not.be.at.most(1); + (2).should.not.be.at.most(1); + expect('foo').to.have.length.of.at.most(4); + 'foo'.should.have.length.of.at.most(4); + expect([1, 2, 3]).to.have.length.of.at.most(4); + [1, 2, 3].should.have.length.of.at.most(4); + + err(() => { + expect(6).to.be.at.most(5, 'blah'); + (6).should.be.at.most(5, 'blah'); + }, 'blah: expected 6 to be at most 5'); + + err(() => { + expect(6).to.not.be.at.most(10, 'blah'); + (6).should.not.be.at.most(10, 'blah'); + }, 'blah: expected 6 to be above 10'); + + err(() => { + expect('foo').to.have.length.of.at.most(2, 'blah'); + 'foo'.should.have.length.of.at.most(2, 'blah'); + }, 'blah: expected \'foo\' to have a length at most 2 but got 3'); + + err(() => { + expect([1, 2, 3]).to.have.length.of.at.most(2, 'blah'); + [1, 2, 3].should.have.length.of.at.most(2, 'blah'); + }, 'blah: expected [ 1, 2, 3 ] to have a length at most 2 but got 3'); + + err(() => { + expect([1, 2]).to.not.have.length.of.at.most(2, 'blah'); + [1, 2].should.not.have.length.of.at.most(2, 'blah'); + }, 'blah: expected [ 1, 2 ] to have a length above 2'); +} + +function match() { + expect('foobar').to.match(/^foo/); + 'foobar'.should.match(/^foo/); + expect('foobar').to.not.match(/^bar/); + 'foobar'.should.not.match(/^bar/); + + expect('foobar').matches(/^foo/); + 'foobar'.should.not.matches(/^bar/); + + err(() => { + expect('foobar').to.match(/^bar/i, 'blah'); + 'foobar'.should.match(/^bar/i, 'blah'); + }, 'blah: expected \'foobar\' to match /^bar/i'); + + err(() => { + expect('foobar').to.not.match(/^foo/i, 'blah'); + 'foobar'.should.not.match(/^foo/i, 'blah'); + }, 'blah: expected \'foobar\' not to match /^foo/i'); +} + +function length2() { + expect('test').to.have.length(4); + 'test'.should.have.length(4); + expect('test').to.not.have.length(3); + 'test'.should.not.have.length(3); + expect([1, 2, 3]).to.have.length(3); + [1, 2, 3].should.have.length(3); + + err(() => { + expect(4).to.have.length(3, 'blah'); + (4).should.have.length(3, 'blah'); + }, 'blah: expected 4 to have a property \'length\''); + + err(() => { + expect('asd').to.not.have.length(3, 'blah'); + 'asd'.should.not.have.length(3, 'blah'); + }, 'blah: expected \'asd\' to not have a length of 3'); +} + +function eql() { + expect('test').to.eql('test'); + 'test'.should.eql('test'); + expect({ foo: 'bar' }).to.eql({ foo: 'bar' }); + ({ foo: 'bar' }).should.eql({ foo: 'bar' }); + expect(1).to.eql(1); + (1).should.eql(1); + expect('4').to.not.eql(4); + '4'.should.not.eql(4); + + err(() => { + expect(4).to.eql(3, 'blah'); + (4).should.eql(3, 'blah'); + }, 'blah: expected 4 to deeply equal 3'); +} + +class Buffer { + constructor(arr: number[]) { + } +} +function buffer() { + expect(new Buffer([1])).to.eql(new Buffer([1])); + (new Buffer([1])).should.eql(new Buffer([1])); + + err(() => { + expect(new Buffer([0])).to.eql(new Buffer([1])); + (new Buffer([0])).should.eql(new Buffer([1])); + }, 'expected to deeply equal '); +} + +function equal2() { + expect('test').to.equal('test'); + 'test'.should.equal('test'); + should.equal('test', 'test'); + expect(1).to.equal(1); + (1).should.equal(1); + should.equal(1, 1); + + err(() => { + expect(4).to.equal(3, 'blah'); + (4).should.equal(3, 'blah'); + should.equal(4, 3, 'blah'); + }, 'blah: expected 4 to equal 3'); + + err(() => { + expect('4').to.equal(4, 'blah'); + '4'.should.equal(4, 'blah'); + should.equal(4, 4, 'blah'); + }, 'blah: expected \'4\' to equal 4'); +} + +function deepEqual() { + expect({ foo: 'bar' }).to.deep.equal({ foo: 'bar' }); + ({ foo: 'bar' }).should.deep.equal({ foo: 'bar' }); + expect({ foo: 'bar' }).not.to.deep.equal({ foo: 'baz' }); +} + +function deepEqual2() { + expect(/a/).to.deep.equal(/a/); + /a/.should.deep.equal(/a/); + expect(/a/).not.to.deep.equal(/b/); + expect(/a/).not.to.deep.equal({}); + expect(/a/g).to.deep.equal(/a/g); + /a/g.should.deep.equal(/a/g); + expect(/a/g).not.to.deep.equal(/b/g); + expect(/a/i).to.deep.equal(/a/i); + /a/i.should.deep.equal(/a/i); + expect(/a/i).not.to.deep.equal(/b/i); + expect(/a/m).to.deep.equal(/a/m); + /a/m.should.deep.equal(/a/m); + expect(/a/m).not.to.deep.equal(/b/m); +} + +// ReSharper disable once InconsistentNaming +function deepEqual3() { + var a = new Date(1, 2, 3); + var b = new Date(4, 5, 6); + expect(a).to.deep.equal(a); + a.should.deep.equal(a); + expect(a).not.to.deep.equal(b); + a.should.not.deep.equal(b); + expect(a).not.to.deep.equal({}); + a.should.not.deep.equal({}); +} + +function deepInclude() { + expect(['foo', 'bar']).to.deep.include(['bar', 'foo']); + ['foo', 'bar'].should.deep.include(['bar', 'foo']); + expect(['foo', 'bar']).not.to.deep.equal(['foo', 'baz']); + ['foo', 'bar'].should.not.deep.equal(['foo', 'baz']); +} + +class FakeArgs { + length: number; +} + +function empty() { + FakeArgs.prototype.length = 0; + + expect('').to.be.empty; + + ''.should.be.empty; + expect('foo').not.to.be.empty; + 'foo'.should.not.be.empty; + expect([]).to.be.empty; + [].should.be.empty; + expect(['foo']).not.to.be.empty; + ['foo'].should.not.be.empty; + expect(new FakeArgs).to.be.empty; + (new FakeArgs).should.be.empty; + expect({ arguments: 0 }).not.to.be.empty; + ({ arguments: 0 }).should.not.be.empty; + expect({}).to.be.empty; + ({}).should.be.empty; + expect({ foo: 'bar' }).not.to.be.empty; + ({ foo: 'bar' }).should.not.be.empty; + + err(() => { + expect('').not.to.be.empty; + ''.should.not.be.empty; + }, 'expected \'\' not to be empty'); + + err(() => { + expect('foo').to.be.empty; + 'foo'.should.be.empty; + 'foo'.should.be.empty; + }, 'expected \'foo\' to be empty'); + + err(() => { + expect([]).not.to.be.empty; + [].should.not.be.empty; + }, 'expected [] not to be empty'); + + err(() => { + expect(['foo']).to.be.empty; + ['foo'].should.be.empty; + }, 'expected [ \'foo\' ] to be empty'); + + err(() => { + expect(new FakeArgs).not.to.be.empty; + (new FakeArgs).should.not.be.empty; + }, 'expected { length: 0 } not to be empty'); + + err(() => { + expect({ arguments: 0 }).to.be.empty; + ({ arguments: 0 }).should.be.empty; + }, 'expected { arguments: 0 } to be empty'); + + err(() => { + expect({}).not.to.be.empty; + ({}).should.not.be.empty; + }, 'expected {} not to be empty'); + + err(() => { + expect({ foo: 'bar' }).to.be.empty; + ({ foo: 'bar' }).should.be.empty; + }, 'expected { foo: \'bar\' } to be empty'); +} + +function property() { + expect('test').to.have.property('length'); + 'test'.should.have.property('length'); + expect(4).to.not.have.property('length'); + (4).should.not.have.property('length'); + + expect({ 'foo.bar': 'baz' }) + .to.have.property('foo.bar'); + ({ 'foo.bar': 'baz' }).should.have.property('foo.bar'); + expect({ foo: { bar: 'baz' } }) + .to.not.have.property('foo.bar'); + ({ foo: { bar: 'baz' } }).should.not.have.property('foo.bar'); + + err(() => { + expect('asd').to.have.property('foo'); + 'asd'.should.have.property('foo'); + }, 'expected \'asd\' to have a property \'foo\''); + err(() => { + expect({ foo: { bar: 'baz' } }) + .to.have.property('foo.bar'); + ({ foo: { bar: 'baz' } }).should.have.property('foo.bar'); + }, 'expected { foo: { bar: \'baz\' } } to have a property \'foo.bar\''); +} + +function deepProperty() { + expect({ 'foo.bar': 'baz' }) + .to.not.have.deep.property('foo.bar'); + ({ 'foo.bar': 'baz' }).should + .not.have.deep.property('foo.bar'); + expect({ foo: { bar: 'baz' } }) + .to.have.deep.property('foo.bar'); + ({ foo: { bar: 'baz' } }).should + .have.deep.property('foo.bar'); + + err(() => { + expect({ 'foo.bar': 'baz' }) + .to.have.deep.property('foo.bar'); + ({ 'foo.bar': 'baz' }).should + .have.deep.property('foo.bar'); + }, 'expected { \'foo.bar\': \'baz\' } to have a deep property \'foo.bar\''); +} + +function property2() { + expect('test').to.have.property('length', 4); + 'test'.should.have.property('length', 4); + expect('asd').to.have.property('constructor', String); + 'asd'.should.have.property('constructor', String); + + err(() => { + expect('asd').to.have.property('length', 4, 'blah'); + 'asd'.should.have.property('length', 4, 'blah'); + }, 'blah: expected \'asd\' to have a property \'length\' of 4, but got 3'); + + err(() => { + expect('asd').to.not.have.property('length', 3, 'blah'); + 'asd'.should.not.have.property('length', 3, 'blah'); + }, 'blah: expected \'asd\' to not have a property \'length\' of 3'); + + err(() => { + expect('asd').to.not.have.property('foo', 3, 'blah'); + 'asd'.should.not.have.property('foo', 3, 'blah'); + }, 'blah: \'asd\' has no property \'foo\''); + + err(() => { + expect('asd').to.have.property('constructor', Number, 'blah'); + 'asd'.should.have.property('constructor', Number, 'blah'); + }, 'blah: expected \'asd\' to have a property \'constructor\' of [Function: Number], but got [Function: String]'); +} + +function deepProperty2() { + expect({ foo: { bar: 'baz' } }) + .to.have.deep.property('foo.bar', 'baz'); + ({ foo: { bar: 'baz' } }).should + .have.deep.property('foo.bar', 'baz'); + + err(() => { + expect({ foo: { bar: 'baz' } }) + .to.have.deep.property('foo.bar', 'quux', 'blah'); + ({ foo: { bar: 'baz' } }).should + .have.deep.property('foo.bar', 'quux', 'blah'); + }, 'blah: expected { foo: { bar: \'baz\' } } to have a deep property \'foo.bar\' of \'quux\', but got \'baz\''); + err(() => { + expect({ foo: { bar: 'baz' } }) + .to.not.have.deep.property('foo.bar', 'baz', 'blah'); + ({ foo: { bar: 'baz' } }).should + .not.have.deep.property('foo.bar', 'baz', 'blah'); + }, 'blah: expected { foo: { bar: \'baz\' } } to not have a deep property \'foo.bar\' of \'baz\''); + err(() => { + expect({ foo: 5 }) + .to.not.have.deep.property('foo.bar', 'baz', 'blah'); + ({ foo: 5 }).should + .not.have.deep.property('foo.bar', 'baz', 'blah'); + }, 'blah: { foo: 5 } has no deep property \'foo.bar\''); +} + +function ownProperty() { + expect('test').to.have.ownProperty('length'); + 'test'.should.have.ownProperty('length'); + expect('test').to.haveOwnProperty('length'); + 'test'.should.haveOwnProperty('length'); + expect({ length: 12 }).to.have.ownProperty('length'); + ({ length: 12 }).should.have.ownProperty('length'); + + err(() => { + expect({ length: 12 }).to.not.have.ownProperty('length', 'blah'); + ({ length: 12 }).should.not.have.ownProperty('length', 'blah'); + }, 'blah: expected { length: 12 } to not have own property \'length\''); +} + +function ownPropertyDescriptor() { + expect('test').to.have.ownPropertyDescriptor('length'); + expect('test').to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 }); + expect('test').not.to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 }); + expect('test').to.haveOwnPropertyDescriptor('length').to.have.property('enumerable', false); + expect('test').to.haveOwnPropertyDescriptor('length').to.contain.keys('value'); + + 'test'.should.have.ownPropertyDescriptor('length'); + 'test'.should.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 }); + 'test'.should.not.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 }); + 'test'.should.haveOwnPropertyDescriptor('length').to.have.property('enumerable', false); + 'test'.should.haveOwnPropertyDescriptor('length').to.contain.keys('value'); +} + +function string() { + expect('foobar').to.have.string('bar'); + 'foobar'.should.have.string('bar'); + expect('foobar').to.have.string('foo'); + 'foobar'.should.have.string('foo'); + expect('foobar').to.not.have.string('baz'); + 'foobar'.should.not.have.string('baz'); + + err(() => { + expect(3).to.have.string('baz'); + (3).should.have.string('baz'); + }, 'expected 3 to be a string'); + + err(() => { + expect('foobar').to.have.string('baz', 'blah'); + 'foobar'.should.have.string('baz', 'blah'); + }, 'blah: expected \'foobar\' to contain \'baz\''); + + err(() => { + expect('foobar').to.not.have.string('bar', 'blah'); + 'foobar'.should.not.have.string('bar', 'blah'); + }, 'blah: expected \'foobar\' to not contain \'bar\''); +} + +function include() { + expect(['foo', 'bar']).to.include('foo'); + ['foo', 'bar'].should.include('foo'); + expect(['foo', 'bar']).to.include('foo'); + ['foo', 'bar'].should.include('foo'); + expect(['foo', 'bar']).to.include('bar'); + ['foo', 'bar'].should.include('bar'); + expect([1, 2]).to.include(1); + [1, 2].should.include(1); + expect(['foo', 'bar']).to.not.include('baz'); + ['foo', 'bar'].should.not.include('baz'); + expect(['foo', 'bar']).to.not.include(1); + ['foo', 'bar'].should.not.include(1); + // alias + + expect(['foo', 'bar']).includes('foo'); + ['foo', 'bar'].should.includes('foo'); + + err(() => { + expect(['foo']).to.include('bar', 'blah'); + ['foo'].should.include('bar', 'blah'); + }, 'blah: expected [ \'foo\' ] to include \'bar\''); + + err(() => { + expect(['bar', 'foo']).to.not.include('foo', 'blah'); + ['bar', 'foo'].should.not.include('foo', 'blah'); + }, 'blah: expected [ \'bar\', \'foo\' ] to not include \'foo\''); +} + +function keys() { + expect({ foo: 1 }).to.have.keys(['foo']); + ({ foo: 1 }).should.have.keys(['foo']); + expect({ foo: 1, bar: 2 }).to.have.keys(['foo', 'bar']); + ({ foo: 1, bar: 2 }).should.have.keys(['foo', 'bar']); + expect({ foo: 1, bar: 2 }).to.have.keys('foo', 'bar'); + ({ foo: 1, bar: 2 }).should.have.keys('foo', 'bar'); + expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('foo', 'bar'); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('foo', 'bar'); + expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('bar', 'foo'); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('bar', 'foo'); + expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('baz'); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('baz'); + // alias + + expect({ foo: 1, bar: 2, baz: 3 }).contains.keys('baz'); + + expect({ foo: 1, bar: 2 }).to.have.all.keys(['foo', 'bar']); + expect({ foo: 1, bar: 2 }).to.have.any.keys(['foo', 'bar']); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.all.keys('baz'); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.any.keys('baz'); + + expect({ foo: 1, bar: 2 }).to.contain.keys('foo'); + ({ foo: 1, bar: 2 }).should.contain.keys('foo'); + expect({ foo: 1, bar: 2 }).to.contain.keys('bar', 'foo'); + ({ foo: 1, bar: 2 }).should.contain.keys('bar', 'foo'); + expect({ foo: 1, bar: 2 }).to.contain.keys(['foo']); + ({ foo: 1, bar: 2 }).should.contain.keys(['foo']); + expect({ foo: 1, bar: 2 }).to.contain.keys(['bar']); + ({ foo: 1, bar: 2 }).should.contain.keys(['bar']); + expect({ foo: 1, bar: 2 }).to.contain.keys(['bar', 'foo']); + ({ foo: 1, bar: 2 }).should.contain.keys(['bar', 'foo']); + + expect({ foo: 1, bar: 2 }).to.not.have.keys('baz'); + ({ foo: 1, bar: 2 }).should.not.have.keys('baz'); + expect({ foo: 1, bar: 2 }).to.not.have.keys('foo', 'baz'); + ({ foo: 1, bar: 2 }).should.not.have.keys('foo', 'baz'); + expect({ foo: 1, bar: 2 }).to.not.contain.keys('baz'); + ({ foo: 1, bar: 2 }).should.not.contain.keys('baz'); + expect({ foo: 1, bar: 2 }).to.not.contain.keys('foo', 'baz'); + ({ foo: 1, bar: 2 }).should.not.contain.keys('foo', 'baz'); + expect({ foo: 1, bar: 2 }).to.not.contain.keys('baz', 'foo'); + ({ foo: 1, bar: 2 }).should.not.contain.keys('baz', 'foo'); + + err(() => { + expect({ foo: 1 }).to.have.keys(); + ({ foo: 1 }).should.have.keys(); + }, 'keys required'); + + err(() => { + expect({ foo: 1 }).to.have.keys([]); + ({ foo: 1 }).should.have.keys([]); + }, 'keys required'); + + err(() => { + expect({ foo: 1 }).to.not.have.keys([]); + ({ foo: 1 }).should.not.have.keys([]); + }, 'keys required'); + + err(() => { + expect({ foo: 1 }).to.contain.keys([]); + ({ foo: 1 }).should.contain.keys([]); + }, 'keys required'); + + err(() => { + expect({ foo: 1 }).to.have.keys(['bar']); + ({ foo: 1 }).should.have.keys(['bar']); + }, 'expected { foo: 1 } to have key \'bar\''); + + err(() => { + expect({ foo: 1 }).to.have.keys(['bar', 'baz']); + ({ foo: 1 }).should.have.keys(['bar', 'baz']); + }, 'expected { foo: 1 } to have keys \'bar\', and \'baz\''); + + err(() => { + expect({ foo: 1 }).to.have.keys(['foo', 'bar', 'baz']); + ({ foo: 1 }).should.have.keys(['foo', 'bar', 'baz']); + }, 'expected { foo: 1 } to have keys \'foo\', \'bar\', and \'baz\''); + + err(() => { + expect({ foo: 1 }).to.not.have.keys(['foo']); + ({ foo: 1 }).should.not.have.keys(['foo']); + }, 'expected { foo: 1 } to not have key \'foo\''); + + err(() => { + expect({ foo: 1 }).to.not.have.keys(['foo']); + ({ foo: 1 }).should.not.have.keys(['foo']); + }, 'expected { foo: 1 } to not have key \'foo\''); + + err(() => { + expect({ foo: 1, bar: 2 }).to.not.have.keys(['foo', 'bar']); + ({ foo: 1, bar: 2 }).should.not.have.keys(['foo', 'bar']); + }, 'expected { foo: 1, bar: 2 } to not have keys \'foo\', and \'bar\''); + + err(() => { + expect({ foo: 1 }).to.not.contain.keys(['foo']); + ({ foo: 1 }).should.not.contain.keys(['foo']); + }, 'expected { foo: 1 } to not contain key \'foo\''); + + err(() => { + expect({ foo: 1 }).to.contain.keys('foo', 'bar'); + ({ foo: 1 }).should.contain.keys('foo', 'bar'); + }, 'expected { foo: 1 } to contain keys \'foo\', and \'bar\''); +} + +function chaining() { + var tea = { name: 'chai', extras: ['milk', 'sugar', 'smile'] }; + expect(tea).to.have.property('extras').with.lengthOf(3); + tea.should.have.property('extras').with.lengthOf(3); + + err(() => { + expect(tea).to.have.property('extras').with.lengthOf(4); + tea.should.have.property('extras').with.lengthOf(4); + }, 'expected [ \'milk\', \'sugar\', \'smile\' ] to have a length of 4 but got 3'); + + expect(tea).to.be.a('object').and.have.property('name', 'chai'); + tea.should.be.a('object').and.have.property('name', 'chai'); +} + +function exxtensible() { + expect({}).to.be.extensible; + expect(Object.preventExtensions({})).to.be.not.extensible; + ({}).should.be.extensible; + Object.preventExtensions({}).should.not.be.extensible; +} +function sealed() { + expect({}).to.be.not.sealed; + expect(Object.seal({})).to.be.sealed; + ({}).should.be.not.sealed; + Object.seal({}).should.be.sealed; +} + +function frozen() { + expect({}).to.be.not.frozen; + expect(Object.freeze({})).to.be.frozen; + ({}).should.be.not.frozen; + Object.freeze({}).should.be.frozen; +} + + +class PoorlyConstructedError { } +function _throw() { + // See GH-45: some poorly-constructed custom errors don't have useful names + // on either their constructor or their constructor prototype, but instead + // only set the name inside the constructor itself. + PoorlyConstructedError.prototype = Object.create(Error.prototype); + + var specificError = new RangeError('boo'); + + var goodFn = () => { } + , badFn = () => { throw new Error('testing'); } + , refErrFn = () => { throw new ReferenceError('hello'); } + , ickyErrFn = () => { throw new PoorlyConstructedError(); } + , specificErrFn = () => { throw specificError; }; + + expect(goodFn).to.not.throw(); + goodFn.should.not.throw(); + should.not.throw(goodFn); + expect(goodFn).to.not.throw(Error); + goodFn.should.not.throw(Error); + should.not.throw(goodFn, Error); + expect(goodFn).to.not.throw(specificError); + goodFn.should.not.throw(specificError); + should.not.throw(goodFn, specificError); + + expect(badFn).to.throw(); + badFn.should.throw(); + should.throw(badFn); + expect(badFn).to.throw(Error); + badFn.should.throw(Error); + should.throw(badFn, Error); + expect(badFn).to.not.throw(ReferenceError); + badFn.should.not.throw(ReferenceError); + should.not.throw(badFn, ReferenceError); + expect(badFn).to.not.throw(specificError); + badFn.should.not.throw(specificError); + should.not.throw(badFn, specificError); + + expect(refErrFn).to.throw(); + refErrFn.should.throw(); + should.throw(refErrFn); + expect(refErrFn).to.throw(ReferenceError); + refErrFn.should.throw(ReferenceError); + should.throw(refErrFn, ReferenceError); + expect(refErrFn).to.throw(Error); + refErrFn.should.throw(Error); + should.throw(refErrFn, Error); + expect(refErrFn).to.not.throw(TypeError); + refErrFn.should.not.throw(TypeError); + should.not.throw(refErrFn, TypeError); + expect(refErrFn).to.not.throw(specificError); + refErrFn.should.not.throw(specificError); + should.not.throw(refErrFn, specificError); + + expect(ickyErrFn).to.throw(); + ickyErrFn.should.throw(); + should.throw(ickyErrFn); + expect(ickyErrFn).to.throw(PoorlyConstructedError); + ickyErrFn.should.throw(PoorlyConstructedError); + should.throw(ickyErrFn, PoorlyConstructedError); + expect(ickyErrFn).to.throw(Error); + ickyErrFn.should.throw(Error); + should.throw(ickyErrFn, Error); + expect(ickyErrFn).to.not.throw(specificError); + ickyErrFn.should.not.throw(specificError); + should.not.throw(ickyErrFn, specificError); + expect(specificErrFn).to.throw(specificError); + specificErrFn.should.throw(specificError); + should.throw(ickyErrFn, specificError); + + expect(badFn).to.throw(/testing/); + badFn.should.throw(/testing/); + should.throw(badFn, /testing/); + expect(badFn).to.not.throw(/hello/); + badFn.should.not.throw(/hello/); + should.not.throw(badFn, /hello/); + expect(badFn).to.throw('testing'); + badFn.should.throw('testing'); + should.throw(badFn, 'testing'); + expect(badFn).to.not.throw('hello'); + badFn.should.not.throw('hello'); + should.not.throw(badFn, 'hello'); + + expect(badFn).to.throw(Error, /testing/); + badFn.should.throw(Error, /testing/); + should.throw(badFn, Error, /testing/); + expect(badFn).to.throw(Error, 'testing'); + badFn.should.throw(Error, 'testing'); + should.throw(badFn, Error, 'testing'); + + err(() => { + expect(goodFn).to.throw(); + goodFn.should.throw(); + should.throw(goodFn); + }, 'expected [Function] to throw an error'); + + err(() => { + expect(goodFn).to.throw(ReferenceError); + goodFn.should.throw(ReferenceError); + should.throw(goodFn, ReferenceError); + }, 'expected [Function] to throw ReferenceError'); + + err(() => { + expect(goodFn).to.throw(specificError); + goodFn.should.throw(specificError); + should.throw(goodFn, specificError); + }, 'expected [Function] to throw [RangeError: boo]'); + + err(() => { + expect(badFn).to.not.throw(); + badFn.should.not.throw(); + should.not.throw(badFn); + }, 'expected [Function] to not throw an error but [Error: testing] was thrown'); + + err(() => { + expect(badFn).to.throw(ReferenceError); + badFn.should.throw(ReferenceError); + should.throw(badFn, ReferenceError); + }, 'expected [Function] to throw \'ReferenceError\' but [Error: testing] was thrown'); + + err(() => { + expect(badFn).to.throw(specificError); + badFn.should.throw(specificError); + should.throw(badFn, specificError); + }, 'expected [Function] to throw [RangeError: boo] but [Error: testing] was thrown'); + + err(() => { + expect(badFn).to.not.throw(Error); + badFn.should.not.throw(Error); + should.not.throw(badFn, Error); + }, 'expected [Function] to not throw \'Error\' but [Error: testing] was thrown'); + + err(() => { + expect(refErrFn).to.not.throw(ReferenceError); + refErrFn.should.not.throw(ReferenceError); + should.not.throw(refErrFn, ReferenceError); + }, 'expected [Function] to not throw \'ReferenceError\' but [ReferenceError: hello] was thrown'); + + err(() => { + expect(badFn).to.throw(PoorlyConstructedError); + badFn.should.throw(PoorlyConstructedError); + should.throw(badFn, PoorlyConstructedError); + }, 'expected [Function] to throw \'PoorlyConstructedError\' but [Error: testing] was thrown'); + + err(() => { + expect(ickyErrFn).to.not.throw(PoorlyConstructedError); + ickyErrFn.should.not.throw(PoorlyConstructedError); + should.not.throw(ickyErrFn, PoorlyConstructedError); + }, /^(expected \[Function\] to not throw 'PoorlyConstructedError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); + + err(() => { + expect(ickyErrFn).to.throw(ReferenceError); + ickyErrFn.should.throw(ReferenceError); + should.throw(ickyErrFn, ReferenceError); + }, /^(expected \[Function\] to throw 'ReferenceError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); + + err(() => { + expect(specificErrFn).to.throw(new ReferenceError('eek')); + specificErrFn.should.throw(new ReferenceError('eek')); + should.throw(specificErrFn, new ReferenceError('eek')); + }, 'expected [Function] to throw [ReferenceError: eek] but [RangeError: boo] was thrown'); + + err(() => { + expect(specificErrFn).to.not.throw(specificError); + specificErrFn.should.not.throw(specificError); + should.not.throw(specificErrFn, specificError); + }, 'expected [Function] to not throw [RangeError: boo]'); + + err(() => { + expect(badFn).to.not.throw(/testing/); + badFn.should.not.throw(/testing/); + should.not.throw(badFn, /testing/); + }, 'expected [Function] to throw error not matching /testing/'); + + err(() => { + expect(badFn).to.throw(/hello/); + badFn.should.throw(/hello/); + should.throw(badFn, /hello/); + }, 'expected [Function] to throw error matching /hello/ but got \'testing\''); + + err(() => { + expect(badFn).to.throw(Error, /hello/, 'blah'); + badFn.should.throw(Error, /hello/, 'blah'); + should.throw(badFn, Error, /hello/, 'blah'); + }, 'blah: expected [Function] to throw error matching /hello/ but got \'testing\''); + + err(() => { + expect(badFn).to.throw(Error, 'hello', 'blah'); + badFn.should.throw(Error, 'hello', 'blah'); + should.throw(badFn, Error, 'hello', 'blah'); + }, 'blah: expected [Function] to throw error including \'hello\' but got \'testing\''); +} + +function use() { + // ReSharper disable once InconsistentNaming + chai.use((_chai) => { + _chai.can.use.any(); + }); +} + +class Klass { + val: number; + constructor() { this.val = 0; } + bar() { } + + static baz() { } +} + +function respondTo() { + var obj = new Klass(); + + expect(Klass).to.respondTo('bar'); + expect(obj).respondsTo('bar'); + Klass.should.respondTo('bar'); + Klass.should.respondsTo('bar'); + expect(Klass).to.not.respondTo('foo'); + Klass.should.not.respondTo('foo'); + expect(Klass).itself.to.respondTo('func'); + expect(Klass).itself.not.to.respondTo('bar'); + + expect(obj).not.to.respondTo('foo'); + obj.should.not.respondTo('foo'); + + err(() => { + expect(Klass).to.respondTo('baz', 'constructor'); + Klass.should.respondTo('baz', 'constructor'); + }, /^(constructor: expected)(.*)(\[Function: Klass\])(.*)(to respond to \'baz\')$/); + + err(() => { + expect(obj).to.respondTo('baz', 'object'); + obj.should.respondTo('baz', 'object'); + }, /^(object: expected)(.*)(\{ foo: \[Function\] \}|\{ Object \()(.*)(to respond to \'baz\')$/); +} + +function satisfy() { + function matcher(num: number) { + return num === 1; + } + + expect(1).to.satisfy(matcher); + (1).should.satisfy(matcher); + + err(() => { + expect(2).to.satisfy(matcher, 'blah'); + (2).should.satisfy(matcher, 'blah'); + }, 'blah: expected 2 to satisfy [Function: matcher]'); +} + +function closeTo() { + expect(1.5).to.be.closeTo(1.0, 0.5); + (1.5).should.be.closeTo(1.0, 0.5); + expect(10).to.be.closeTo(20, 20); + (10).should.be.closeTo(20, 20); + expect(-10).to.be.closeTo(20, 30); + (-10).should.be.closeTo(20, 30); + + err(() => { + expect(2).to.be.closeTo(1.0, 0.5, 'blah'); + (2).should.be.closeTo(1.0, 0.5, 'blah'); + }, 'blah: expected 2 to be close to 1 +/- 0.5'); + + err(() => { + expect(-10).to.be.closeTo(20, 29, 'blah'); + (-10).should.be.closeTo(20, 29, 'blah'); + }, 'blah: expected -10 to be close to 20 +/- 29'); +} + +function includeMembers() { + expect([1, 2, 3]).to.include.members([]); + [1, 2, 3].should.include.members([]); + + expect([1, 2, 3]).to.include.members([3, 2]); + + [1, 2, 3].should.include.members([3, 2]); + + expect([1, 2, 3]).to.not.include.members([8, 4]); + + [1, 2, 3].should.not.include.members([8, 4]); + + expect([1, 2, 3]).to.not.include.members([1, 2, 3, 4]); + + [1, 2, 3].should.not.include.members([1, 2, 3, 4]); +} + +function sameMembers() { + expect([5, 4]).to.have.same.members([4, 5]); + [5, 4].should.have.same.members([4, 5]); + expect([5, 4]).to.have.same.members([5, 4]); + [5, 4].should.have.same.members([5, 4]); + + expect([5, 4]).to.not.have.same.members([]); + [5, 4].should.not.have.same.members([]); + expect([5, 4]).to.not.have.same.members([6, 3]); + [5, 4].should.not.have.same.members([6, 3]); + expect([5, 4]).to.not.have.same.members([5, 4, 2]); + [5, 4].should.not.have.same.members([5, 4, 2]); + + assert.sameMembers([5, 4], [4, 5]); +} +function sameDeepMembers() { + expect([{ id: 5 }, { id: 4 }]).to.have.same.deep.members([{ id: 4 }, { id: 5 }]); + [{ id: 5 }, { id: 4 }].should.have.same.deep.members([{ id: 4 }, { id: 5 }]); + expect([{ id: 5 }, { id: 4 }]).to.have.same.members([{ id: 5 }, { id: 4 }]); + [{ id: 5 }, { id: 4 }].should.have.same.members([{ id: 5 }, { id: 4 }]); + + expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([]); + [{ id: 5 }, { id: 4 }].should.not.have.same.members([]); + expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([{ id: 6 }, { id: 3 }]); + [{ id: 5 }, { id: 4 }].should.not.have.same.members([{ id: 6 }, { id: 3 }]); + expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([{ id: 5 }, { id: 4 }, { id: 2 }]); + [{ id: 5 }, { id: 4 }].should.not.have.same.members([{ id: 5 }, { id: 4 }, { id: 2 }]); + + assert.sameDeepMembers([{ id: 5 }, { id: 4 }], [{ id: 4 }, { id: 5 }]); +} + +function members() { + expect([5, 4]).members([4, 5]); + expect([5, 4]).members([5, 4]); + + expect([5, 4]).not.members([]); + expect([5, 4]).not.members([6, 3]); + expect([5, 4]).not.members([5, 4, 2]); +} + +function increaseDecreaseChange() { + var obj = { val: 10 }; + var inc = () => { obj.val++; }; + var dec = () => { obj.val--; }; + var same = () => { }; + + expect(inc).to.increase(obj, "val"); + expect(inc).increases(obj, "val"); + expect(inc).to.change(obj, "val"); + + expect(dec).to.decrease(obj, "val"); + expect(dec).decreases(obj, "val"); + expect(dec).to.change(obj, "val"); + expect(dec).changes(obj, "val"); + + expect(inc).to.not.decrease(obj, "val"); + expect(dec).to.not.increase(obj, "val"); + expect(same).to.not.increase(obj, "val"); + expect(same).to.not.decrease(obj, "val"); + expect(same).to.not.change(obj, "val"); + + inc.should.increase(obj, "val"); + inc.should.change(obj, "val"); + + dec.should.decrease(obj, "val"); + dec.should.change(obj, "val"); + + inc.should.not.decrease(obj, "val"); + dec.should.not.increase(obj, "val"); + same.should.not.change(obj, "val"); +} + +//tdd +declare function suite(description: string, action: Function): void; +declare function test(description: string, action: Function): void; + +interface FieldObj { + field: any; +} + +class CrashyObject { + inspect(): void { + throw new Error('Arg\'s inspect() called even though the test passed'); + } +} + +suite('assert', () => { + + test('assert', () => { + var foo = 'bar'; + assert(foo === 'bar', 'expected foo to equal `bar`'); + + err(() => { + assert(foo === 'baz', 'expected foo to equal `bar`'); + }, 'expected foo to equal `bar`'); + }); + + test('isTrue', () => { + assert.isTrue(true); + + err(() => { + assert.isTrue(false); + }, 'expected false to be true'); + + err(() => { + assert.isTrue(1); + }, 'expected 1 to be true'); + + err(() => { + assert.isTrue('test'); + }, 'expected \'test\' to be true'); + }); + + test('ok', () => { + assert.ok(true); + assert.ok(1); + assert.ok('test'); + assert.isOk(true); + assert.isOk(1); + assert.isOk('test'); + + err(() => { + assert.ok(false); + }, 'expected false to be truthy'); + + err(() => { + assert.ok(0); + }, 'expected 0 to be truthy'); + + err(() => { + assert.ok(''); + }, 'expected \'\' to be truthy'); + }); + + test('notOk', () => { + assert.notOk(false); + assert.notOk(0); + assert.notOk(''); + assert.isNotOk(false); + assert.isNotOk(0); + assert.isNotOk(''); + + err(() => { + assert.notOk(true); + }, 'expected true to be falsy'); + + err(() => { + assert.notOk(1); + }, 'expected 1 to be falsy'); + + err(() => { + assert.notOk('test'); + }, 'expected \'test\' to be falsy'); + }); + + test('isFalse', () => { + assert.isFalse(false); + + err(() => { + assert.isFalse(true); + }, 'expected true to be false'); + + err(() => { + assert.isFalse(0); + }, 'expected 0 to be false'); + }); + + test('equal', () => { + assert.equal(void (0), undefined); + }); + + test('typeof / notTypeOf', () => { + assert.typeOf('test', 'string'); + assert.typeOf(true, 'boolean'); + assert.typeOf(5, 'number'); + + err(() => { + assert.typeOf(5, 'string'); + }, 'expected 5 to be a string'); + + }); + + test('notTypeOf', () => { + assert.notTypeOf('test', 'number'); + + err(() => { + assert.notTypeOf(5, 'number'); + }, 'expected 5 not to be a number'); + }); + + test('instanceOf', () => { + assert.instanceOf(new Foo(), Foo); + + err(() => { + assert.instanceOf(5, Foo); + }, 'expected 5 to be an instance of Foo'); + assert.instanceOf(new CrashyObject(), CrashyObject); + }); + + test('notInstanceOf', () => { + assert.notInstanceOf(new Foo(), String); + + err(() => { + assert.notInstanceOf(new Foo(), Foo); + }, 'expected {} to not be an instance of Foo'); + }); + + test('isObject', () => { + assert.isObject({}); + assert.isObject(new Foo()); + + err(() => { + assert.isObject(true); + }, 'expected true to be an object'); + + err(() => { + assert.isObject(Foo); + }, 'expected [Function: Foo] to be an object'); + + err(() => { + assert.isObject('foo'); + }, 'expected \'foo\' to be an object'); + }); + + test('isNotObject', () => { + assert.isNotObject(5); + + err(() => { + assert.isNotObject({}); + }, 'expected {} not to be an object'); + }); + + test('notEqual', () => { + assert.notEqual(3, 4); + + err(() => { + assert.notEqual(5, 5); + }, 'expected 5 to not equal 5'); + }); + + test('strictEqual', () => { + assert.strictEqual('foo', 'foo'); + + err(() => { + assert.strictEqual('5', 5); + }, 'expected \'5\' to equal 5'); + }); + + test('notStrictEqual', () => { + assert.notStrictEqual(5, '5'); + + err(() => { + assert.notStrictEqual(5, 5); + }, 'expected 5 to not equal 5'); + }); + + test('deepEqual', () => { + assert.deepEqual({ tea: 'chai' }, { tea: 'chai' }); + + err(() => { + assert.deepEqual({ tea: 'chai' }, { tea: 'black' }); + }, 'expected { tea: \'chai\' } to deeply equal { tea: \'black\' }'); + + var obja = Object.create({ tea: 'chai' }) + , objb = Object.create({ tea: 'chai' }); + + assert.deepEqual(obja, objb); + + var obj1 = Object.create({ tea: 'chai' }) + , obj2 = Object.create({ tea: 'black' }); + + err(() => { + assert.deepEqual(obj1, obj2); + }, 'expected { tea: \'chai\' } to deeply equal { tea: \'black\' }'); + }); + + test('deepEqual (ordering)', () => { + var a = { a: 'b', c: 'd' } + , b = { c: 'd', a: 'b' }; + assert.deepEqual(a, b); + }); + + test('deepEqual (circular)', () => { + var circularObject: any = {} + , secondCircularObject: any = {}; + circularObject.field = circularObject; + secondCircularObject.field = secondCircularObject; + + assert.deepEqual(circularObject, secondCircularObject); + + err(() => { + secondCircularObject.field2 = secondCircularObject; + assert.deepEqual(circularObject, secondCircularObject); + }, 'expected { field: [Circular] } to deeply equal { Object (field, field2) }'); + }); + + test('notDeepEqual', () => { + assert.notDeepEqual({ tea: 'jasmine' }, { tea: 'chai' }); + err(() => { + assert.notDeepEqual({ tea: 'chai' }, { tea: 'chai' }); + }, 'expected { tea: \'chai\' } to not deeply equal { tea: \'chai\' }'); + }); + + test('notDeepEqual (circular)', () => { + var circularObject: any = {} + , secondCircularObject: any = { tea: 'jasmine' }; + circularObject.field = circularObject; + secondCircularObject.field = secondCircularObject; + + assert.notDeepEqual(circularObject, secondCircularObject); + + err(() => { + delete secondCircularObject.tea; + assert.notDeepEqual(circularObject, secondCircularObject); + }, 'expected { field: [Circular] } to not deeply equal { field: [Circular] }'); + }); + + test('isNull', () => { + assert.isNull(null); + + err(() => { + assert.isNull(undefined); + }, 'expected undefined to equal null'); + }); + + test('isNotNull', () => { + assert.isNotNull(undefined); + + err(() => { + assert.isNotNull(null); + }, 'expected null to not equal null'); + }); + + test('isUndefined', () => { + assert.isUndefined(undefined); + + err(() => { + assert.isUndefined(null); + }, 'expected null to equal undefined'); + }); + + test('isDefined', () => { + assert.isDefined(null); + + err(() => { + assert.isDefined(undefined); + }, 'expected undefined to not equal undefined'); + }); + + test('isNaN', () => { + assert.isNaN(NaN); + + err(() => { + assert.isNaN(12); + }, 'expected 12 to be NaN'); + }); + + test('isNotNaN', () => { + assert.isNotNaN(12); + + err(() => { + assert.isNotNaN(NaN); + }, 'expected NaN to not NaN'); + }); + + test('isFunction', () => { + var func = () => { + }; + assert.isFunction(func); + + err(() => { + assert.isFunction({}); + }, 'expected {} to be a function'); + }); + + test('isNotFunction', () => { + assert.isNotFunction(5); + + err(() => { + assert.isNotFunction(() => { + }); + }, 'expected [Function] not to be a function'); + }); + + test('isArray', () => { + assert.isArray([]); + assert.isArray(new Array()); + + err(() => { + assert.isArray({}); + }, 'expected {} to be an array'); + }); + + test('isNotArray', () => { + assert.isNotArray(3); + + err(() => { + assert.isNotArray([]); + }, 'expected [] not to be an array'); + + err(() => { + assert.isNotArray(new Array()); + }, 'expected [] not to be an array'); + }); + + test('isString', () => { + assert.isString('Foo'); + assert.isString(new String('foo')); + + err(() => { + assert.isString(1); + }, 'expected 1 to be a string'); + }); + + test('isNotString', () => { + assert.isNotString(3); + assert.isNotString(['hello']); + + err(() => { + assert.isNotString('hello'); + }, 'expected \'hello\' not to be a string'); + }); + + test('isNumber', () => { + assert.isNumber(1); + assert.isNumber(Number('3')); + + err(() => { + assert.isNumber('1'); + }, 'expected \'1\' to be a number'); + }); + + test('isNotNumber', () => { + assert.isNotNumber('hello'); + assert.isNotNumber([5]); + + err(() => { + assert.isNotNumber(4); + }, 'expected 4 not to be a number'); + }); + + test('isBoolean', () => { + assert.isBoolean(true); + assert.isBoolean(false); + + err(() => { + assert.isBoolean('1'); + }, 'expected \'1\' to be a boolean'); + }); + + test('isNotBoolean', () => { + assert.isNotBoolean('true'); + + err(() => { + assert.isNotBoolean(true); + }, 'expected true not to be a boolean'); + + err(() => { + assert.isNotBoolean(false); + }, 'expected false not to be a boolean'); + }); + + test('include', () => { + assert.include('foobar', 'bar'); + assert.include([1, 2, 3], 3); + + err(() => { + assert.include('foobar', 'baz'); + }, 'expected \'foobar\' to contain \'baz\''); + + err(() => { + assert.include(undefined, 'bar'); + }, 'expected an array or string'); + }); + + test('notInclude', () => { + assert.notInclude('foobar', 'baz'); + assert.notInclude([1, 2, 3], 4); + + err(() => { + assert.notInclude('foobar', 'bar'); + }, 'expected \'foobar\' to not contain \'bar\''); + + err(() => { + assert.notInclude(undefined, 'bar'); + }, 'expected an array or string'); + }); + + test('lengthOf', () => { + assert.lengthOf([1, 2, 3], 3); + assert.lengthOf('foobar', 6); + + err(() => { + assert.lengthOf('foobar', 5); + }, 'expected \'foobar\' to have a length of 5 but got 6'); + + err(() => { + assert.lengthOf(1, 5); + }, 'expected 1 to have a property \'length\''); + }); + + test('match', () => { + assert.match('foobar', /^foo/); + assert.notMatch('foobar', /^bar/); + + err(() => { + assert.match('foobar', /^bar/i); + }, 'expected \'foobar\' to match /^bar/i'); + + err(() => { + assert.notMatch('foobar', /^foo/i); + }, 'expected \'foobar\' not to match /^foo/i'); + }); + + test('property', () => { + var obj = { foo: { bar: 'baz' } }; + var simpleObj = { foo: 'bar' }; + assert.property(obj, 'foo'); + assert.deepProperty(obj, 'foo.bar'); + assert.notProperty(obj, 'baz'); + assert.notProperty(obj, 'foo.bar'); + assert.notDeepProperty(obj, 'foo.baz'); + assert.deepPropertyVal(obj, 'foo.bar', 'baz'); + assert.deepPropertyNotVal(obj, 'foo.bar', 'flow'); + + err(() => { + assert.property(obj, 'baz'); + }, 'expected { foo: { bar: \'baz\' } } to have a property \'baz\''); + + err(() => { + assert.deepProperty(obj, 'foo.baz'); + }, 'expected { foo: { bar: \'baz\' } } to have a deep property \'foo.baz\''); + + err(() => { + assert.notProperty(obj, 'foo'); + }, 'expected { foo: { bar: \'baz\' } } to not have property \'foo\''); + + err(() => { + assert.notDeepProperty(obj, 'foo.bar'); + }, 'expected { foo: { bar: \'baz\' } } to not have deep property \'foo.bar\''); + + err(() => { + assert.propertyVal(simpleObj, 'foo', 'ball'); + }, 'expected { foo: \'bar\' } to have a property \'foo\' of \'ball\', but got \'bar\''); + + err(() => { + assert.deepPropertyVal(obj, 'foo.bar', 'ball'); + }, 'expected { foo: { bar: \'baz\' } } to have a deep property \'foo.bar\' of \'ball\', but got \'baz\''); + + err(() => { + assert.propertyNotVal(simpleObj, 'foo', 'bar'); + }, 'expected { foo: \'bar\' } to not have a property \'foo\' of \'bar\''); + + err(() => { + assert.deepPropertyNotVal(obj, 'foo.bar', 'baz'); + }, 'expected { foo: { bar: \'baz\' } } to not have a deep property \'foo.bar\' of \'baz\''); + }); + + test('throws', () => { + assert.throws(() => { + throw new Error('foo'); + }); + assert.throws(() => { + throw new Error('bar'); + }, 'bar'); + assert.throws(() => { + throw new Error('bar'); + }, /bar/); + assert.throws(() => { + throw new Error('bar'); + }, Error); + assert.throws(() => { + throw new Error('bar'); + }, Error, 'bar'); + + err(() => { + assert.throws(() => { + throw new Error('foo'); + }, TypeError); + }, 'expected [Function] to throw \'TypeError\' but [Error: foo] was thrown'); + + err(() => { + assert.throws(() => { + throw new Error('foo'); + }, 'bar'); + }, 'expected [Function] to throw error including \'bar\' but got \'foo\''); + + err(() => { + assert.throws(() => { + throw new Error('foo'); + }, Error, 'bar'); + }, 'expected [Function] to throw error including \'bar\' but got \'foo\''); + + err(() => { + assert.throws(() => { + throw new Error('foo'); + }, TypeError, 'bar'); + }, 'expected [Function] to throw \'TypeError\' but [Error: foo] was thrown'); + + err(() => { + assert.throws(() => { + }); + }, 'expected [Function] to throw an error'); + + err(() => { + assert.throws(() => { + throw new Error(''); + }, 'bar'); + }, 'expected [Function] to throw error including \'bar\' but got \'\''); + + err(() => { + assert.throws(() => { + throw new Error(''); + }, /bar/); + }, 'expected [Function] to throw error matching /bar/ but got \'\''); + }); + + test('doesNotThrow', () => { + assert.doesNotThrow(() => { + }); + assert.doesNotThrow(() => { + }, 'foo'); + + err(() => { + assert.doesNotThrow(() => { + throw new Error('foo'); + }); + }, 'expected [Function] to not throw an error but [Error: foo] was thrown'); + }); + + test('ifError', () => { + assert.ifError(false); + assert.ifError(null); + assert.ifError(undefined); + + err(() => { + assert.ifError('foo'); + }, 'expected \'foo\' to be falsy'); + }); + + test('operator', () => { + assert.operator(1, '<', 2); + assert.operator(2, '>', 1); + assert.operator(1, '==', 1); + assert.operator(1, '<=', 1); + assert.operator(1, '>=', 1); + assert.operator(1, '!=', 2); + assert.operator(1, '!==', 2); + + err(() => { + assert.operator(1, '=', 2); + }, 'Invalid operator "="'); + + err(() => { + assert.operator(2, '<', 1); + }, 'expected 2 to be < 1'); + + err(() => { + assert.operator(1, '>', 2); + }, 'expected 1 to be > 2'); + + err(() => { + assert.operator(1, '==', 2); + }, 'expected 1 to be == 2'); + + err(() => { + assert.operator(2, '<=', 1); + }, 'expected 2 to be <= 1'); + + err(() => { + assert.operator(1, '>=', 2); + }, 'expected 1 to be >= 2'); + + err(() => { + assert.operator(1, '!=', 1); + }, 'expected 1 to be != 1'); + + err(() => { + assert.operator(1, '!==', '1'); + }, 'expected 1 to be !== \'1\''); + }); + + test('closeTo', () => { + assert.closeTo(1.5, 1.0, 0.5); + assert.closeTo(10, 20, 20); + assert.closeTo(-10, 20, 30); + + err(() => { + assert.closeTo(2, 1.0, 0.5); + }, 'expected 2 to be close to 1 +/- 0.5'); + + err(() => { + assert.closeTo(-10, 20, 29); + }, 'expected -10 to be close to 20 +/- 29'); + }); + + test('members', () => { + assert.includeMembers([1, 2, 3], [2, 3]); + assert.includeMembers([1, 2, 3], []); + assert.includeMembers([1, 2, 3], [3]); + + err(() => { + assert.includeMembers([5, 6], [7, 8]); + }, 'expected [ 5, 6 ] to be a superset of [ 7, 8 ]'); + + err(() => { + assert.includeMembers([5, 6], [5, 6, 0]); + }, 'expected [ 5, 6 ] to be a superset of [ 5, 6, 0 ]'); + }); + + test('memberEquals', () => { + assert.sameMembers([], []); + assert.sameMembers([1, 2, 3], [3, 2, 1]); + assert.sameMembers([4, 2], [4, 2]); + + err(() => { + assert.sameMembers([], [1, 2]); + }, 'expected [] to have the same members as [ 1, 2 ]'); + + err(() => { + assert.sameMembers([1, 54], [6, 1, 54]); + }, 'expected [ 1, 54 ] to have the same members as [ 6, 1, 54 ]'); + }); + + + test('isAbove', () => { + assert.isAbove(10, 5); + + err(() => { + assert.isAbove(1, 5); + }, 'expected 1 to be above 5'); + err(() => { + assert.isAbove(5, 5); + }, 'expected 5 to be above 5'); + }); + + test('isBelow', () => { + assert.isBelow(5, 10); + + err(() => { + assert.isBelow(5, 1); + }, 'expected 5 to be above 1'); + err(() => { + assert.isBelow(5, 5); + }, 'expected 5 to be below 5'); + }); + + test('extensible', () => { assert.extensible({}); }); + test('isExtensible', () => { assert.isExtensible({}); }); + test('notExtensible', () => { assert.notExtensible(Object.preventExtensions({})); }); + test('isNotExtensible', () => { assert.isNotExtensible(Object.preventExtensions({})); }); + + test('sealed', () => { assert.sealed(Object.seal({})); }); + test('isSealed', () => { assert.isSealed(Object.seal({})); }); + test('notSealed', () => { assert.notSealed({}); }); + test('isNotSealed', () => { assert.isNotSealed({}); }); + + test('frozen', () => { assert.frozen(Object.freeze({})); }); + test('isFrozen', () => { assert.isFrozen(Object.freeze({})); }); + test('notFrozen', () => { assert.notFrozen({}); }); + test('isNotFrozen', () => { assert.isNotFrozen({}); }); + +}); diff --git a/chai/chai-3.2.0.d.ts b/chai/chai-3.2.0.d.ts new file mode 100644 index 000000000..e68e6fa3b --- /dev/null +++ b/chai/chai-3.2.0.d.ts @@ -0,0 +1,388 @@ +// Type definitions for chai 3.2.0 +// Project: http://chaijs.com/ +// Definitions by: Jed Mao , +// Bart van der Schoor , +// Andrew Brown , +// Olivier Chevet +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// + +declare module Chai { + + interface ChaiStatic { + expect: ExpectStatic; + should(): Should; + /** + * Provides a way to extend the internals of Chai + */ + use(fn: (chai: any, utils: any) => void): any; + assert: AssertStatic; + config: Config; + AssertionError: typeof AssertionError; + } + + export interface ExpectStatic extends AssertionStatic { + fail(actual?: any, expected?: any, message?: string, operator?: string): void; + } + + export interface AssertStatic extends Assert { + } + + export interface AssertionStatic { + (target: any, message?: string): Assertion; + } + + interface ShouldAssertion { + equal(value1: any, value2: any, message?: string): void; + Throw: ShouldThrow; + throw: ShouldThrow; + exist(value: any, message?: string): void; + } + + interface Should extends ShouldAssertion { + not: ShouldAssertion; + fail(actual: any, expected: any, message?: string, operator?: string): void; + } + + interface ShouldThrow { + (actual: Function): void; + (actual: Function, expected: string|RegExp, message?: string): void; + (actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void; + } + + interface Assertion extends LanguageChains, NumericComparison, TypeComparison { + not: Assertion; + deep: Deep; + any: KeyFilter; + all: KeyFilter; + a: TypeComparison; + an: TypeComparison; + include: Include; + includes: Include; + contain: Include; + contains: Include; + ok: Assertion; + true: Assertion; + false: Assertion; + null: Assertion; + undefined: Assertion; + NaN: Assertion; + exist: Assertion; + empty: Assertion; + arguments: Assertion; + Arguments: Assertion; + equal: Equal; + equals: Equal; + eq: Equal; + eql: Equal; + eqls: Equal; + property: Property; + ownProperty: OwnProperty; + haveOwnProperty: OwnProperty; + ownPropertyDescriptor: OwnPropertyDescriptor; + haveOwnPropertyDescriptor: OwnPropertyDescriptor; + length: Length; + lengthOf: Length; + match: Match; + matches: Match; + string(string: string, message?: string): Assertion; + keys: Keys; + key(string: string): Assertion; + throw: Throw; + throws: Throw; + Throw: Throw; + respondTo: RespondTo; + respondsTo: RespondTo; + itself: Assertion; + satisfy: Satisfy; + satisfies: Satisfy; + closeTo(expected: number, delta: number, message?: string): Assertion; + members: Members; + increase: PropertyChange; + increases: PropertyChange; + decrease: PropertyChange; + decreases: PropertyChange; + change: PropertyChange; + changes: PropertyChange; + extensible: Assertion; + sealed: Assertion; + frozen: Assertion; + + } + + interface LanguageChains { + to: Assertion; + be: Assertion; + been: Assertion; + is: Assertion; + that: Assertion; + which: Assertion; + and: Assertion; + has: Assertion; + have: Assertion; + with: Assertion; + at: Assertion; + of: Assertion; + same: Assertion; + } + + interface NumericComparison { + above: NumberComparer; + gt: NumberComparer; + greaterThan: NumberComparer; + least: NumberComparer; + gte: NumberComparer; + below: NumberComparer; + lt: NumberComparer; + lessThan: NumberComparer; + most: NumberComparer; + lte: NumberComparer; + within(start: number, finish: number, message?: string): Assertion; + } + + interface NumberComparer { + (value: number, message?: string): Assertion; + } + + interface TypeComparison { + (type: string, message?: string): Assertion; + instanceof: InstanceOf; + instanceOf: InstanceOf; + } + + interface InstanceOf { + (constructor: Object, message?: string): Assertion; + } + + interface Deep { + equal: Equal; + include: Include; + property: Property; + members: Members; + } + + interface KeyFilter { + keys: Keys; + } + + interface Equal { + (value: any, message?: string): Assertion; + } + + interface Property { + (name: string, value?: any, message?: string): Assertion; + } + + interface OwnProperty { + (name: string, message?: string): Assertion; + } + + interface OwnPropertyDescriptor { + (name: string, descriptor: PropertyDescriptor, message?: string): Assertion; + (name: string, message?: string): Assertion; + } + + interface Length extends LanguageChains, NumericComparison { + (length: number, message?: string): Assertion; + } + + interface Include { + (value: Object, message?: string): Assertion; + (value: string, message?: string): Assertion; + (value: number, message?: string): Assertion; + keys: Keys; + members: Members; + any: KeyFilter; + all: KeyFilter; + } + + interface Match { + (regexp: RegExp|string, message?: string): Assertion; + } + + interface Keys { + (...keys: string[]): Assertion; + (keys: any[]): Assertion; + (keys: Object): Assertion; + } + + interface Throw { + (): Assertion; + (expected: string, message?: string): Assertion; + (expected: RegExp, message?: string): Assertion; + (constructor: Error, expected?: string, message?: string): Assertion; + (constructor: Error, expected?: RegExp, message?: string): Assertion; + (constructor: Function, expected?: string, message?: string): Assertion; + (constructor: Function, expected?: RegExp, message?: string): Assertion; + } + + interface RespondTo { + (method: string, message?: string): Assertion; + } + + interface Satisfy { + (matcher: Function, message?: string): Assertion; + } + + interface Members { + (set: any[], message?: string): Assertion; + } + + interface PropertyChange { + (object: Object, prop: string, msg?: string): Assertion; + } + + export interface Assert { + /** + * @param expression Expression to test for truthiness. + * @param message Message to display on error. + */ + (expression: any, message?: string): void; + + fail(actual?: any, expected?: any, msg?: string, operator?: string): void; + + ok(val: any, msg?: string): void; + isOk(val: any, msg?: string): void; + notOk(val: any, msg?: string): void; + isNotOk(val: any, msg?: string): void; + + equal(act: any, exp: any, msg?: string): void; + notEqual(act: any, exp: any, msg?: string): void; + + strictEqual(act: any, exp: any, msg?: string): void; + notStrictEqual(act: any, exp: any, msg?: string): void; + + deepEqual(act: any, exp: any, msg?: string): void; + notDeepEqual(act: any, exp: any, msg?: string): void; + + isTrue(val: any, msg?: string): void; + isFalse(val: any, msg?: string): void; + + isNull(val: any, msg?: string): void; + isNotNull(val: any, msg?: string): void; + + isUndefined(val: any, msg?: string): void; + isDefined(val: any, msg?: string): void; + + isNaN(val: any, msg?: string): void; + isNotNaN(val: any, msg?: string): void; + + isAbove(val: number, abv: number, msg?: string): void; + isBelow(val: number, blw: number, msg?: string): void; + + isFunction(val: any, msg?: string): void; + isNotFunction(val: any, msg?: string): void; + + isObject(val: any, msg?: string): void; + isNotObject(val: any, msg?: string): void; + + isArray(val: any, msg?: string): void; + isNotArray(val: any, msg?: string): void; + + isString(val: any, msg?: string): void; + isNotString(val: any, msg?: string): void; + + isNumber(val: any, msg?: string): void; + isNotNumber(val: any, msg?: string): void; + + isBoolean(val: any, msg?: string): void; + isNotBoolean(val: any, msg?: string): void; + + typeOf(val: any, type: string, msg?: string): void; + notTypeOf(val: any, type: string, msg?: string): void; + + instanceOf(val: any, type: Function, msg?: string): void; + notInstanceOf(val: any, type: Function, msg?: string): void; + + include(exp: string, inc: any, msg?: string): void; + include(exp: any[], inc: any, msg?: string): void; + + notInclude(exp: string, inc: any, msg?: string): void; + notInclude(exp: any[], inc: any, msg?: string): void; + + match(exp: any, re: RegExp, msg?: string): void; + notMatch(exp: any, re: RegExp, msg?: string): void; + + property(obj: Object, prop: string, msg?: string): void; + notProperty(obj: Object, prop: string, msg?: string): void; + deepProperty(obj: Object, prop: string, msg?: string): void; + notDeepProperty(obj: Object, prop: string, msg?: string): void; + + propertyVal(obj: Object, prop: string, val: any, msg?: string): void; + propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; + + deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void; + deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; + + lengthOf(exp: any, len: number, msg?: string): void; + //alias frenzy + throw(fn: Function, msg?: string): void; + throw(fn: Function, regExp: RegExp): void; + throw(fn: Function, errType: Function, msg?: string): void; + throw(fn: Function, errType: Function, regExp: RegExp): void; + + throws(fn: Function, msg?: string): void; + throws(fn: Function, regExp: RegExp): void; + throws(fn: Function, errType: Function, msg?: string): void; + throws(fn: Function, errType: Function, regExp: RegExp): void; + + Throw(fn: Function, msg?: string): void; + Throw(fn: Function, regExp: RegExp): void; + Throw(fn: Function, errType: Function, msg?: string): void; + Throw(fn: Function, errType: Function, regExp: RegExp): void; + + doesNotThrow(fn: Function, msg?: string): void; + doesNotThrow(fn: Function, regExp: RegExp): void; + doesNotThrow(fn: Function, errType: Function, msg?: string): void; + doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void; + + operator(val: any, operator: string, val2: any, msg?: string): void; + closeTo(act: number, exp: number, delta: number, msg?: string): void; + + sameMembers(set1: any[], set2: any[], msg?: string): void; + sameDeepMembers(set1: any[], set2: any[], msg?: string): void; + includeMembers(superset: any[], subset: any[], msg?: string): void; + + ifError(val: any, msg?: string): void; + + isExtensible(obj: {}, msg?: string): void; + extensible(obj: {}, msg?: string): void; + isNotExtensible(obj: {}, msg?: string): void; + notExtensible(obj: {}, msg?: string): void; + + isSealed(obj: {}, msg?: string): void; + sealed(obj: {}, msg?: string): void; + isNotSealed(obj: {}, msg?: string): void; + notSealed(obj: {}, msg?: string): void; + + isFrozen(obj: Object, msg?: string): void; + frozen(obj: Object, msg?: string): void; + isNotFrozen(obj: Object, msg?: string): void; + notFrozen(obj: Object, msg?: string): void; + + + } + + export interface Config { + includeStack: boolean; + } + + export class AssertionError { + constructor(message: string, _props?: any, ssf?: Function); + name: string; + message: string; + showDiff: boolean; + stack: string; + } +} + +declare var chai: Chai.ChaiStatic; + +declare module "chai" { + export = chai; +} + +interface Object { + should: Chai.Assertion; +} diff --git a/chai/chai-tests.ts b/chai/chai-tests.ts index 9b646b152..df09aea3e 100644 --- a/chai/chai-tests.ts +++ b/chai/chai-tests.ts @@ -1166,6 +1166,25 @@ function closeTo() { }, 'blah: expected -10 to be close to 20 +/- 29'); } +function approximately() { + expect(1.5).to.be.approximately(1.0, 0.5); + (1.5).should.be.approximately(1.0, 0.5); + expect(10).to.be.approximately(20, 20); + (10).should.be.approximately(20, 20); + expect(-10).to.be.approximately(20, 30); + (-10).should.be.approximately(20, 30); + + err(() => { + expect(2).to.be.approximately(1.0, 0.5, 'blah'); + (2).should.be.approximately(1.0, 0.5, 'blah'); + }, 'blah: expected 2 to be close to 1 +/- 0.5'); + + err(() => { + expect(-10).to.be.approximately(20, 29, 'blah'); + (-10).should.be.approximately(20, 29, 'blah'); + }, 'blah: expected -10 to be close to 20 +/- 29'); +} + function includeMembers() { expect([1, 2, 3]).to.include.members([]); [1, 2, 3].should.include.members([]); @@ -1255,6 +1274,20 @@ function increaseDecreaseChange() { same.should.not.change(obj, "val"); } +function oneOf() { + var obj = { z: 3 }; + + expect(5).to.be.oneOf([1, 5, 4]); + expect('z').to.be.oneOf(['x', 'y', 'z']); + expect(obj).to.be.oneOf([obj]); + + expect(5).to.not.be.oneOf([1, -12, 4]); + expect(5).to.not.be.oneOf([1, [5], 4]); + expect('z').to.not.be.oneOf(['w', 'x', 'y']); + expect('z').to.not.be.oneOf(['x', 'y', ['z']]); + expect(obj).to.not.be.oneOf([{ z: 3 }]); +} + //tdd declare function suite(description: string, action: Function): void; declare function test(description: string, action: Function): void; @@ -1879,6 +1912,20 @@ suite('assert', () => { }, 'expected -10 to be close to 20 +/- 29'); }); + test('approximately', () => { + assert.approximately(1.5, 1.0, 0.5); + assert.approximately(10, 20, 20); + assert.approximately(-10, 20, 30); + + err(() => { + assert.approximately(2, 1.0, 0.5); + }, 'expected 2 to be close to 1 +/- 0.5'); + + err(() => { + assert.approximately(-10, 20, 29); + }, 'expected -10 to be close to 20 +/- 29'); + }); + test('members', () => { assert.includeMembers([1, 2, 3], [2, 3]); assert.includeMembers([1, 2, 3], []); @@ -1945,4 +1992,55 @@ suite('assert', () => { test('notFrozen', () => { assert.notFrozen({}); }); test('isNotFrozen', () => { assert.isNotFrozen({}); }); + test('isNotTrue', () => { + assert.isNotTrue(false); + + err(() => { + assert.isNotTrue(true); + }, 'expected true to not be true'); + }); + + test('isNotFalse', () => { + assert.isNotFalse(true); + + err(() => { + assert.isNotFalse(false); + }, 'expected false to not be false'); + }); + + test('isAtLeast', () => { + assert.isAtLeast(5, 3); + assert.isAtLeast(5, 5); + + err(() => { + assert.isAtLeast(3, 5); + }, 'expected 3 to be greater than or equal to 5'); + }); + + test('isAtMost', () => { + assert.isAtMost(3, 5); + assert.isAtMost(5, 5); + + err(() => { + assert.isAtMost(5, 3); + }, 'expected 5 to be less than or equal to 3'); + }); + + test('oneOf', () => { + var obj = { z: 3 }; + + assert.oneOf(5, [1, 5, 4]); + assert.oneOf('z', ['x', 'y', 'z']); + assert.oneOf(obj, [obj]); + + err(() => { + assert.oneOf(5, [1, [5], 4]); + }, 'expected 5 to be one of [1, [5], 4]'); + err(() => { + assert.oneOf('z', ['w', 'x', 'y']); + }, 'expected "z" to be one of [w, x, y]'); + err(() => { + assert.oneOf(obj, [{ z: 3 }]); + }, 'expected { z: 3 } to be one of [{ z: 3 }]'); + }); }); diff --git a/chai/chai.d.ts b/chai/chai.d.ts index e68e6fa3b..074827b65 100644 --- a/chai/chai.d.ts +++ b/chai/chai.d.ts @@ -1,9 +1,10 @@ -// Type definitions for chai 3.2.0 +// Type definitions for chai 3.4.0 // Project: http://chaijs.com/ // Definitions by: Jed Mao , // Bart van der Schoor , // Andrew Brown , -// Olivier Chevet +// Olivier Chevet , +// Matt Wistrand // Definitions: https://github.com/borisyankov/DefinitelyTyped // @@ -97,7 +98,8 @@ declare module Chai { itself: Assertion; satisfy: Satisfy; satisfies: Satisfy; - closeTo(expected: number, delta: number, message?: string): Assertion; + closeTo: CloseTo; + approximately: CloseTo; members: Members; increase: PropertyChange; increases: PropertyChange; @@ -108,7 +110,7 @@ declare module Chai { extensible: Assertion; sealed: Assertion; frozen: Assertion; - + oneOf(list: any[], message?: string): Assertion; } interface LanguageChains { @@ -155,6 +157,10 @@ declare module Chai { (constructor: Object, message?: string): Assertion; } + interface CloseTo { + (expected: number, delta: number, message?: string): Assertion; + } + interface Deep { equal: Equal; include: Include; @@ -259,6 +265,9 @@ declare module Chai { isTrue(val: any, msg?: string): void; isFalse(val: any, msg?: string): void; + isNotTrue(val: any, msg?: string): void; + isNotFalse(val: any, msg?: string): void; + isNull(val: any, msg?: string): void; isNotNull(val: any, msg?: string): void; @@ -271,6 +280,9 @@ declare module Chai { isAbove(val: number, abv: number, msg?: string): void; isBelow(val: number, blw: number, msg?: string): void; + isAtLeast(val: number, atlst: number, msg?: string): void; + isAtMost(val: number, atmst: number, msg?: string): void; + isFunction(val: any, msg?: string): void; isNotFunction(val: any, msg?: string): void; @@ -339,6 +351,7 @@ declare module Chai { operator(val: any, operator: string, val2: any, msg?: string): void; closeTo(act: number, exp: number, delta: number, msg?: string): void; + approximately(act: number, exp: number, delta: number, msg?: string): void; sameMembers(set1: any[], set2: any[], msg?: string): void; sameDeepMembers(set1: any[], set2: any[], msg?: string): void; @@ -361,7 +374,7 @@ declare module Chai { isNotFrozen(obj: Object, msg?: string): void; notFrozen(obj: Object, msg?: string): void; - + oneOf(inList: any, list: any[], msg?: string): void; } export interface Config { diff --git a/chartjs/chart.d.ts b/chartjs/chart.d.ts index 62f393b8a..464655f78 100644 --- a/chartjs/chart.d.ts +++ b/chartjs/chart.d.ts @@ -136,6 +136,8 @@ interface BarChartOptions extends ChartOptions { barStrokeWidth?: number; barValueSpacing?: number; barDatasetSpacing?: number; + scaleShowHorizontalLines?: boolean; + scaleShowVerticalLines?: boolean; } interface RadarChartOptions extends ChartSettings { diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index febf50a62..17613b88c 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -7578,31 +7578,31 @@ declare module chrome.webNavigation { } interface WebNavigationEvent extends chrome.events.Event { - addListener(callback: (details: WebNavigationCallbackDetails, filters?: WebNavigationEventFilter) => void): void; + addListener(callback: (details: WebNavigationCallbackDetails) => void, filters?: WebNavigationEventFilter): void; } interface WebNavigationFramedEvent extends WebNavigationEvent { - addListener(callback: (details: WebNavigationFramedCallbackDetails, filters?: WebNavigationEventFilter) => void): void; + addListener(callback: (details: WebNavigationFramedCallbackDetails) => void, filters?: WebNavigationEventFilter): void; } interface WebNavigationFramedErrorEvent extends WebNavigationFramedEvent { - addListener(callback: (details: WebNavigationFramedErrorCallbackDetails, filters?: WebNavigationEventFilter) => void): void; + addListener(callback: (details: WebNavigationFramedErrorCallbackDetails) => void, filters?: WebNavigationEventFilter): void; } interface WebNavigationSourceEvent extends WebNavigationEvent { - addListener(callback: (details: WebNavigationSourceCallbackDetails, filters?: WebNavigationEventFilter) => void): void; + addListener(callback: (details: WebNavigationSourceCallbackDetails) => void, filters?: WebNavigationEventFilter): void; } interface WebNavigationParentedEvent extends WebNavigationEvent { - addListener(callback: (details: WebNavigationParentedCallbackDetails, filters?: WebNavigationEventFilter) => void): void; + addListener(callback: (details: WebNavigationParentedCallbackDetails) => void, filters?: WebNavigationEventFilter): void; } interface WebNavigationTransitionalEvent extends WebNavigationEvent { - addListener(callback: (details: WebNavigationTransitionCallbackDetails, filters?: WebNavigationEventFilter) => void): void; + addListener(callback: (details: WebNavigationTransitionCallbackDetails) => void, filters?: WebNavigationEventFilter): void; } interface WebNavigationReplacementEvent extends WebNavigationEvent { - addListener(callback: (details: WebNavigationReplacementCallbackDetails, filters?: WebNavigationEventFilter) => void): void; + addListener(callback: (details: WebNavigationReplacementCallbackDetails) => void, filters?: WebNavigationEventFilter): void; } /** diff --git a/commander/commander.d.ts b/commander/commander.d.ts index cf04591bb..d0efa6305 100644 --- a/commander/commander.d.ts +++ b/commander/commander.d.ts @@ -65,10 +65,11 @@ declare module commander { * * @param {String} name * @param {String} [desc] + * @param {Mixed} [opts] * @return {Command} the new command * @api public */ - command(name:string, desc?:string):ICommand; + command(name:string, desc?:string, opts?: any):ICommand; /** * Add an implicit `help [cmd]` subcommand diff --git a/commonmark/commonmark-tests.ts b/commonmark/commonmark-tests.ts new file mode 100644 index 000000000..4896c0464 --- /dev/null +++ b/commonmark/commonmark-tests.ts @@ -0,0 +1,47 @@ +/// + +import commonmark = require('commonmark'); + +function logNode(node: commonmark.Node) { + + console.log( + node.destination, + node.firstChild, + node.info, + node.isContainer, + node.lastChild, + node.level, + node.listDelimiter, + node.listStart, + node.listTight, + node.listType, + node.literal, + node.next, + node.onEnter, + node.onExit, + node.parent, + node.prev, + node.sourcepos, + node.title, + node.type); + +} + +var parser = new commonmark.Parser({ smart: true, time: true }); +var node = parser.parse('# a piece of _markdown_'); + + +let w = node.walker(); +let step = w.next(); +if (step.entering) { + logNode(step.node); +} + + +let xmlRenderer = new commonmark.XmlRenderer({ sourcepos: true, time: true }); +let xml = xmlRenderer.render(node); +console.log(xml); + +let htmlRenderer = new commonmark.HtmlRenderer({ safe: true, smart: true, sourcepos: true, time: true}); +let html = htmlRenderer.render(node); +console.log(html); \ No newline at end of file diff --git a/commonmark/commonmark.d.ts b/commonmark/commonmark.d.ts new file mode 100644 index 000000000..8f1271451 --- /dev/null +++ b/commonmark/commonmark.d.ts @@ -0,0 +1,214 @@ +// Type definitions for commonmark.js 0.22.1 +// Project: https://github.com/jgm/commonmark.js +// Definitions by: Nico Jansen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +declare module commonmark { + + export interface NodeWalkingStep { + /** + * a boolean, which is true when we enter a Node from a parent or sibling, and false when we reenter it from a child + */ + entering: boolean; + /** + * The node belonging to this step + */ + node: Node; + } + + export interface NodeWalker { + /** + * Returns an object with properties entering and node. Returns null when we have finished walking the tree. + */ + next(): NodeWalkingStep; + /** + * Resets the iterator to resume at the specified node and setting for entering. (Normally this isn't needed unless you do destructive updates to the Node tree.) + */ + resumeAt(node: Node, entering?: boolean): void; + } + + export interface Position extends Array> { + } + + export interface ListData { + type?: string, + tight?: boolean, + delimiter?: string, + bulletChar?: string + } + + export class Node { + constructor(nodeType: string, sourcepos?: Position); + isContainer: boolean; + + /** + * (read-only): one of Text, Softbreak, Hardbreak, Emph, Strong, Html, Link, Image, Code, Document, Paragraph, BlockQuote, Item, List, Heading, CodeBlock, HtmlBlock ThematicBreak. + */ + type: string; + /** + * (read-only): a Node or null. + */ + firstChild: Node; + /** + * (read-only): a Node or null. + */ + lastChild: Node; + /** + * (read-only): a Node or null. + */ + next: Node; + /** + * (read-only): a Node or null. + */ + prev: Node; + /** + * (read-only): a Node or null. + */ + parent: Node; + /** + * (read-only): an Array with the following form: [[startline, startcolumn], [endline, endcolumn]] + */ + sourcepos: Position; + /** + * the literal String content of the node or null. + */ + literal: string; + /** + * link or image destination (String) or null. + */ + destination: string; + /** + * link or image title (String) or null. + */ + title: string; + /** + * fenced code block info string (String) or null. + */ + info: string; + /** + * heading level (Number). + */ + level: number; + /** + * either Bullet or Ordered (or undefined). + */ + listType: string; + /** + * true if list is tight + */ + listTight: boolean; + /** + * a Number, the starting number of an ordered list. + */ + listStart: number; + /** + * a String, either ) or . for an ordered list. + */ + listDelimiter: string; + /** + * used only for CustomBlock or CustomInline. + */ + onEnter: string; + /** + * used only for CustomBlock or CustomInline. + */ + onExit: string; + /** + * Append a Node child to the end of the Node's children. + */ + appendChild(child: Node): void; + /** + * Prepend a Node child to the beginning of the Node's children. + */ + prependChild(child: Node): void; + /** + * Remove the Node from the tree, severing its links with siblings and parents, and closing up gaps as needed. + */ + unlink(): void; + /** + * Insert a Node sibling after the Node. + */ + insertAfter(sibling: Node): void; + /** + * Insert a Node sibling before the Node. + */ + insertBefore(sibling: Node): void; + /** + * Returns a NodeWalker that can be used to iterate through the Node tree rooted in the Node + */ + walker(): NodeWalker; + /** + * Setting the backing object of listType, listTight, listStat and listDelimiter directly. + * Not needed unless creating list nodes directly. Should be fixed from v>0.22.1 + * https://github.com/jgm/commonmark.js/issues/74 + */ + _listData: ListData; + } + + /** + * Instead of converting Markdown directly to HTML, as most converters do, commonmark.js parses Markdown to an AST (abstract syntax tree), and then renders this AST as HTML. + * This opens up the possibility of manipulating the AST between parsing and rendering. For example, one could transform emphasis into ALL CAPS. + */ + export class Parser { + /** + * Constructs a new Parser + */ + constructor(options?: ParserOptions); + parse(input: string): Node; + } + + export interface ParserOptions { + /** + * if true, straight quotes will be made curly, -- will be changed to an en dash, --- will be changed to an em dash, and ... will be changed to ellipses. + */ + smart?: boolean; + time?: boolean; + } + + export interface HtmlRenderingOptions extends XmlRenderingOptions { + /** + * if true, raw HTML will not be passed through to HTML output (it will be replaced by comments), and potentially unsafe URLs in links and images (those beginning with javascript:, vbscript:, file:, and with a few exceptions data:) will be replaced with empty strings. + */ + safe?: boolean; + /** + * if true, straight quotes will be made curly, -- will be changed to an en dash, --- will be changed to an em dash, and ... will be changed to ellipses. + */ + smart?: boolean; + /** + * if true, source position information for block-level elements will be rendered in the data-sourcepos attribute (for HTML) or the sourcepos attribute (for XML). + */ + sourcepos?: boolean; + } + + export class HtmlRenderer { + constructor(options?: HtmlRenderingOptions) + render(root: Node): string; + /** + * Let's you override the softbreak properties of a renderer. So, to make soft breaks render as hard breaks in HTML: + * writer.softbreak = "
"; + */ + softbreak: string; + /** + * Override the function that will be used to escape (sanitize) the html output. Return value is used to add to the html output + * @param input the input to escape + * @param isAttributeValue indicates wheter or not the input value will be used as value of an html attribute. + */ + escape: (input: string, isAttributeValue: boolean) => string; + } + + export interface XmlRenderingOptions { + time?: boolean; + sourcepos?: boolean; + } + + export class XmlRenderer { + constructor(options?: XmlRenderingOptions) + render(root: Node): string; + } + +} + +declare module 'commonmark' { + export = commonmark; +} \ No newline at end of file diff --git a/console-stamp/console-stamp-tests.ts b/console-stamp/console-stamp-tests.ts new file mode 100644 index 000000000..e6ae6895b --- /dev/null +++ b/console-stamp/console-stamp-tests.ts @@ -0,0 +1,21 @@ +/// + +import consoleStamp = require("console-stamp"); + +consoleStamp(console); + +var options = {}; +consoleStamp(console, options); + +var options2 = { + metadata: function ():string { + return 'string'; + }, + colors: { + stamp: "yellow", + label: "white", + metadata: "green" + }, + label: true +}; +consoleStamp(console, options2); diff --git a/console-stamp/console-stamp.d.ts b/console-stamp/console-stamp.d.ts new file mode 100644 index 000000000..a798dc66c --- /dev/null +++ b/console-stamp/console-stamp.d.ts @@ -0,0 +1,46 @@ +// Type definitions for console-stamp 0.2.0 +// Project: https://github.com/starak/node-console-stamp +// Definitions by: Eric Byers +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'console-stamp' { + + function consoleStamp(console:{}, options?: { + /** + * A string with date format based on Javascript Date Format + */ + pattern?: string + + /** + * If true it will show the label (LOG | INFO | WARN | ERROR) + */ + label?: boolean; + + /** + * An array containing the methods to include in the patch + */ + include?: any; + + /** + * An array containing the methods to exclude in the patch) + */ + exclude?: any; + + /** + * Types can be String, Object (interpreted with util.inspect), or Function. See the test-metadata.js for examples. + * Note that metadata can still be sent as the third parameter (as in vesion 1.6) as a backward compatibillity feature, but this is deprecated. + */ + metadata?: any; + + /** + * An object representing a color theme. More info https://www.npmjs.com/package/colors + */ + colors?: { + stamp?: any; + label?: any; + metadata?: any; + }; + }): void; + + export = consoleStamp; +} diff --git a/consolidate/consolidate-tests.ts b/consolidate/consolidate-tests.ts index bf4fea449..77fddb631 100644 --- a/consolidate/consolidate-tests.ts +++ b/consolidate/consolidate-tests.ts @@ -1,27 +1,168 @@ /// +import cons = require('consolidate'); -import consolidate = require('consolidate'); +var path: string = 'test/path'; +var options = {user: 'tobi'}; +var fn = function(err: Error, html: string) {}; + +cons.atpl(path); +cons.atpl(path, options); +cons.atpl(path, options, fn); + +cons.dot(path); +cons.dot(path, options); +cons.dot(path, options, fn); + +cons.dust(path); +cons.dust(path, options); +cons.dust(path, options, fn); + +cons.eco(path); +cons.eco(path, options); +cons.eco(path, options, fn); + +cons.ect(path); +cons.ect(path, options); +cons.ect(path, options, fn); + +cons.ejs(path); +cons.ejs(path, options); +cons.ejs(path, options, fn); + +cons.haml(path); +cons.haml(path, options); +cons.haml(path, options, fn); + +// TODO figure out how to type haml-coffee +// cons['haml-coffee'](path, options, fn); + +cons.hamlet(path); +cons.hamlet(path, options); +cons.hamlet(path, options, fn); + +cons.handlebars(path); +cons.handlebars(path, options); +cons.handlebars(path, options, fn); + +cons.hogan(path); +cons.hogan(path, options); +cons.hogan(path, options, fn); + +cons.htmling(path); +cons.htmling(path, options); +cons.htmling(path, options, fn); + +cons.jade(path); +cons.jade(path, options); +cons.jade(path, options, fn); + +cons.jazz(path); +cons.jazz(path, options); +cons.jazz(path, options, fn); + +cons.jqtpl(path); +cons.jqtpl(path, options); +cons.jqtpl(path, options, fn); + +cons.just(path); +cons.just(path, options); +cons.just(path, options, fn); + +cons.liquid(path); +cons.liquid(path, options); +cons.liquid(path, options, fn); + +cons.liquor(path); +cons.liquor(path, options); +cons.liquor(path, options, fn); + +cons.lodash(path); +cons.lodash(path, options); +cons.lodash(path, options, fn); + +cons.mote(path); +cons.mote(path, options); +cons.mote(path, options, fn); + +cons.mustache(path); +cons.mustache(path, options); +cons.mustache(path, options, fn); + +cons.nunjucks(path); +cons.nunjucks(path, options); +cons.nunjucks(path, options, fn); + +cons.qejs(path); +cons.qejs(path, options); +cons.qejs(path, options, fn); + +cons.ractive(path); +cons.ractive(path, options); +cons.ractive(path, options, fn); + +cons.react(path); +cons.react(path, options); +cons.react(path, options, fn); + +cons.swig(path); +cons.swig(path, options); +cons.swig(path, options, fn); + +cons.templayed(path); +cons.templayed(path, options); +cons.templayed(path, options, fn); + +cons.toffee(path); +cons.toffee(path, options); +cons.toffee(path, options, fn); + +cons.underscore(path); +cons.underscore(path, options); +cons.underscore(path, options, fn); + +cons.walrus(path); +cons.walrus(path, options); +cons.walrus(path, options, fn); + +cons.whiskers(path); +cons.whiskers(path, options); +cons.whiskers(path, options, fn); + +/** + * Examples from documentation + * https://github.com/tj/consolidate.js/ + */ +// Common use +cons.swig('views/page.html', { user: 'tobi' }, function(err, html) { + if (err) throw err; + console.log(html); +}); + +// Options object is optional +cons.swig('views/page.html', function(err, html) { + if (err) throw err; + console.log(html); +}); + +// To dynamically pass the engine, simply use the subscript operator and a variable: +cons['swig']('views/page.html', { user: 'tobi' }, function(err, html) { + if (err) throw err; + console.log(html); +}); + +// Returns a promise if no is callback passed in: +cons.swig('views/page.html', { user: 'tobi' }) + .then(function(html) { + console.log(html); + }) + .catch(function(err) { + throw err; + }); + +// Caching +cons.swig('views/page.html', { cache: false, user: 'tobi' }, function(err, html) { + if (err) throw err; + console.log(html); +}); -var path: string = null; -var options: any = null; -var fn: any = null; -consolidate.clearCache(); -consolidate.jade(path, options, fn); -consolidate.dust(path, options, fn); -consolidate.swig(path, options, fn); -consolidate.liquor(path, options, fn); -consolidate.ejs(path, options, fn); -consolidate.eco(path, options, fn); -consolidate.jazz(path, options, fn); -consolidate.jqtpl(path, options, fn); -consolidate.haml(path, options, fn); -consolidate.whiskers(path, options, fn); -//consolidate.'haml-coffee':Function; -consolidate.hogan(path, options, fn); -consolidate.handlebars(path, options, fn); -consolidate.underscore(path, options, fn); -consolidate.qejs(path, options, fn); -consolidate.walrus(path, options, fn); -consolidate.mustache(path, options, fn); -consolidate.dot(path, options, fn); diff --git a/consolidate/consolidate.d.ts b/consolidate/consolidate.d.ts index 3bfe35bf0..db23a3152 100644 --- a/consolidate/consolidate.d.ts +++ b/consolidate/consolidate.d.ts @@ -1,30 +1,75 @@ // Type definitions for consolidate // Project: https://github.com/visionmedia/consolidate.js -// Definitions by: Carlos Ballesteros Velasco +// Definitions by: Carlos Ballesteros Velasco , Theo Sherry // Definitions: https://github.com/borisyankov/DefinitelyTyped // Imported from: https://github.com/soywiz/typescript-node-definitions/consolidate.d.ts /// +/// declare module "consolidate" { - export function clearCache(): void; - export var jade: (path: String, options: any, fn: any) => void; - export var dust: (path: String, options: any, fn: any) => void; - export var swig: (path: String, options: any, fn: any) => void; - export var liquor: (path: String, options: any, fn: any) => void; - export var ejs: (path: String, options: any, fn: any) => void; - export var eco: (path: String, options: any, fn: any) => void; - export var jazz: (path: String, options: any, fn: any) => void; - export var jqtpl: (path: String, options: any, fn: any) => void; - export var haml: (path: String, options: any, fn: any) => void; - export var whiskers: (path: String, options: any, fn: any) => void; - //export var 'haml-coffee':Function; - export var hogan: (path: String, options: any, fn: any) => void; - export var handlebars: (path: String, options: any, fn: any) => void; - export var underscore: (path: String, options: any, fn: any) => void; - export var qejs: (path: String, options: any, fn: any) => void; - export var walrus: (path: String, options: any, fn: any) => void; - export var mustache: (path: String, options: any, fn: any) => void; - export var dot: (path: String, options: any, fn: any) => void; + var cons: Consolidate; + + export = cons; + + interface Consolidate { + /** + * expose the instance of the engine + */ + requires: Object; + + /** + * Clear the cache. + * + * @api public + */ + clearCache(): void; + // template engines + atpl: RendererInterface; + dot: RendererInterface; + dust: RendererInterface; + eco: RendererInterface; + ejs: RendererInterface; + ect: RendererInterface; + haml: RendererInterface; + // TODO figure out how to do haml-coffee + hamlet: RendererInterface; + handlebars: RendererInterface; + hogan: RendererInterface; + htmling: RendererInterface; + jade: RendererInterface; + jazz: RendererInterface; + jqtpl: RendererInterface; + just: RendererInterface; + liquid: RendererInterface; + liquor: RendererInterface; + lodash: RendererInterface; + mote: RendererInterface; + mustache: RendererInterface; + nunjucks: RendererInterface; + qejs: RendererInterface; + ractive: RendererInterface; + react: RendererInterface; + swig: RendererInterface; + templayed: RendererInterface; + toffee: RendererInterface; + underscore: RendererInterface; + walrus: RendererInterface; + whiskers: RendererInterface; + } + + interface RendererInterface { + render(path: String, fn: (err: Error, html: String) => any): any; + + render(path: String, options: {cache?: boolean, [otherOptions: string]: any}, fn: (err: Error, html: String) => any): any; + + render(path: String, options?: { cache?: boolean, [otherOptions: string]: any }): Promise; + + (path: String, fn: (err: Error, html: String) => any): any; + + (path: String, options: { cache?: boolean, [otherOptions: string]: any }, fn: (err: Error, html: String) => any): any; + + (path: String, options?: { cache?: boolean, [otherOptions: string]: any }): Promise; + } } diff --git a/contentful-resolve-response/contentful-resolve-response-tests.ts b/contentful-resolve-response/contentful-resolve-response-tests.ts new file mode 100644 index 000000000..098641e7b --- /dev/null +++ b/contentful-resolve-response/contentful-resolve-response-tests.ts @@ -0,0 +1,20 @@ +/// +import resolveResponse = require('contentful-resolve-response'); + +var response = { + items: [ + { + someValue: 'wow', + someLink: {sys: {type: 'Link', linkType: 'Entry', id: 'suchId'}} + } + ], + includes: { + Entry: [ + {sys: {type: 'Entry', id: 'suchId'}, very: 'doge'} + ] + } +}; + +var items = resolveResponse(response) + +console.log(items); diff --git a/contentful-resolve-response/contentful-resolve-response.d.ts b/contentful-resolve-response/contentful-resolve-response.d.ts new file mode 100644 index 000000000..bd2daef9e --- /dev/null +++ b/contentful-resolve-response/contentful-resolve-response.d.ts @@ -0,0 +1,9 @@ +// Type definitions for contentful-resolve-response v0.1.2 +// Project: https://github.com/contentful/contentful-resolve-response +// Definitions by: Anton Karsten +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'contentful-resolve-response' { + function resolveResponse(response: any): any; + export = resolveResponse; +} diff --git a/cookies/cookies.d.ts b/cookies/cookies.d.ts index 53de9fe09..5cc5f698a 100644 --- a/cookies/cookies.d.ts +++ b/cookies/cookies.d.ts @@ -8,91 +8,93 @@ declare module "cookies" { import * as http from "http" - interface ICookies { - /** - * This extracts the cookie with the given name from the - * Cookie header in the request. If such a cookie exists, - * its value is returned. Otherwise, nothing is returned. - */ - get(name: string): string; - /** - * This extracts the cookie with the given name from the - * Cookie header in the request. If such a cookie exists, - * its value is returned. Otherwise, nothing is returned. - */ - get(name: string, opts: IOptions): string; - - /** - * This sets the given cookie in the response and returns - * the current context to allow chaining.If the value is omitted, - * an outbound header with an expired date is used to delete the cookie. - */ - set(name: string, value: string): ICookies; - /** - * This sets the given cookie in the response and returns - * the current context to allow chaining.If the value is omitted, - * an outbound header with an expired date is used to delete the cookie. - */ - set(name: string, value: string, opts: IOptions): ICookies; - } + module cookies { + interface ICookies { + /** + * This extracts the cookie with the given name from the + * Cookie header in the request. If such a cookie exists, + * its value is returned. Otherwise, nothing is returned. + */ + get(name: string): string; + /** + * This extracts the cookie with the given name from the + * Cookie header in the request. If such a cookie exists, + * its value is returned. Otherwise, nothing is returned. + */ + get(name: string, opts: IOptions): string; + + /** + * This sets the given cookie in the response and returns + * the current context to allow chaining.If the value is omitted, + * an outbound header with an expired date is used to delete the cookie. + */ + set(name: string, value: string): ICookies; + /** + * This sets the given cookie in the response and returns + * the current context to allow chaining.If the value is omitted, + * an outbound header with an expired date is used to delete the cookie. + */ + set(name: string, value: string, opts: IOptions): ICookies; + } - interface IOptions { - /** - * a number representing the milliseconds from Date.now() for expiry - */ - maxAge?: number; - /** - * a Date object indicating the cookie's expiration - * date (expires at the end of session by default). - */ - expires?: Date; - /** - * a string indicating the path of the cookie (/ by default). - */ - path?: string; - /** - * a string indicating the domain of the cookie (no default). - */ - domain?: string; - /** - * a boolean indicating whether the cookie is only to be sent - * over HTTPS (false by default for HTTP, true by default for HTTPS). - */ - secure?: boolean; - /** - * a boolean indicating whether the cookie is only to be sent - * over HTTPS (use this if you handle SSL not in your node process). - */ - secureProxy?: boolean; - /** - * a boolean indicating whether the cookie is only to be sent over HTTP(S), - * and not made available to client JavaScript (true by default). - */ - httpOnly?: boolean; - /** - * a boolean indicating whether the cookie is to be signed (false by default). - * If this is true, another cookie of the same name with the .sig suffix - * appended will also be sent, with a 27-byte url-safe base64 SHA1 value - * representing the hash of cookie-name=cookie-value against the first Keygrip key. - * This signature key is used to detect tampering the next time a cookie is received. - */ - signed?: boolean; - /** - * a boolean indicating whether to overwrite previously set - * cookies of the same name (false by default). If this is true, - * all cookies set during the same request with the same - * name (regardless of path or domain) are filtered out of - * the Set-Cookie header when setting this cookie. - */ - overwrite?: boolean; + interface IOptions { + /** + * a number representing the milliseconds from Date.now() for expiry + */ + maxAge?: number; + /** + * a Date object indicating the cookie's expiration + * date (expires at the end of session by default). + */ + expires?: Date; + /** + * a string indicating the path of the cookie (/ by default). + */ + path?: string; + /** + * a string indicating the domain of the cookie (no default). + */ + domain?: string; + /** + * a boolean indicating whether the cookie is only to be sent + * over HTTPS (false by default for HTTP, true by default for HTTPS). + */ + secure?: boolean; + /** + * a boolean indicating whether the cookie is only to be sent + * over HTTPS (use this if you handle SSL not in your node process). + */ + secureProxy?: boolean; + /** + * a boolean indicating whether the cookie is only to be sent over HTTP(S), + * and not made available to client JavaScript (true by default). + */ + httpOnly?: boolean; + /** + * a boolean indicating whether the cookie is to be signed (false by default). + * If this is true, another cookie of the same name with the .sig suffix + * appended will also be sent, with a 27-byte url-safe base64 SHA1 value + * representing the hash of cookie-name=cookie-value against the first Keygrip key. + * This signature key is used to detect tampering the next time a cookie is received. + */ + signed?: boolean; + /** + * a boolean indicating whether to overwrite previously set + * cookies of the same name (false by default). If this is true, + * all cookies set during the same request with the same + * name (regardless of path or domain) are filtered out of + * the Set-Cookie header when setting this cookie. + */ + overwrite?: boolean; + } } interface CookiesStatic { - new (request: http.IncomingMessage, response: http.ServerResponse): ICookies; - new (request: http.IncomingMessage, response: http.ServerResponse, keys?: Array): ICookies; + new (request: http.IncomingMessage, response: http.ServerResponse): cookies.ICookies; + new (request: http.IncomingMessage, response: http.ServerResponse, keys?: Array): cookies.ICookies; } - const _tmp: CookiesStatic; + const cookies: CookiesStatic; - export = _tmp + export = cookies } \ No newline at end of file diff --git a/cordova-plugin-mapsforge/cordova-plugin-mapsforge-tests.ts b/cordova-plugin-mapsforge/cordova-plugin-mapsforge-tests.ts new file mode 100644 index 000000000..52ef78700 --- /dev/null +++ b/cordova-plugin-mapsforge/cordova-plugin-mapsforge-tests.ts @@ -0,0 +1,73 @@ +/// + + +mapsforge.embedded.initialize(["/mnt/sdcard/spain.map",0,0]); //Creates the view +mapsforge.embedded.setCenter(43.360056,-5.845757); //Sets the center of the view +mapsforge.embedded.setMaxZoom(18); +mapsforge.embedded.setZoom(15); + +//Adding a marker +var markerKey: number; +mapsforge.embedded.addMarker([mapsforge.embedded.MARKER_YELLOW,43.360056,-5.845757],function(key){markerKey = key;}); + +//Adding a polyline +var points = [43.360056,-5.845757, 43.160056,-5.645757,43.560056,-5.895757]; +var polylineKey: number; +mapsforge.embedded.addPolyline([mapsforge.embedded.COLOR_GREEN,10,points], function(key){polylineKey = key;}, function(error){alert(error);}); + + + +mapsforge.cache.initialize("/mnt/sdcard/spain.map"); //Initializes the renderer with the offline map + +/*Now you can use the Leaflet code seen before*/ + +mapsforge.cache.setExternalCache(false); //Sets the cache to internal for faster performance + +//Now we set the cache size to 50 MB. This will increase the time between cleanings, but +//it will also make those cleanings slower, since there are a lot more of images to +//delete...so be careful when you choose the cache size +mapsforge.cache.setMaxCacheSize(50); + + + +var L: any; + +interface TilePoint { + x: number; + y: number; + z: number; +} + +interface Tile { + src: string; + _layer: any; + onload: any; + onerror: any; +} + +L.OfflineTileLayer = L.TileLayer.extend({ + getTileUrl : function(tilePoint: TilePoint, tile: Tile) { + var zoom = tilePoint.z, x = tilePoint.x, y = tilePoint.y; + + if (mapsforge.cache) { + mapsforge.cache.getTile([x,y,zoom], function(result) {tile.src=result;}, + function() {tile.src = "path to an error image";}); + }else{ + tile.src = "path to an error image"; + } + }, + + _loadTile: function (tile: Tile, tilePoint: TilePoint) { + tile._layer = this; + tile.onload = this._tileOnLoad; + tile.onerror = this._tileOnError; + + this._adjustTilePoint(tilePoint); + this.getTileUrl(tilePoint, tile); + + this.fire('tileloadstart', { + tile: tile, + url: tile.src + }); + } +}); diff --git a/cordova-plugin-mapsforge/cordova-plugin-mapsforge.d.ts b/cordova-plugin-mapsforge/cordova-plugin-mapsforge.d.ts new file mode 100644 index 000000000..6314a09fb --- /dev/null +++ b/cordova-plugin-mapsforge/cordova-plugin-mapsforge.d.ts @@ -0,0 +1,249 @@ +// Type definitions for cordova-plugin-mapsforge +// Project: https://github.com/afsuarez/mapsforge-cordova-plugin +// Definitions by: rafw87 +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface Window { + mapsforge: MapsforgePlugin; +} + +declare var mapsforge: MapsforgePlugin; + +interface MapsforgePlugin { + embedded: MapsforgeEmbeddedPlugin; + cache: MapsforgeCachePlugin; +} + +interface MapsforgeEmbeddedPlugin { + + COLOR_DKGRAY: number|string; + COLOR_CYAN: number|string; + COLOR_BLACK: number|string; + COLOR_BLUE: number|string; + COLOR_GREEN: number|string; + COLOR_RED: number|string; + COLOR_WHITE: number|string; + COLOR_TRANSPARENT: number|string; + COLOR_YELLOW: number|string; + + MARKER_RED: number|string; + MARKER_GREEN: number|string; + MARKER_BLUE: number|string; + MARKER_YELLOW: number|string; + MARKER_BLACK: number|string; + MARKER_WHITE: number|string; + + /** + * The map file path provided must be the absolute file path. You can specify the width and height values for the view that will be added, + * or you can set them to 0 for set the value to MATCH_PARENT. You must call this method before any other method. + * @param args Array in the following form: [String mapFilePath, int viewWidth, int viewHeight]. + * @param success Success callback. + * @param error Error callback + */ + initialize(args: any[], success?: () => void, error?: (message: string) => void): void; + + /** + * To show the map view. + * @param success Success callback. + * @param error Error callback + */ + show(success?: () => void, error?: (message: string) => void): void; + + /** + * To hide the map view. + * @param success Success callback. + * @param error Error callback + */ + hide(success?: () => void, error?: (message: string) => void): void; + + /** + * Sets the center of the map to the given coordinates. + * @param lat Latitude of the new center. + * @param lng Longitude of the new center. + * @param success Success callback. + * @param error Error callback + */ + setCenter(lat: number, lng: number, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets the zoom to the specified value (if it is between the zoom limits). + * @param zoomLevel New zoom level. + * @param success Success callback. + * @param error Error callback + */ + setZoom(zoomLevel: number, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets the maximum zoom level. + * @param maxZoom New maximum zoom level. + * @param success Success callback. + * @param error Error callback + */ + setMaxZoom(maxZoom: number, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets the minimum zoom level. + * @param minZoom New minimum zoom level. + * @param success Success callback. + * @param error Error callback + */ + setMinZoom(minZoom: number, success?: () => void, error?: (message: string) => void): void; + + /** + * The path to the map ile is required, and the path to the render theme may be null in order to apply the default render theme. + * @param args Array in the following form: [String mapFilePath, String renderThemePath] + * @param success Success callback. + * @param error Error callback + */ + setOfflineTileLayer(args: any[], success?: () => void, error?: (message: string) => void): void; + + /** + * + * @param args Array in the following form: [String providerName, String host, String baseUrl, String extension, int port] + * @param success Success callback. + * @param error Error callback + */ + setOnlineTileLayer(args: any[], success?: () => void, error?: (message: string) => void): void; + + /** + * Adds a marker to the map in the specified coordinates and returns the key for that marker to the success function. + * @param arg Array in the following form: [String marker_color, double lat, double lng]. + * The color of the marker should be one of the constants from mapsforge.embedded object; if the marker doesn't exist a green marker will be used instead. + * @param success Success callback. Gets the key of created marker. That key is the one you have to use if you want to delete it. + * @param error Error callback + */ + addMarker(arg: any[], success?: (key: number) => void, error?: (message: string) => void): void; + + /** + * + * @param arg Array in the following form: [int color, int strokeWidth,[double points]]. + * The color can be one of the constants specified before, or the new color you want. + * This function will use the odd positions of the array of points for the latitudes and the even positions for the longitudes. + * Example: [lat1, lng1, lat2, lng2, lat3, lng3]. + * If the length of the array is not even, the function will throw an exception and return the error message to the error function. + * @param success Success callback. Gets the key of created polyline. + * @param error Error callback + */ + addPolyline(arg: any[], success?: (key: number) => void, error?: (message: string) => void): void; + + /** + * Deletes the layer(markers or polylines) with the specified key from the map. + * @param key Key of marker or polyline. + * @param success Success callback. + * @param error Error callback + */ + deleteLayer(key: number, success?: () => void, error?: (message: string) => void): void; + + /** + * Initializes again the map if the onStop method was called. + * @param success Success callback. + * @param error Error callback + */ + onStart(success?: () => void, error?: (message: string) => void): void; + + + /** + * Stops the rendering. Useful for when the app goes to the background. You have to call the onStart method to restart it. + * @param success Success callback. + * @param error Error callback + */ + onStop(success?: () => void, error?: (message: string) => void): void; + + /** + * Stops and cleans the resources that have been used. + * @param success Success callback. + * @param error Error callback + */ + onDestroy(success?: () => void, error?: (message: string) => void): void; +} + +interface MapsforgeCachePlugin { + + /** + * You should call this method before any other one, and provide it with the absolute map file path. + * @param mapFilePath Absolute map file path. + * @param success Success callback. + * @param error Error callback + */ + initialize(mapFilePath: string, success?: () => void, error?: (message: string) => void): void; + + /** + * This method is the one that provides the tiles, generating them if their are not in the cache. + * @param args Array in the following form: [double lat, double lng, byte zoom] + * @param success Success callback. Gets the tile path. + * @param error Error callback + */ + getTile(args: any[], success?: (tilePath: string) => void, error?: (message: string) => void): void; + + /** + * Enables or disables the cache. If disabled, the plugin will generate the tiles always from scratch. Cache is enabled by default. + * @param enabled Cache enabled or disabled. + * @param success Success callback. + * @param error Error callback + */ + setCacheEnabled(enabled: boolean, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets whether or not the cache should be placed in the internal memory or in the SD card. + * By default it is placed in SD card, so devices with not too much memory have a better performance. + * @param external Cache external or internal. + * @param success Success callback. + * @param error Error callback + */ + setExternalCache(external: boolean, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets the map file to be used for rendering to the map specified by its absolute path. + * @param absolutePath Absolute map file path. + * @param success Success callback. + * @param error Error callback + */ + setMapFile(absolutePath: string, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets the age for the generated images. This means that when the cache is being cleaned, all images younger than the specified value will be kept in the cache in order to avoid deleting images that are being used at the moment. + * @param milliseconds Max cache age in milliseconds. + * @param success Success callback. + * @param error Error callback + */ + setMaxCacheAge(milliseconds: number, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets the maximum size for the cache. This size must be specified in megabytes. If there is not that space available, the cache will fit the maximum size. + * @param sizeInMB Max cache size in megabytes. + * @param success Success callback. + * @param error Error callback + */ + setMaxCacheSize(sizeInMB: number, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets the tile size. By default the tile size is set to 256. + * @param size Tile size. + * @param success Success callback. + * @param error Error callback + */ + setMaxCacheSize(size: number, success?: () => void, error?: (message: string) => void): void; + + /** + * This method sets the size in megabytes that will remain always available in memory in order to avoid that the application uses all space available. + * @param sizeInMB Size in megabytes that will remain always available in memory. + * @param success Success callback. + * @param error Error callback + */ + setCacheCleaningTrigger(sizeInMB: number, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets a flag to destroy the cache when the onDestroy method is called. + * @param destroy If true, cache will be destroyed when the onDestroy method will be called. + * @param success Success callback. + * @param error Error callback + */ + destroyCacheOnExit(destroy: boolean, success?: () => void, error?: (message: string) => void): void; + + /** + * Deletes the cache depending on the flag state. + * @param success Success callback. + * @param error Error callback + */ + onDestroy(success?: () => void, error?: (message: string) => void): void; +} diff --git a/cordova/plugins/NetworkInformation.d.ts b/cordova/plugins/NetworkInformation.d.ts index 53093284f..1ba2ae9e0 100644 --- a/cordova/plugins/NetworkInformation.d.ts +++ b/cordova/plugins/NetworkInformation.d.ts @@ -45,16 +45,16 @@ interface Connection { * Connection.CELL * Connection.NONE */ - type: number + type: string } declare var Connection: { - UNKNOWN: number; - ETHERNET: number; - WIFI: number; - CELL_2G: number; - CELL_3G: number; - CELL_4G: number; - CELL: number; - NONE: number; -} \ No newline at end of file + UNKNOWN: string; + ETHERNET: string; + WIFI: string; + CELL_2G: string; + CELL_3G: string; + CELL_4G: string; + CELL: string; + NONE: string; +} diff --git a/couchbase/couchbase-tests.ts b/couchbase/couchbase-tests.ts index 4305300ee..a1a3ee6bb 100644 --- a/couchbase/couchbase-tests.ts +++ b/couchbase/couchbase-tests.ts @@ -1,21 +1,16 @@ /// import couchbase = require('couchbase'); -var db = new couchbase.Connection({ bucket: "default" }, function (err) { - if (err) throw err; +var cluster = new couchbase.Cluster('couchbase://127.0.0.1'); +var bucket = cluster.openBucket('default'); - // TS 0.9.5 bug https://typescript.codeplex.com/workitem/2035, todo: remove cast after fix - (db).set('testdoc', { name: 'Frank' }, function (err, result) { - if (err) throw err; +bucket.upsert('testdoc', { name: 'Frank' }, (error) => { + if (error) throw error; - var s: string = err.message; + bucket.get('testdoc', (err, result) => { + if (err) throw err; - // TS 0.9.5 bug https://typescript.codeplex.com/workitem/2035, todo: remove cast after fix - (db).get('testdoc', function (err, result) { - if (err) throw err; - - console.log(result.value); - // {name: Frank} - }); + console.log(result.value); + // {name: Frank} }); }); \ No newline at end of file diff --git a/couchbase/couchbase.d.ts b/couchbase/couchbase.d.ts index 3a8605b73..6afd3a781 100644 --- a/couchbase/couchbase.d.ts +++ b/couchbase/couchbase.d.ts @@ -1,729 +1,1129 @@ -// Type definitions for Couchbase Couchnode +// Type definitions for Couchbase Node.js SDK 2.1.2 // Project: https://github.com/couchbase/couchnode -// Definitions by: Basarat Ali Syed +// Definitions by: Marwan Aouida // Definitions: https://github.com/borisyankov/DefinitelyTyped /// + declare module 'couchbase' { - /** - * Enumeration of all error codes. See libcouchbase documentation - * for more details on what these errors represent. - * - * @global - * @readonly - * @enum {number} - */ - export var errors: { - /** Operation was successful **/ - success: number; + import events = require('events'); + /** + * Enumeration of all error codes. See libcouchbase documentation for more details on what these errors represent. + */ + enum errors { + /** Operation was successful. **/ + success, + /** Authentication should continue. **/ - authContinue: number; - + authContinue, + /** Error authenticating. **/ - authError: number; - + authError, + /** The passed incr/decr delta was invalid. **/ - deltaBadVal: number; - + deltaBadVal, + /** Object is too large to be stored on the cluster. **/ - objectTooBig: number; - + objectTooBig, + + /** Operation was successful. **/ + serverBusy, + /** Server is too busy to handle your request right now. **/ - serverBusy: number; - - /** Internal libcouchbase error. **/ - cLibInternal: number; - + cLibInternal, + /** An invalid arguement was passed. **/ - cLibInvalidArgument: number; - + cLinInvalidArgument, + /** The server is out of memory. **/ - cLibOutOfMemory: number; - + cLibOutOfMemory, + /** An invalid range was specified. **/ - invalidRange: number; - + invalidRange, + /** An unknown error occured within libcouchbase. **/ - cLibGenericError: number; - + cLibGenericError, + /** A temporary error occured. Try again. **/ - temporaryError: number; - + temporaryError, + /** The key already exists on the server. **/ - keyAlreadyExists: number; - + keyAlreadyExists, + /** The key does not exist on the server. **/ - keyNotFound: number; - + keyNotFound, + /** Failed to open library. **/ - failedToOpenLibrary: number; - + failedToOpenLibrary, + /** Failed to find expected symbol in library. **/ - failedToFindSymbol: number; - + failedToFindSymbol, + /** A network error occured. **/ - networkError: number; - + networkError, + /** Operations were performed on the incorrect server. **/ - wrongServer: number; - + wrongServer, + /** Operations were performed on the incorrect server. **/ - notMyVBucket: number; - - /** The document was not stored. */ - notStored: number; - + notMyVBucket, + + /** The document was not stored. **/ + notSorted, + /** An unsupported operation was sent to the server. **/ - notSupported: number; - + notSupported, + /** An unknown command was sent to the server. **/ - unknownCommand: number; - + unknownCommand, + /** An unknown host was specified. **/ - unknownHost: number; - + unknownHost, + /** A protocol error occured. **/ - protocolError: number; - + protocolError, + /** The operation timed out. **/ - timedOut: number; - + timedOut, + /** Error connecting to the server. **/ - connectError: number; - + connectError, + /** The bucket you request was not found. **/ - bucketNotFound: number; - + bukcketNotFound, + /** libcouchbase is out of memory. **/ - clientOutOfMemory: number; - + clientOutOfMemory, + /** A temporary error occured in libcouchbase. Try again. **/ - clientTemporaryError: number; - - /** A bad handle was passed. */ - badHandle: number; - + clientTemporaryError, + + /** A bad handle was passed. **/ + badHandle, + /** A server bug caused the operation to fail. **/ - serverBug: number; - + serverBug, + /** The host format specified is invalid. **/ - invalidHostFormat: number; - - /** Not enough nodes to meet the operations durability requirements. **/ - notEnoughNodes: number; - + invalidHostFormat, + + /** Not enough nodes to meet the operations durability requirements. **/ + notEnoughNodes, + /** Duplicate items. **/ - duplicateItems: number; - + duplicateItems, + /** Key mapping failed and could not match a server. **/ - noMatchingServerForKey: number; - + noMatchingServerForKey, + /** A bad environment variable was specified. **/ - badEnvironmentVariable: number; + badEnvironmentVariable, + /** Couchnode is out of memory. **/ - outOfMemory: number; - + outOfMemory, + /** Invalid arguements were passed. **/ - invalidArguments: number; - + invalidArguments, + /** An error occured while trying to schedule the operation. **/ - schedulingError: number; - + schedulingError, + /** Not all operations completed successfully. **/ - checkResults: number; - + checkResults, + /** A generic error occured in Couchnode. **/ - genericError: number; - + genericError, + /** The specified durability requirements could not be satisfied. **/ - durabilityFailed: number; - + durabilityFailed, + /** An error occured during a RESTful operation. **/ - restError: number; + restError } /** - * Enumeration of all value encoding formats. - * - * @global - * @readonly - * @enum {number} + * Represents a singular cluster containing your buckets. */ - export var format: { - /** Store as raw bytes. **/ - raw: number; + class Cluster { + /** + * Create a new instance of the Cluster class. + * @param cnstr The connection string for your cluster. + * @param options The options object. + */ + constructor(cnstr?: string, options?: ClusterConstructorOptions); - /** Store as JSON encoded string. **/ - json: number; + /** + * Creates a manager allowing the management of a Couchbase cluster. + */ + manager(): ClusterManager; - /** Store as UTF-8 encoded string. **/ - utf8: number; + /** + * Open a bucket to perform operations. This will begin the handshake process immediately and operations will complete later. Subscribe to the connect event to be alerted when the connection is ready, though be aware operations can be successfully queued before this. + * @param name The name of the bucket to open. + */ + openBucket(name?: string): Bucket; - /** Automatically determine best storage format. **/ - auto: number; - }; - /** - * The *CAS* value is a special object which indicates the current state - * of the item on the server. Each time an object is mutated on the server, the - * value is changed. CAS objects can be used in conjunction with - * mutation operations to ensure that the value on the server matches the local - * value retrieved by the client. This is useful when doing document updates - * on the server as you can ensure no changes were applied by other clients - * while you were in the process of mutating the document locally. - * - * In Couchnode, this is an opaque value. As such, you cannot generate - * CAS objects, but should rather use the values returned from a - * {@link KeyCallback}. - * - * @typedef {object} CAS - */ - export interface CAS extends Object { + /** + * Open a bucket to perform operations. This will begin the handshake process immediately and operations will complete later. Subscribe to the connect event to be alerted when the connection is ready, though be aware operations can be successfully queued before this. + * @param name The name of the bucket to open. + * @param password Password for the bucket. + */ + openBucket(name?: string, password?: string): Bucket; + + /** + * Open a bucket to perform operations. This will begin the handshake process immediately and operations will complete later. Subscribe to the connect event to be alerted when the connection is ready, though be aware operations can be successfully queued before this. + * @param name The name of the bucket to open. + * @param callback Callback to invoke on connection success or failure. + */ + openBucket(name?: string, callback?: Function): Bucket; + + /** + * Open a bucket to perform operations. This will begin the handshake process immediately and operations will complete later. Subscribe to the connect event to be alerted when the connection is ready, though be aware operations can be successfully queued before this. + * @param name The name of the bucket to open. + * @param password Password for the bucket. + * @param callback Callback to invoke on connection success or failure. + */ + openBucket(name?: string, password?: string, callback?: Function): Bucket; + } + + interface ClusterConstructorOptions { + /** + * The path to the certificate to use for SSL connections + */ + certpath: string; + } + + interface CreateBucketOptions { + /** + * The bucket name + */ + name?: string; + authType?: string, + bucketType?: string; + ramQuotaMB?: number; + replicaNumber?: number; } /** - * @class Result - * @classdesc - * The virtual class used for results of various operations. - * @private + * Class for performing management operations against a cluster. */ - export class Result { + interface ClusterManager { /** - * The CAS value for the document that was affected by the operation. - * @var {CAS} Result#cas + * + * @param name + * @param callback */ - cas: CAS; + createBucket(name: string, callback: Function): void; + /** - * The flags associate with the document. - * @var {integer} Result#flags + * + * @param name + * @param opts + * @param callback */ - flags: number; + createBucket(name: string, opts: any, callback: Function): void; + /** - * The resulting document from the retrieval operation that was executed. - * @var {Mixed} Result#value + * + * @param callback */ - value: any; + listBuckets(callback: Function): void; + + /** + * + * @param name + * @param callback + */ + removeBucket(name: string, callback: Function): void; } /** - * @class CouchbaseError - * @classdesc * The virtual class thrown for all Couchnode errors. - * @private - * @extends node#Error */ - export interface CouchbaseError extends Error { + interface CouchbaseError extends Error { /** * The error code for this error. - * @var {errors} Error#code */ - code: number; + code: errors; + } + + interface AppendOptions { + /** + * The CAS value to check. If the item on the server contains a different CAS value, the operation will fail. Note that if this option is undefined, no comparison will be performed. + */ + cas?: Bucket.CAS; /** - * The internal error that occured to cause this one. This is used to wrap - * low-level errors before throwing them from couchnode to simplify error - * handling. - * @var {(node#Error)} Error#innerError + * Ensures this operation is persisted to this many nodes. */ - innerError: Error; + persist_to?: number; /** - * A reason string describing the reason this error occured. This value is - * almost exclusively used for REST request errors. - * @var {string} Error#reason + * Ensures this operation is replicated to this many nodes. */ - reason: string; - } - - /** - * Connect callback - * This callback is invoked when a connection is successfully established. - * - * @typedef {function} ConnectCallback - * - * @param {undefined|Error} error - * The error that occurred while trying to connect to the cluster. - */ - export interface ConnectCallback { - (error: CouchbaseError): any; - } - - /** - * Design Document Management callbacks - * This callback is invoked by the *DesignDoc operations. - * - * @typedef {function} DDocCallback - * - * @param {undefined|Error} error - * An error indicator. Note that this error value may be ignored, but its - * absence is indicative that the response in the *result* parameter is ok. - * If it is set, then the request likely failed. - * @param {object} result - * The result returned from the server - */ - export interface DDocCallback { - (error: CouchbaseError, result: any): any; - } - - /** - * Single-Key callbacks. - * This callback is passed to all of the single key functions. - * - * A typical use pattern is to pass the result> parameter from the - * callback as the options parameter to one of the next operations. - * - * @typedef {function} KeyCallback - * - * @param {undefined|Error} error - * The error for the operation. This can either be an Error object - * or a false value. The error contains the following fields: - * @param {Result} result - * The result of the operation that was executed. - */ - export interface KeyCallback { - (error: CouchbaseError, result: Result): any; - } - - /** - * Multi-Key callbacks - * This callback is invoked by the *Multi operations. - * It differs from the in {@linkcode KeyCallback} that the - * response object is an object of {key: response} - * where each response object contains the response for that particular - * key. - * - * @typedef {function} MultiCallback - * - * @param {undefined|Error} error - * An error indicator. Note that this error - * value may be ignored, but its absence is indicative that each - * response in the results parameter is ok. If it - * is set, then at least one of the result objects failed - * @param {Object.} results - * The results of the operation as a dictionary of keys mapped to Result - * objects. - */ - export interface MultiCallback { - (error: CouchbaseError, result: { [key: string]: Result }): any; - } - - /** - * Query callback. - * This callback is invoked by the query operations. - * - * @typedef {function} QueryCallback - * - * @param {undefined|Error} error - * An error indicator. Note that this error - * value may be ignored, but its absence is indicative that the - * response in the results parameter is ok. If it - * is set, then the request failed. - * @param {object} results - * The results returned from the server - */ - export interface QueryCallback { - (error: CouchbaseError, result: any): any; - } - - /** - * @typedef {function} StatsCallback - * - * @param {Error} error - * @param {Object.} results - * An object containing per-server, per key entries - * - * @see Connection#stats - */ - export interface StatsCallback { - (error: CouchbaseError, result: any): any; - } - - - ///////////////////////// - // Various options structures - ///////////////////////// - - export interface ConnectionOptions { - host?: any; // string | string[] - bucket?: string; - password?: string; - } - - // Not comming up with a base interface system as that is not how the original code is written. - // Use a custom base interface system has the potential to become difficult to keep up to date. - - export interface AddOptions { - expiry?: number; - flags?: number; - format?: number - persist_to?: number; replicate_to?: number; } - export interface AddMultiOptionsForValue { - value: any; + interface PrependOptions extends AppendOptions { } + + interface RemoveOptions extends AppendOptions { } + + interface ReplaceOptions extends AppendOptions { + /** + * Set the initial expiration time for the document. A value of 0 represents never expiring. + */ expiry?: number; - flags?: number; - format?: number; } - export interface AddMultiOptions { - expiry?: number; - flags?: number; - format?: number + interface UpsertOptions extends ReplaceOptions { } + + interface TouchOptions { + /** + * Ensures this operation is persisted to this many nodes. + */ persist_to?: number; + + /** + * Ensures this operation is replicated to this many nodes. + */ replicate_to?: number; - - spooled?: boolean; } - export interface AppendOptions { - expiry?: number; - flags?: number; - format?: number; - persist_to?: number; - replicate_to?: number; - - cas: CAS; - } - - export interface AppendMultiOptionsForValue { - value: any; - cas?: CAS; - expiry?: number; - } - - export interface AppendMultiOptions { - expiry?: number; - persist_to?: number; - replicate_to?: number; - - spooled?: boolean; - } - - export interface DecrOptions { - offset?: number; + interface CounterOptions { + /** + * Sets the initial value for the document if it does not exist. Specifying a value of undefined will cause the operation to fail if the document does not exist, otherwise this value must be equal to or greater than 0. + */ initial?: number; + /** + * Set the initial expiration time for the document. A value of 0 represents never expiring. + */ expiry?: number; + + /** + * Ensures this operation is persisted to this many nodes + */ persist_to?: number; + + /** + * Ensures this operation is replicated to this many nodes + */ replicate_to?: number; } - export interface DecrMultiOptionsForValue { - offset?: number; - initial?: number; - - expiry?: number; + interface GetAndLockOptions { + lockTime?: number; } - export interface DecrMultiOptions { - spooled?: boolean; - } + interface GetReplicaOptions { - export interface GetOptions { - expiry?: number; - format?: number; - } - - export interface GetMultiOptions { - spooled?: boolean; - format?: number; - } - - export interface GetReplicaOptions { + /** + * The index for which replica you wish to retrieve this value from, or if undefined, use the value from the first server that replies. + */ index?: number; - format?: number; } - export interface GetReplicaMultiOptions { - spooled?: boolean; - format?: number; - } + interface InsertOptions { - export interface IncrOptions extends DecrOptions { } - - export interface IncrMultiOptionsForValue extends DecrMultiOptionsForValue { } - - export interface IncrMultiOptions extends DecrMultiOptions { } - - export interface LockOptions { - lockTime?: number - } - - export interface LockMultiOptions { - spooled?: boolean; - format?: number; - } - - export interface ObserveOptions { - cas: CAS; // verified not optional - } - - export interface ObserveMultiOptionsForValue { - cas: CAS; // verified not optional - } - - export interface ObserveMultiOptions { - spooled?: boolean; - } - - export interface PrependOptions { + /** + * Set the initial expiration time for the document. A value of 0 represents never expiring. + */ expiry?: number; - flags?: number; - format?: number; + + /** + * Ensures this operation is persisted to this many nodes. + */ persist_to?: number; + + /** + * Ensures this operation is replicated to this many nodes. + */ replicate_to?: number; - - cas?: CAS; - } - - export interface PrependMultiOptionsFoValue { - value: any; - cas: CAS; - expiry?: number; - } - - export interface PrependMultiOptions { - spooled?: boolean; - - expiry?: number; - persist_to?: number; - replicate_to?: number; - } - - export interface RemoveOptions { - cas?: CAS; - persist_to?: number; - replicate_to?: number; - } - - export interface RemoveMultiOptionsForValue { - cas?: CAS; - } - - export interface RemoveMultiOptions { - spooled?: boolean; - - persist_to?: number; - replicate_to?: number; - } - - // Options for Replace functions follow Set Options and this is mentioned explicitly in the documentation - - export interface ReplaceOptions extends SetOptions { } - - export interface ReplaceMultiOptionsForValue extends SetMultiOptionsForValue { } - - export interface ReplaceMultiOptions extends SetMultiOptions { } - - export interface SetOptions { - expiry?: number; - flags?: number; - format?: number; - persist_to?: number; - replicate_to?: number; - - cas?: CAS; - } - - export interface SetMultiOptionsForValue { - value: any; - cas?: CAS; - expiry?: number; - flags?: number; - format?: number; - } - - export interface SetMultiOptions { - expiry?: number; - flags?: number; - format?: number - persist_to?: number; - replicate_to?: number; - - spooled?: boolean; - } - - export interface TouchOptions { - expiry?: number; - persist_to?: number; - replicate_to?: number; - - cas?: CAS; - } - - export interface UnlockOptions { - cas: CAS; // verified not optional - } - - export interface UnlockMultiOptionsForValue { - cas: CAS; // verified not optional - } - - export interface UnlockMultiOptions { - spooled?: boolean; } /** - * @class - * A class representing a connection to a Couchbase cluster. - * Normally, your application should only need to create one of these per - * bucket and use it continuously. Operations are executed asynchronously - * and pipelined when possible. - * - * @desc - * Instantiate a new Connection object. Note that it is safe to perform - * operations before the connect callback is invoked. In this case, the - * operations are queued until the connection is ready (or an unrecoverable - * error has taken place). - * - * @param {Object} [options] - * A dictionary of options to use. You may pass - * other options than those defined below which correspond to the various - * options available on the Connection object (see their documentation). - * For example, it may be helpful to set timeout properties before connecting. - * @param {string|string[]} [options.host="localhost:8091"] - * A string or array of strings indicating the hosts to connect to. If the - * value is an array, all the hosts in the array will be tried until one of - * them succeeds. - * @param {string} [options.bucket="default"] - * The bucket to connect to. If not specified, the default is - * 'default'. - * @param {string} [options.password=""] - * The password for a password protected bucket. - * @param {ConnectCallback} callback - * A callback that will be invoked when the instance has completed connecting - * to the server. Note that this isn't required - however if the connection - * fails, an exception will be thrown if the callback is not provided. - * - * @example - * var couchbase = require('couchbase'); - * var db = new couchbase.Connection({}, function(err) { - * if (err) { - * console.log('Connection Error', err); - * } else { - * console.log('Connected!'); - * } - * }); + * A class for performing management operations against a bucket. This class should not be instantiated directly, but instead through the use of the Bucket#manager method instead. */ - export class Connection { - constructor(callback: ConnectCallback); - constructor(options: ConnectionOptions, callback: ConnectCallback); - - ///////////////////////// - // Members - ///////////////////////// + interface BucketManager { + + /** + * Flushes the cluster, deleting all data stored within this bucket. Note that this method requires the Flush permission to be enabled on the bucket from the management console before it will work. + * @param callback The callback function. + */ + flush(callback: Function): void; /** - * Get information about the Couchnode version (i.e. this library) as an array - * of [versionNumber, versionString]. - * - * @member {Mixed[]} Connection#clientVersion + * Retrieves a specific design document from this bucket. + * @param name + * @param callback The callback function. */ - clientVersion: any[]; + getDesignDocument(name: string, callback: Function): void; + /** + * Retrieves a list of all design documents registered to a bucket. + * @param callback The callback function. + */ + getDesignDocuments(callback: Function): void; + + /** + * Registers a design document to this bucket, failing if it already exists. + * @param name + * @param data + * @param callback The callback function. + * @returns {} + */ + insertDesignDocument(name: string, data: any, callback: Function): void; + + /** + * Unregisters a design document from this bucket. + * @param name + * @param callback The callback function. + * @returns {} + */ + removeDesignDocument(name: string, callback: Function): void; + + /** + * Registers a design document to this bucket, overwriting any existing design document that was previously registered. + * @param name + * @param data + * @param callback The callback function. + * @returns {} + */ + upsertDesignDocument(name: string, data: any, callback: Function): void; + } + + /** + * Class for dynamically construction of view queries. This class should never be constructed directly, instead you should use ViewQuery.from to construct this object. + */ + class ViewQuery { + /** + * Instantiates a ViewQuery object for the specified design document and view name. + * @param ddoc The design document to use. + * @param name The view to use. + */ + static from(ddoc: string, name: string): ViewQuery; + + /** + * Specifies the design document and view name to use for this query. + * @param ddoc The design document to use. + * @param name The view to use. + */ + from(ddoc: string, name: string): ViewQuery; + + /** + * Allows you to specify custom view options that may not be available though the fluent interface defined by this class. + * @param opts + */ + custom(opts: any): ViewQuery; + + /** + * Flag to request a view request accross all nodes in the case of a development view. + * @param full_set + */ + full_set(full_set: boolean): ViewQuery; + + /** + * Specifies whether to preform grouping during view execution. + * @param group + */ + group(group: boolean): ViewQuery; + + /** + * Specifies the level at which to perform view grouping. + * @param group_level + */ + group_level(group_level: number): ViewQuery; + + /** + * Specifies a range of document id's to retrieve from the index. + * @param start + * @param end + */ + id_range(start: any, end: any): ViewQuery; + + /** + * Flag to request a view request include the full document value. + * @param include_docs + */ + include_docs(include_docs: boolean): ViewQuery; + + /** + * Specifies a specified key to retrieve from the index. + * @param key + */ + key(key: any): ViewQuery; + + /** + * Specifies a list of keys you wish to retrieve from the index. + * @param keys + */ + keys(key: any[]): ViewQuery; + + /** + * Specifies the maximum number of results to return. + * @param limit + */ + limit(limit: number): ViewQuery; + + /** + * Sets the error handling mode for this query. + * @param mode + */ + on_error(mode: ViewQuery.ErrorMode): ViewQuery; + + /** + * Specifies the desired ordering for the results. + * @param order + */ + order(order: ViewQuery.Order): ViewQuery; + + /** + * Specifies a range of keys to retrieve from the index. You may specify both a start and an end point and additionally specify whether or not the end value is inclusive or exclusive. + * @param start + * @param end + * @param inclusive_end + */ + range(start: any | any[], end: any | any[], inclusive_end?: boolean): ViewQuery; + + /** + * Specifies whether to execute the map-reduce reduce step. + * @param reduce + */ + reduce(reduce: boolean): ViewQuery; + + /** + * Specifies how many results to skip from the beginning of the result set. + * @param skip + */ + skip(skip: number): ViewQuery; + + /** + * Specifies how this query will affect view indexing, both before and after the query is executed. + * @param stale + */ + stale(stale: ViewQuery.Update): ViewQuery; + } + + module ViewQuery { + /** + * Enumeration for specifying on_error behaviour. + */ + enum ErrorMode { + /** + * Continues querying when an error occurs. + */ + CONTINUE, + + /** + * Stops and errors query when an error occurs. + */ + STOP + } + + /** + * Enumeration for specifying view result ordering. + */ + enum Order { + /** + * Orders with lower values first and higher values last. + */ + ASCENDING, + + /** + * Orders with higher values first and lower values last. + */ + DESCENDING + } + + /** + * Enumeration for specifying view update semantics. + */ + enum Update { + /** + * Causes the view to be fully indexed before results are retrieved. + */ + BEFORE, + + /** + * Allows the index to stay in whatever state it is already in prior retrieval of the query results. + */ + NONE, + + /** + * Forces the view to be indexed after the results of this query has been fetched. + */ + AFTER + } + } + + /** + * Class for dynamically construction of N1QL queries. This class should never be constructed directly, instead you should use the N1qlQuery.fromString static method to instantiate a N1qlStringQuery. + */ + class N1qlQuery { + /** + * Creates a query object directly from the passed query string. + * @param str + */ + static fromString(str: string): N1qlStringQuery; + + /** + * Returns the fully prepared string representation of this query. + */ + toString(): string; + } + + module N1qlQuery { + /** + * Enumeration for specifying N1QL consistency semantics. + */ + enum Consistency { + /** + * This is the default (for single-statement requests). + */ + NOT_BOUND, + + /** + * This implements strong consistency per request. + */ + REQUEST_PLUS, + + /** + * This implements strong consistency per statement. + */ + STATEMENT_PLUS + } + } + + /** + * Class for holding a explicitly defined N1QL query string. + */ + class N1qlStringQuery extends N1qlQuery { + /** + * Specifies whether this query is adhoc or should be prepared. + * @param adhoc + */ + adhoc(adhoc: boolean): N1qlStringQuery; + + /** + * Specify the consistency level for this query. + * @param val + */ + consistency(val: N1qlQuery.Consistency): N1qlStringQuery; + + /** + * Returns the fully prepared object representation of this query. + */ + toObject(): any; + + /** + * Returns the fully prepared string representation of this query. + */ + toString(): string; + } + + /** + * Class for dynamically construction of spatial queries. This class should never be constructed directly, instead you should use SpatialQuery.from to construct this object. + */ + class SpatialQuery { + /** + * Instantiates a SpatialQuery object for the specified design document and view name. + * @param ddoc The design document to use. + * @param name The view to use. + */ + static from(ddoc: string, name: string): SpatialQuery; + + /** + * Specifies the design document and view name to use for this query. + * @param ddoc + * @param name + */ + from(ddoc: string, name: string): SpatialQuery; + + /** + * Specifies a bounding box to query the index for. This value must be an array of exactly 4 numbers which represents the left, top, right and bottom edges of the bounding box (in that order). + * @param bbox + */ + bbox(bbox: number[]): SpatialQuery; + + /** + * Allows you to specify custom view options that may not be available though the fluent interface defined by this class. + * @param opts + */ + custom(opts: any): SpatialQuery; + + /** + * Specifies the maximum number of results to return. + * @param limit + */ + limit(limit: number): SpatialQuery; + + /** + * Specifies how many results to skip from the beginning of the result set. + * @param skip + */ + skip(skip: number): SpatialQuery; + + /** + * Specifies how this query will affect view indexing, both before and after the query is executed. + * @param stale + */ + stale(stale: SpatialQuery.Update): SpatialQuery; + } + + module SpatialQuery { + /** + * Enumeration for specifying view update semantics. + */ + enum Update { + /** + * Causes the view to be fully indexed before results are retrieved. + */ + BEFORE, + + /** + * Allows the index to stay in whatever state it is already in prior retrieval of the query results. + */ + NONE, + + /** + * Forces the view to be indexed after the results of this query has been fetched. + */ + AFTER + } + } + + /** + * The Bucket class represents a connection to a Couchbase bucket. Never instantiate this class directly. Instead use the Cluster#openBucket method instead. + */ + interface Bucket { + /** + * Returns the version of the Node.js library as a string. + */ + clientVersion: string; + + /** + * Gets or sets the config throttling in milliseconds. The config throttling is the time that Bucket will wait before forcing a configuration refresh. If no refresh occurs before this period while a configuration is marked invalid, an update will be triggered. + */ + configThrottle: number; + + /** + * Sets or gets the connection timeout in milliseconds. This is the timeout value used when connecting to the configuration port during the initial connection (in this case, use this as a key in the 'options' parameter in the constructor) and/or when Bucket attempts to reconnect in-situ (if the current connection has failed). + */ connectionTimeout: number; - lcbVersion: any[]; + /** + * Gets or sets the durability interval in milliseconds. The durability interval is the time that Bucket will wait between requesting new durability information during a durability poll. + */ + durabilityInterval: number; + /** + * Gets or sets the durability timeout in milliseconds. The durability timeout is the time that Bucket will wait for a response from the server in regards to a durability request. If there are no responses received within this time frame, the request fails with an error. + */ + durabilityTimeout: number; + + /** + * Returns the libcouchbase version as a string. This information will usually be in the format of 2.4.0-fffffff representing the major, minor, patch and git-commit that the built libcouchbase is based upon. + */ + lcbVersion: string; + + /** + * Gets or sets the management timeout in milliseconds. The management timeout is the time that Bucket will wait for a response from the server for a management request. If the response is not received within this time frame, the request is failed out with an error. + */ + managementTimeout: number; + + /** + * Sets or gets the node connection timeout in msecs. This value is similar to Bucket#connectionTimeout, but defines the time to wait for a particular node to respond before trying the next one. + */ + nodeConnectionTimeout: number; + + /** + * Gets or sets the operation timeout in milliseconds. The operation timeout is the time that Bucket will wait for a response from the server for a CRUD operation. If the response is not received within this time frame, the operation is failed with an error. + */ operationTimeout: number; - serverNodes: string[]; + /** + * Gets or sets the view timeout in milliseconds. The view timeout is the time that Bucket will wait for a response from the server for a view request. If the response is not received within this time frame, the request fails with an error. + */ + viewTimeout: number; - ///////////////////////// - // Methods - ///////////////////////// + /** + * Similar to Bucket#upsert, but instead of setting a new key, it appends data to the existing key. Note that this function only makes sense when the stored data is a string; 'appending' to a JSON document may result in parse errors when the document is later retrieved. + * @param key The target document key. + * @param fragment The document's contents to append. + * @param callback The callback function. + */ + append(key: any | Buffer, fragment: any, callback: Bucket.OpCallback): void; - // TODO: not sure if these methods return void. Docmentation mentions nothing. - // TODO: For "multi" key methods the documentation says callback can be either KeyCallback | MultiCallback. Sticking with MultiCallback. - // TODO: Verify that kv is not a key value and indeed is string[] e.g. getMulti , getReplicaMulti, lockMulti + /** + * + * @param key The target document key. + * @param fragment The document's contents to append. + * @param options The options object. + * @param callback The callback function. + */ + append(key: any | Buffer, fragment: any, options: AppendOptions, callback: Bucket.OpCallback): void; - add(key: string, value: any, callback: KeyCallback): void; - add(key: string, value: any, options: AddOptions, callback: KeyCallback): void; - addMulti(kv: { [key: string]: AddMultiOptionsForValue }, options: AddMultiOptions, callback: MultiCallback): void; + /** + * Increments or decrements a key's numeric value. + * Note that JavaScript does not support 64-bit integers (while libcouchbase and the server do). You might receive an inaccurate value if the number is greater than 53-bits (JavaScript's maximum integer precision). + * @param key The target document key. + * @param delta The amount to add or subtract from the counter value. This value may be any non-zero integer. + * @param callback The callback function. + */ + counter(key: any | Buffer, delta: number, callback: Bucket.OpCallback): void; + + /** + * + * @param key The target document key. + * @param delta The amount to add or subtract from the counter value. This value may be any non-zero integer. + * @param options The options object. + * @param callback The callback function. + */ + counter(key: any | Buffer, delta: number, options: CounterOptions, callback: Bucket.OpCallback): void; - append(key: string, fragment: string, callback: KeyCallback): void; - append(key: string, fragment: string, options: AppendOptions, callback: KeyCallback): void; - append(key: string, fragment: Buffer, callback: KeyCallback): void; - append(key: string, fragment: Buffer, options: AppendOptions, callback: KeyCallback): void; - appendMulti(kv: { [key: string]: AppendMultiOptionsForValue }, options: AppendMultiOptions, callback: MultiCallback): void; + /** + * Shuts down this connection. + */ + disconnect(): void; - decr(key: string, callback: KeyCallback): void; - decr(key: string, options: DecrOptions, callback: KeyCallback): void; - decrMulti(kv: { [key: string]: DecrMultiOptionsForValue }, options: DecrMultiOptions, callback: MultiCallback): void; + /** + * Enables N1QL support on the client. A cbq-server URI must be passed. This method will be deprecated in the future in favor of automatic configuration through the connected cluster. + * @param hosts An array of host/port combinations which are N1QL servers attached to this cluster. + */ + enableN1ql(hosts: string | string[]): void; - get(key: string, callback: KeyCallback): void; - get(key: string, options: GetOptions, callback: KeyCallback): void; - getMulti(kv: string[], options: { [key: string]: GetMultiOptions }, callback:MultiCallback): void; + /** + * Retrieves a document. + * @param key The target document key. + * @param callback The callback function. + */ + get(key: any | Buffer, callback: Bucket.OpCallback): void; - getDesignDoc(name: string, callback: DDocCallback): void; + /** + * @param key The target document key. + * @param options The options object. + * @param callback The callback function. + */ + get(key: any | Buffer, options: any, callback: Bucket.OpCallback): void; - getReplica(key: string, callback: KeyCallback): void; - getReplica(key: string, options: GetReplicaOptions, callback: KeyCallback): void; - getReplicaMulti(kv: string[], options: GetReplicaMultiOptions, callback: MultiCallback): void; + /** + * Lock the document on the server and retrieve it. When an document is locked, its CAS changes and subsequent operations on the document (without providing the current CAS) will fail until the lock is no longer held. + * This function behaves identically to Bucket#get in that it will return the value. It differs in that the document is also locked. This ensures that attempts by other client instances to access this document while the lock is held will fail. + * Once locked, a document can be unlocked either by explicitly calling Bucket#unlock or by performing a storage operation (e.g. Bucket#upsert, Bucket#replace, Bucket::append) with the current CAS value. Note that any other lock operations on this key will fail while a document is locked. + * @param key The target document key. + * @param callback The callback function. + */ + getAndLock(key: any, callback: Bucket.OpCallback): void; - incr(key: string, callback: KeyCallback): void; - incr(key: string, options: IncrOptions, callback: KeyCallback): void; - incrMulti(kv: { [key: string]: IncrMultiOptionsForValue }, options: IncrMultiOptions, callback: MultiCallback): void; + /** + * Lock the document on the server and retrieve it. When an document is locked, its CAS changes and subsequent operations on the document (without providing the current CAS) will fail until the lock is no longer held. + * This function behaves identically to Bucket#get in that it will return the value. It differs in that the document is also locked. This ensures that attempts by other client instances to access this document while the lock is held will fail. + * Once locked, a document can be unlocked either by explicitly calling Bucket#unlock or by performing a storage operation (e.g. Bucket#upsert, Bucket#replace, Bucket::append) with the current CAS value. Note that any other lock operations on this key will fail while a document is locked. + * @param key The target document key. + * @param options The options object. + * @param callback The callback function. + * @returns {} + */ + getAndLock(key: any, options: GetAndLockOptions, callback: Bucket.OpCallback): void; - lock(key: string, callback: KeyCallback): void; - lock(key: string, options: LockOptions, callback: KeyCallback): void; - lockMulti(kv: string[], options: { [key: string]: LockMultiOptions }, callback: MultiCallback): void; + /** + * Retrieves a document and updates the expiry of the item at the same time. + * @param key The target document key. + * @param expiry The expiration time to use. If a value of 0 is provided, then the current expiration time is cleared and the key is set to never expire. Otherwise, the key is updated to expire in the time provided (in seconds). + * @param options The options object. + * @param callback The callback function. + */ + getAndTouch(key: any | Buffer, expiry: number, options: any, callback: Bucket.OpCallback): void; + + /** + * Retrieves a document and updates the expiry of the item at the same time. + * @param key The target document key. + * @param expiry The expiration time to use. If a value of 0 is provided, then the current expiration time is cleared and the key is set to never expire. Otherwise, the key is updated to expire in the time provided (in seconds). + * @param callback The callback function. + */ + getAndTouch(key: any | Buffer, expiry: number, callback: Bucket.OpCallback): void; - observe(key: string, options: ObserveOptions, callback: KeyCallback): void; - observeMulti(kv: { [key: string]: ObserveMultiOptionsForValue }, options: { [key: string]: ObserveMultiOptions }, callback: MultiCallback): void; + /** + * Retrieves a list of keys + * @param keys The target document keys. + * @param callback The callback function. + */ + getMulti(key: any[] | Buffer[], callback: Bucket.MultiGetCallback): void; - on(event: string, listener: Function): void; - on(event: 'connect', listener: (err: Error) => any): void; - on(event: 'error', listener: (err: Error) => any): void; + /** + * Get a document from a replica server in your cluster. + * @param key The target document key. + * @param callback The callback function. + */ + getReplica(key: any | Buffer, callback: Bucket.OpCallback): void; - prepend(key: string, fragment: string, callback: KeyCallback): void; - prepend(key: string, fragment: string, options: PrependOptions, callback: KeyCallback): void; - prepend(key: string, fragment: Buffer, callback: KeyCallback): void; - prepend(key: string, fragment: Buffer, options: PrependOptions, callback: KeyCallback): void; - prependMulti(kv: { [key: string]: PrependMultiOptionsFoValue }, options: { [key: string]: PrependMultiOptions }, callback: MultiCallback): void; + /** + * Get a document from a replica server in your cluster. + * @param key The target document key. + * @param options The options object. + * @param callback The callback function. + */ + getReplica(key: any | Buffer, options: GetReplicaOptions, callback: Bucket.OpCallback): void; - remove(key: string, callback: KeyCallback): void; - remove(key: string, options: RemoveOptions, callback: KeyCallback): void; - removeMulti(kv: { [key: string]: RemoveMultiOptionsForValue }, options: RemoveMultiOptions, callback: MultiCallback): void; - removeMulti(kv: string[], options: RemoveMultiOptions, callback: MultiCallback): void; + /** + * Identical to Bucket#upsert but will fail if the document already exists. + * @param key The target document key. + * @param value The document's contents. + * @param callback The callback function. + */ + insert(key: any | Buffer, value: any, callback: Bucket.OpCallback): void; + + /** + * Identical to Bucket#upsert but will fail if the document already exists. + * @param key The target document key. + * @param value The document's contents. + * @param options The options object. + * @param callback The callback function. + */ + insert(key: any | Buffer, value: any, options: InsertOptions, callback: Bucket.OpCallback): void; - removeDesignDoc(name: string, callback: DDocCallback): void; + /** + * Returns an instance of a BuckerManager for performing management operations against a bucket. + */ + manager(): BucketManager; - replace(key: string, value: any, callback: KeyCallback): void; - replace(key: string, value: any, options: ReplaceOptions, callback: KeyCallback): void; - replaceMulti(kv: { [key: string]: ReplaceMultiOptionsForValue }, options: ReplaceMultiOptions, callback: MultiCallback): void; + /** + * Like Bucket#append, but prepends data to the existing value. + * @param key The target document key. + * @param fragment The document's contents to prepend. + * @param callback The callback function. + */ + prepend(key: any, fragment: any, callback: Bucket.OpCallback): void; - set(key: string, value: any, callback: KeyCallback): void; - set(key: string, value: any, options: SetOptions, callback: KeyCallback): void; - setMulti(kv: { [key: string]: SetMultiOptionsForValue }, options: SetMultiOptions, callback: MultiCallback): void; + /** + * Like Bucket#append, but prepends data to the existing value. + * @param key The target document key. + * @param fragment The document's contents to prepend. + * @param options The options object. + * @param callback The callback function. + */ + prepend(key: any, fragment: any, options: PrependOptions, callback: Bucket.OpCallback): void; - setDesignDoc(name: string, data: any, callback: DDocCallback): void; + /** + * Executes a previously prepared query object. This could be a ViewQuery or a N1qlQuery. + * Note: N1qlQuery queries are currently an uncommitted interface and may be subject to change in 2.0.0's final release. + * @param query The query to execute. + * @param callback The callback function. + */ + query(query: ViewQuery | N1qlQuery, callback: Bucket.QueryCallback): Bucket.ViewQueryResponse | Bucket.N1qlQueryResponse; - shutdown(): void; + /** + * Executes a previously prepared query object. This could be a ViewQuery or a N1qlQuery. + * Note: N1qlQuery queries are currently an uncommitted interface and may be subject to change in 2.0.0's final release. + * @param query The query to execute. + * @param params A list or map to do replacements on a N1QL query. + * @param callback The callback function. + */ + query(query: ViewQuery | N1qlQuery, params: Object | Array, callback: Bucket.QueryCallback): Bucket.ViewQueryResponse | Bucket.N1qlQueryResponse; - stats(callback: StatsCallback): void; - stats(key: string, callback: StatsCallback): void; + /** + * Deletes a document on the server. + * @param key The target document key. + * @param callback The callback function. + */ + remove(key: any | Buffer, callback: Bucket.OpCallback): void; - strError(code: number): string; + /** + * Deletes a document on the server. + * @param key The target document key. + * @param options The options object. + * @param callback The callback function. + */ + remove(key: any | Buffer, options: RemoveOptions, callback: Bucket.OpCallback): void; - touch(key: string, callback: KeyCallback): void; - touch(key: string, options: TouchOptions, callback: KeyCallback): void; + /** + * Identical to Bucket#upsert, but will only succeed if the document exists already (i.e. the inverse of Bucket#insert). + * @param key The target document key. + * @param value The document's contents. + * @param callback The callback function. + */ + replace(key: any | Buffer, value: any, callback: Bucket.OpCallback): void; - unlock(key: string, options: UnlockOptions, callback: KeyCallback): void; - unlockMulti(kv: { [key: string]: UnlockMultiOptionsForValue }, options: { [key: string]: UnlockMultiOptions }, callback: UnlockMultiOptions): void; + /** + * Identical to Bucket#upsert, but will only succeed if the document exists already (i.e. the inverse of Bucket#insert). + * @param key The target document key. + * @param value The document's contents. + * @param options The options object. + * @param callback The callback function. + */ + replace(key: any | Buffer, value: any, options: ReplaceOptions, callback: Bucket.OpCallback): void; - view(ddoc: string, name: string): ViewQuery; - view(ddoc: string, name: string, query: any): ViewQuery; + /** + * Configures a custom set of transcoder functions for encoding and decoding values that are being stored or retreived from the server. + * @param encoder The function for encoding. + * @param decoder The function for decoding. + */ + setTranscoder(encoder: Bucket.EncoderFunction, decoder: Bucket.DecoderFunction): void; + + /** + * Update the document expiration time. + * @param key The target document key. + * @param expiry The expiration time to use. If a value of 0 is provided, then the current expiration time is cleared and the key is set to never expire. Otherwise, the key is updated to expire in the time provided (in seconds). Values larger than 302460*60 seconds (30 days) are interpreted as absolute times (from the epoch). + * @param options The options object. + * @param callback The callback function. + */ + touch(key: any | Buffer, expiry: number, options: TouchOptions, callback: Bucket.OpCallback): void; + + /** + * Unlock a previously locked document on the server. See the Bucket#lock method for more details on locking. + * @param key The target document key. + * @param cas The CAS value returned when the key was locked. This operation will fail if the CAS value provided does not match that which was the result of the original lock operation. + * @param callback The callback function. + */ + unlock(key: any | Buffer, cas: Bucket.CAS, callback: Bucket.OpCallback): void; + + /** + * Unlock a previously locked document on the server. See the Bucket#lock method for more details on locking. + * @param key The target document key. + * @param cas The CAS value returned when the key was locked. This operation will fail if the CAS value provided does not match that which was the result of the original lock operation. + * @param options The options object. + * @param callback The callback function. + */ + unlock(key: any | Buffer, cas: Bucket.CAS, options: any, callback: Bucket.OpCallback): void; + + /** + * Stores a document to the bucket. + * @param key The target document key. + * @param value The document's contents. + * @param callback The callback function. + */ + upsert(key: any | Buffer, value: any, callback: Bucket.OpCallback): void; + + /** + * Stores a document to the bucket. + * @param key The target document key. + * @param value The document's contents. + * @param options The options object. + * @param callback The callback function. + */ + upsert(key: any | Buffer, value: any, options: UpsertOptions, callback: Bucket.OpCallback): void; } - export class ViewQuery { - firstPage(q: any, callback: Function): void; - query(q: any, callback: Function): void; - } + module Bucket { + + /** + * his is used as a callback from executed queries. It is a shortcut method that automatically subscribes to the rows and error events of the Bucket.ViewQueryResponse. + */ + interface QueryCallback { + /** + * @param error The error for the operation. This can either be an Error object or a falsy value. + * @param rows The rows returned from the query. + * @param meta The metadata returned by the query. + */ + (error: CouchbaseError, rows: any[], meta: Bucket.ViewQueryResponse.Meta): void; + } -} + /** + * Single-Key callbacks. + * This callback is passed to all of the single key functions. + * It returns a result objcet containing a combination of a CAS and a value, depending on which operation was invoked. + */ + interface OpCallback { + /** + * @param error The error for the operation. This can either be an Error object or a value which evaluates to false (null, undefined, 0 or false). + * @param result The result of the operation that was executed. This usually contains at least a cas property, and on some operations will contain a value property as well. + */ + (error: CouchbaseError | number, result: any): void; + } + + /** + * Multi-Get Callback. + * This callback is used to return results from a getMulti operation. + */ + interface MultiGetCallback { + /** + * @param error The number of keys that failed to be retrieved. The precise errors are available by checking the error property of the individual documents. + * @param results This is a map of keys to results. The result for each key will optionally contain an error if one occured, or if no error occured will contain the CAS and value of the document. + */ + (error: number, results: any[]): void; + } + + /** + * Transcoder Encoding Function. + * This function will receive a value when a storage operation is invoked that needs to encode user-provided data for storage into Couchbase. It expects to be returned a Buffer object to store along with an integer representing any flag metadata relating to how to decode the key later using the matching DecoderFunction. + */ + interface EncoderFunction { + /** + * Transcoder Encoding Function. + * This function will receive a value when a storage operation is invoked that needs to encode user-provided data for storage into Couchbase. It expects to be returned a Buffer object to store along with an integer representing any flag metadata relating to how to decode the key later using the matching DecoderFunction. + * @param value The value needing encoding. + */ + (value: any): Bucket.TranscoderDoc; + } + + /** + * Transcoder Decoding Function. + * This function will receive an object containing a Buffer value and an integer value representing any flags metadata whenever a retrieval operation is executed. It is expected that this function will return a value representing the original value stored and encoded with its matching EncoderFunction. + */ + interface DecoderFunction { + /** + * + * @param doc The data from Couchbase to decode. + */ + (doc: Bucket.TranscoderDoc): any + } + + /** + * The CAS value is a special object that indicates the current state of the item on the server. Each time an object is mutated on the server, the value is changed. CAS objects can be used in conjunction with mutation operations to ensure that the value on the server matches the local value retrieved by the client. This is useful when doing document updates on the server as you can ensure no changes were applied by other clients while you were in the process of mutating the document locally. + * In the Node.js SDK, the CAS is represented as an opaque value. As such,y ou cannot generate CAS objects, but should rather use the values returned from a Bucket.OpCallback. + */ + interface CAS { + + } + + /** + * An event emitter allowing you to bind to various query result set events. + */ + interface N1qlQueryResponse extends events.EventEmitter { + + } + + module N1qlQueryResponse { + /** + * The meta-information available from a view query response. + */ + interface Meta { + /** + * The identifier for this query request. + */ + requestID: number; + } + } + + /** + * A class used in relation to transcoders. + */ + class TranscoderDoc { + value: Buffer; + flags: number; + } + + /** + * An event emitter allowing you to bind to various query result set events. + */ + interface ViewQueryResponse extends events.EventEmitter { + + } + + module ViewQueryResponse { + /** + * The meta-information available from a view query response. + */ + interface Meta { + /** + * The total number of rows available in the index of the view that was queried. + */ + total_rows: number; + } + } + } +} \ No newline at end of file diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 236b87d55..1f5ebe7a1 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -3032,6 +3032,46 @@ declare module d3 { padding(padding: number): Pack; } + export function partition(): Partition; + export function partition(): Partition; + + module partition { + interface Link { + source: T; + target: T; + } + + interface Node { + parent?: Node; + children?: number; + value?: number; + depth?: number; + x?: number; + y?: number; + dx?: number; + dy?: number; + } + + } + + export interface Partition { + nodes(root: T): T[]; + + links(nodes: T[]): partition.Link[]; + + children(): (node: T, depth: number) => T[]; + children(children: (node: T, depth: number) => T[]): Partition; + + sort(): (a: T, b: T) => number; + sort(comparator: (a: T, b: T) => number): Partition; + + value(): (node: T) => number; + value(value: (node: T) => number): Partition; + + size(): [number, number]; + size(size: [number, number]): Partition; + } + export function pie(): Pie; export function pie(): Pie; diff --git a/dagre/dagre.d.ts b/dagre/dagre.d.ts index fb5bd95d9..d16df5216 100644 --- a/dagre/dagre.d.ts +++ b/dagre/dagre.d.ts @@ -31,3 +31,7 @@ declare module Dagre{ } declare var dagre: Dagre.DagreFactory; + +declare module "dagre" { + export = dagre; +} diff --git a/debug/debug-tests.ts b/debug/debug-tests.ts index 63a0a3ac4..a26400340 100644 --- a/debug/debug-tests.ts +++ b/debug/debug-tests.ts @@ -1,4 +1,3 @@ -/// /// import debug = require("debug"); @@ -6,7 +5,7 @@ import debug = require("debug"); debug.disable(); debug.enable("DefinitelyTyped:*"); -var log: debug.Debugger = debug("DefinitelyTyped:log"); +var log:debug.IDebugger = debug("DefinitelyTyped:log"); log("Just text"); log("Formatted test (%d arg)", 1); @@ -15,6 +14,6 @@ log("Formatted %s (%d args)", "test", 2); log("Enabled?: %s", debug.enabled("DefinitelyTyped:log")); log("Namespace: %s", log.namespace); -var error: debug.Debugger = debug("DefinitelyTyped:error"); +var error:debug.IDebugger = debug("DefinitelyTyped:error"); error.log = console.error.bind(console); error("This should be printed to stderr"); diff --git a/debug/debug.d.ts b/debug/debug.d.ts index 1a71725a8..b43cd238c 100644 --- a/debug/debug.d.ts +++ b/debug/debug.d.ts @@ -1,30 +1,38 @@ // Type definitions for debug // Project: https://github.com/visionmedia/debug -// Definitions by: Seon-Wook Park +// Definitions by: Seon-Wook Park , Gal Talmor // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module "debug" { - - function d(namespace: string): d.Debugger; - - module d { - export var log: Function; - - function enable(namespaces: string): void; - function disable(): void; - - function enabled(namespace: string): boolean; - - export interface Debugger { - (formatter: any, ...args: any[]): void; - - enabled: boolean; - log: Function; - namespace: string; - } - } - - export = d; +declare var debug: debug.IDebug; +// Support AMD require +declare module 'debug' { + export = debug; } +declare module debug { + export interface IDebug { + (namespace: string): debug.IDebugger, + coerce: (val: any) => any, + disable: () => void, + enable: (namespaces: string) => void, + enabled: (namespaces: string) => boolean, + + names: string[], + skips: string[], + + formatters: IFormatters + } + + export interface IFormatters { + [formatter: string]: Function + } + + export interface IDebugger { + (formatter: any, ...args: any[]): void; + + enabled: boolean; + log: Function; + namespace: string; + } +} diff --git a/dhtmlxscheduler/dhtmlxscheduler.d.ts b/dhtmlxscheduler/dhtmlxscheduler.d.ts index c79ce78c9..78537e393 100644 --- a/dhtmlxscheduler/dhtmlxscheduler.d.ts +++ b/dhtmlxscheduler/dhtmlxscheduler.d.ts @@ -1165,11 +1165,22 @@ interface SchedulerStatic{ */ deleteEvent(id: any); + /** + * removes all blocking sets from the scheduler + */ + deleteMarkedTimespan(); + /** * removes marking/blocking set by the addMarkedTimespan() and blockTime() methods * @param id the timespan id */ deleteMarkedTimespan(id: string); + + /** + * removes marking/blocking set by the addMarkedTimespan() and blockTime() methods + * @param configuration for deleting + */ + deleteMarkedTimespan(config: any); /** * deletes a section from the currently active view (if the opened view isn't Timeline in the 'Tree' mode - the method will be ignored) @@ -1212,6 +1223,13 @@ interface SchedulerStatic{ * expands the scheduler to the full screen view */ expand(); + + /** + * filter events that will be displayed on the week view + * @param id event-id + * @param event event-object + */ + filter_week(id: any, event: any); /** * gives access to the objects of lightbox's sections diff --git a/errorhandler/errorhandler-tests.ts b/errorhandler/errorhandler-tests.ts index 0ba9edb56..1316888e3 100644 --- a/errorhandler/errorhandler-tests.ts +++ b/errorhandler/errorhandler-tests.ts @@ -1,7 +1,8 @@ /// -import express = require('express'); -import errorhandler = require('errorhandler'); +import * as express from 'express'; +import * as errorhandler from 'errorhandler'; + var app = express(); app.use(errorhandler()); @@ -14,4 +15,4 @@ app.use(errorhandler({ log: (err, str, req, res) => { const requestWasFresh = req && req.fresh; const responseContentType = res && res.contentType -}})) \ No newline at end of file +}})) diff --git a/errorhandler/errorhandler.d.ts b/errorhandler/errorhandler.d.ts index 8ae5e924c..37d5c3c41 100644 --- a/errorhandler/errorhandler.d.ts +++ b/errorhandler/errorhandler.d.ts @@ -6,19 +6,19 @@ /// declare module "errorhandler" { - import express = require('express'); - + import * as express from 'express'; + function errorHandler(options?: errorHandler.Options): express.ErrorRequestHandler; - + namespace errorHandler { interface LoggingCallback { (err: Error, str: string, req: express.Request, res: express.Response): void; } - + interface Options { /** * Defaults to true. - * + * * Possible values: * true : Log errors using console.error(str). * false : Only send the error back in the response. @@ -27,6 +27,6 @@ declare module "errorhandler" { log: boolean | LoggingCallback; } } - + export = errorHandler; } diff --git a/eventemitter3/eventemitter3-tests.ts b/eventemitter3/eventemitter3-tests.ts index 4fa378bc2..49ae0a24d 100644 --- a/eventemitter3/eventemitter3-tests.ts +++ b/eventemitter3/eventemitter3-tests.ts @@ -35,7 +35,10 @@ class EventEmitterTest { constructor() { this.v = new EventEmitter(); this.v = new EventEmitter3ImportedAsES6Module(); - var n: NodeJS.EventEmitter = this.v; + + // Some methods are missing or incompatible with current implementation (v4.2.x) of NodeJS.EventEmitter + // (e.g. getMaxListenters or listeners) + // var n: NodeJS.EventEmitter = this.v; } listeners() { diff --git a/fbemitter/fbemitter-tests.ts b/fbemitter/fbemitter-tests.ts new file mode 100644 index 000000000..614d57963 --- /dev/null +++ b/fbemitter/fbemitter-tests.ts @@ -0,0 +1,349 @@ +/// +/// +/// +/// +'use strict'; + +/** + * The tests are adapted from ../eventemitter3/eventemitter3-tests.ts + */ + +import { EventEmitter, EventSubscription } from 'fbemitter'; +import * as util from 'util'; +import * as assert from 'assert'; + +describe('EventEmitter', function tests() { + 'use strict'; + + it('inherits when used with require(util).inherits', function () { + class Beast extends EventEmitter { + /* rawr, i'm a beast */ + } + + util.inherits(Beast, EventEmitter); + + var moop = new Beast() + , meap = new Beast(); + + assert.strictEqual(moop instanceof Beast, true); + assert.strictEqual(moop instanceof EventEmitter, true); + + moop.listeners('click'); + meap.listeners('click'); + + moop.addListener('data', function () { + throw new Error('I should not emit'); + }); + + meap.emit('data', 'rawr'); + meap.removeAllListeners(); + }); + + describe('EventEmitter#emit', function () { + it('emits with context', function (done) { + var context = { bar: 'baz' } + , e = new EventEmitter(); + + e.addListener('foo', function (bar: string) { + assert.strictEqual(bar, 'bar'); + assert.strictEqual(this, context); + + done(); + }, context); + + e.emit('foo', 'bar'); + }); + + it('can emit the function with multiple arguments', function () { + var e = new EventEmitter(); + + for(var i = 0; i < 100; i++) { + (function (j: number) { + for (var i = 0, args: number[] = []; i < j; i++) { + args.push(j); + } + + e.once('args', function () { + assert.strictEqual(arguments.length, args.length); + assert.deepStrictEqual(Array.prototype.slice.call(arguments), args); + }); + + e.emit.apply(e, (['args'] as any[]).concat(args)); + })(i); + } + }); + + it('can emit the function with multiple arguments, multiple listeners', function () { + var e = new EventEmitter(); + + for(var i = 0; i < 100; i++) { + (function (j: number) { + for (var i = 0, args: number[] = []; i < j; i++) { + args.push(j); + } + + e.once('args', function () { + assert.strictEqual(arguments.length, args.length); + assert.deepStrictEqual(Array.prototype.slice.call(arguments), args); + }); + + e.once('args', function () { + assert.strictEqual(arguments.length, args.length); + assert.deepStrictEqual(Array.prototype.slice.call(arguments), args); + }); + + e.once('args', function () { + assert.strictEqual(arguments.length, args.length); + assert.deepStrictEqual(Array.prototype.slice.call(arguments), args); + }); + + e.once('args', function () { + assert.strictEqual(arguments.length, args.length); + assert.deepStrictEqual(Array.prototype.slice.call(arguments), args); + }); + + e.emit.apply(e, (['args'] as any[]).concat(args)); + })(i); + } + }); + + it('emits with context, multiple listeners (force loop)', function () { + var e = new EventEmitter(); + + e.addListener('foo', function (bar: string) { + assert.deepStrictEqual(this, { foo: 'bar' }); + assert.strictEqual(bar, 'bar'); + }, { foo: 'bar' }); + + e.addListener('foo', function (bar: string) { + assert.deepStrictEqual(this, { bar: 'baz' }); + assert.strictEqual(bar, 'bar'); + }, { bar: 'baz' }); + + e.emit('foo', 'bar'); + }); + + it('emits with different contexts', function () { + var e = new EventEmitter() + , pattern = ''; + + function writer() { + pattern += this; + } + + e.addListener('write', writer, 'foo'); + e.addListener('write', writer, 'baz'); + e.once('write', writer, 'bar'); + e.once('write', writer, 'banana'); + + e.emit('write'); + assert.strictEqual(pattern, 'foobazbarbanana'); + }); + + it('receives the emitted events', function (done) { + var e = new EventEmitter(); + + e.addListener('data', function (a: string, b: EventEmitter, c: Date, d: void, undef: void) { + assert.strictEqual(a, 'foo'); + assert.strictEqual(b, e); + assert.strictEqual(c instanceof Date, true); + assert.strictEqual(undef, undefined); + assert.strictEqual(arguments.length, 3); + + done(); + }); + + e.emit('data', 'foo', e, new Date()); + }); + + it('emits to all event listeners', function () { + var e = new EventEmitter() + , pattern: string[] = []; + + e.addListener('foo', function () { + pattern.push('foo1'); + }); + + e.addListener('foo', function () { + pattern.push('foo2'); + }); + + e.emit('foo'); + + assert.strictEqual(pattern.join(';'), 'foo1;foo2'); + }); + + }); + + describe('EventEmitter#listeners', function () { + it('returns an empty array if no listeners are specified', function () { + var e = new EventEmitter(); + + assert.strictEqual(e.listeners('foo') instanceof Array, true); + assert.strictEqual(e.listeners('foo').length, 0); + }); + + it('returns an array of function', function () { + var e = new EventEmitter(); + + function foo() {} + + e.addListener('foo', foo); + assert.strictEqual(e.listeners('foo') instanceof Array, true); + assert.strictEqual(e.listeners('foo').length, 1); + console.log(e.listeners('foo')[0]); + assert.strictEqual(e.listeners('foo')[0], foo); + }); + + it('is not vulnerable to modifications', function () { + var e = new EventEmitter(); + + function foo() {} + + e.addListener('foo', foo); + + assert.strictEqual(e.listeners('foo')[0], foo); + + e.listeners('foo').length = 0; + assert.strictEqual(e.listeners('foo')[0], foo); + }); + }); + + describe('EventEmitter#once', function () { + it('only emits it once', function () { + var e = new EventEmitter() + , calls = 0; + + e.once('foo', function () { + calls++; + }); + + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + + assert.strictEqual(e.listeners('foo').length, 0); + assert.strictEqual(calls, 1); + }); + + it('only emits once if emits are nested inside the listener', function () { + var e = new EventEmitter() + , calls = 0; + + e.once('foo', function () { + calls++; + e.emit('foo'); + }); + + e.emit('foo'); + assert.strictEqual(e.listeners('foo').length, 0); + assert.strictEqual(calls, 1); + }); + + it('only emits once for multiple events', function () { + var e = new EventEmitter() + , multi = 0 + , foo = 0 + , bar = 0; + + e.once('foo', function () { + foo++; + }); + + e.once('foo', function () { + bar++; + }); + + e.addListener('foo', function () { + multi++; + }); + + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + + assert.strictEqual(e.listeners('foo').length, 1); + assert.strictEqual(multi, 5); + assert.strictEqual(foo, 1); + assert.strictEqual(bar, 1); + }); + + it('only emits once with context', function (done) { + var context = { foo: 'bar' } + , e = new EventEmitter(); + + e.once('foo', function (bar: string) { + assert.strictEqual(this, context); + assert.strictEqual(bar, 'bar'); + done(); + }, context); + + e.emit('foo', 'bar'); + }); + }); + + describe('EventSubscription#remove', function () { + it('should only remove the event with the specified function', function () { + var e = new EventEmitter(); + + function bar() {} + var foo = e.addListener('foo', function () {}); + var bar1 = e.addListener('bar', function () {}); + var bar2 = e.addListener('bar', bar); + + assert.strictEqual(e.listeners('foo').length, 1); + assert.strictEqual(e.listeners('bar').length, 2); + + foo.remove(); + assert.strictEqual(e.listeners('foo').length, 0); + assert.strictEqual(e.listeners('bar').length, 2); + + bar2.remove(); + assert.strictEqual(e.listeners('bar').length, 1); + + bar1.remove(); + assert.strictEqual(e.listeners('bar').length, 0); + }); + }); + + describe('EventEmitter#removeAllListeners', function () { + it('removes all events for the specified events', function () { + var e = new EventEmitter(); + + e.addListener('foo', function () { throw new Error('oops'); }); + e.addListener('foo', function () { throw new Error('oops'); }); + e.addListener('bar', function () { throw new Error('oops'); }); + e.addListener('aaa', function () { throw new Error('oops'); }); + + e.removeAllListeners('foo'); + assert.strictEqual(e.listeners('foo').length, 0); + assert.strictEqual(e.listeners('bar').length, 1); + assert.strictEqual(e.listeners('aaa').length, 1); + + e.removeAllListeners('bar'); + e.removeAllListeners('aaa'); + assert.strictEqual(e.listeners('foo').length, 0); + assert.strictEqual(e.listeners('bar').length, 0); + assert.strictEqual(e.listeners('aaa').length, 0); + }); + + it('just nukes the fuck out of everything', function () { + var e = new EventEmitter(); + + e.addListener('foo', function () { throw new Error('oops'); }); + e.addListener('foo', function () { throw new Error('oops'); }); + e.addListener('bar', function () { throw new Error('oops'); }); + e.addListener('aaa', function () { throw new Error('oops'); }); + + e.removeAllListeners(); + assert.strictEqual(e.listeners('foo').length, 0); + assert.strictEqual(e.listeners('bar').length, 0); + assert.strictEqual(e.listeners('aaa').length, 0); + }); + }); + +}); diff --git a/fbemitter/fbemitter.d.ts b/fbemitter/fbemitter.d.ts new file mode 100644 index 000000000..b26b1a316 --- /dev/null +++ b/fbemitter/fbemitter.d.ts @@ -0,0 +1,67 @@ +// Type definitions for Facebook's EventEmitter 2.0.0 +// Project: https://github.com/facebook/emitter +// Definitions by: kmxz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'fbemitter' { + + export class EventSubscription { + + listener: Function; + context: any; + + /** + * Removes this subscription from the subscriber that controls it. + */ + remove(): void; + + } + + export class EventEmitter { + + constructor(); + + /** + * Adds a listener to be invoked when events of the specified type are + * emitted. An optional calling context may be provided. The data arguments + * emitted will be passed to the listener function. + */ + addListener(eventType: string, listener: Function, context?: any): EventSubscription; + + /** + * Similar to addListener, except that the listener is removed after it is + * invoked once. + */ + once(eventType: string, listener: Function, context?: any): EventSubscription; + + /** + * Removes all of the registered listeners, including those registered as + * listener maps. + */ + removeAllListeners(eventType?: string): void; + + /** + * Provides an API that can be called during an eventing cycle to remove the + * last listener that was invoked. This allows a developer to provide an event + * object that can remove the listener (or listener map) during the + * invocation. + * + * If it is called when not inside of an emitting cycle it will throw. + */ + removeCurrentListener(): void; + + /** + * Returns an array of listeners that are currently registered for the given + * event. + */ + listeners(eventType: string): Function[]; + + /** + * Emits an event of the given type with the given data. All handlers of that + * particular type will be notified. + */ + emit(eventType: string, ...data: any[]): void; + + } + +} \ No newline at end of file diff --git a/field/field-test.ts b/field/field-test.ts new file mode 100644 index 000000000..4a3daf8dd --- /dev/null +++ b/field/field-test.ts @@ -0,0 +1,29 @@ +// From https://github.com/jprichardson/field/blob/e968fd979ba1a06e35571695ddfdad513e516eae/README.md + +/// +import * as field from 'field'; + +// get + +const config = { + environment: { + production: { + port: 80 + } + } +} + +console.log(field.get(config, 'environment:production:port')) +// => 80 + +// set + +var database: any = {} + +console.log(field.get(database, 'production.port')) +// => undefined + +// will return undefined since it never existed before +field.set(database, 'production.port', 27017) +console.log(database.production.port) +// => 27017 diff --git a/field/field.d.ts b/field/field.d.ts new file mode 100644 index 000000000..75b1c8d39 --- /dev/null +++ b/field/field.d.ts @@ -0,0 +1,9 @@ +// Type definitions for field 1.0.1 +// Project: https://www.npmjs.com/package/field +// Definitions by: Leo Liang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'field' { + export function get(topObj: any, fields: string): any; + export function set(topObj: any, fields: string, value: any): any; +} diff --git a/flot/jquery.flot.d.ts b/flot/jquery.flot.d.ts index 027330eee..c45558b87 100644 --- a/flot/jquery.flot.d.ts +++ b/flot/jquery.flot.d.ts @@ -92,6 +92,8 @@ declare module jquery.flot { interface axisOptions { show?: boolean; // null or true/false position?: string; // "bottom" or "top" or "left" or "right" + mode?: string; // "time" + monthNames?: string[]; // array of month names color?: any; // null or color spec tickColor?: any; // null or color spec diff --git a/foundation-sites/foundation-tests.ts b/foundation-sites/foundation-sites-tests.ts similarity index 97% rename from foundation-sites/foundation-tests.ts rename to foundation-sites/foundation-sites-tests.ts index 225f3c0fa..678945265 100644 --- a/foundation-sites/foundation-tests.ts +++ b/foundation-sites/foundation-sites-tests.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// -/// +/// $(document).foundation(); $(document).foundation('method5'); diff --git a/foundation-sites/foundation.d.ts b/foundation-sites/foundation-sites.d.ts similarity index 87% rename from foundation-sites/foundation.d.ts rename to foundation-sites/foundation-sites.d.ts index a6dd7682d..55070df14 100644 --- a/foundation-sites/foundation.d.ts +++ b/foundation-sites/foundation-sites.d.ts @@ -1,15 +1,20 @@ -// Type definitions for Foundation Sites v6.0.4 +// Type definitions for Foundation Sites v6.1.1 // Project: http://foundation.zurb.com/ // Definitions by: Sam Vloeberghs // Definitions: https://github.com/borisyankov/DefinitelyTyped +// please also see the typings project and prefer to use it! +// typings project: https://github.com/typings/typings +// typings: https://github.com/samvloeberghs/foundation-sites-typings + /// declare module FoundationSites { // http://foundation.zurb.com/sites/docs/abide.html#javascript-reference interface Abide { - requiredChedck(element:Object): boolean; + requiredChecked(element:Object): boolean; + findFormError($el:Object): Object; findLabel(element:Object): boolean; addErrorClasses(element:Object): void; removeErrorClasses(element:Object): void; @@ -17,7 +22,9 @@ declare module FoundationSites { validateForm(element:Object): void; validateText(element:Object): boolean; validateRadio(group:string): boolean; + matchValidation($el:Object, validators:string, required:boolean): boolean; resetForm($form:Object): void; + destroy(): void; } interface IAbidePatterns { @@ -40,9 +47,13 @@ declare module FoundationSites { } interface IAbideOptions { - slideSpeed?: number; - multiOpen?: boolean; - patters?: IAbidePatterns; + validateOn?: string; + labelErrorClass?: string; + inputErrorClass?: string; + formErrorSelector?: string; + formErrorClass?: string; + liveValidate?: boolean; + validators?:any; } // http://foundation.zurb.com/sites/docs/accordion.html#javascript-reference @@ -56,10 +67,12 @@ declare module FoundationSites { interface IAccordionOptions { slideSpeed?: number multiOpen?: boolean; + allowAllClosed?: boolean; } // http://foundation.zurb.com/sites/docs/accordion-menu.html#javascript-reference interface AccordionMenu { + hideAll(): void; toggle($target:JQuery): void; down($target:JQuery, firstTime:boolean): void; up($target:JQuery): void; @@ -73,7 +86,8 @@ declare module FoundationSites { // http://foundation.zurb.com/sites/docs/drilldown-menu.html#javascript-reference interface Drilldown { - _hideAll($elem:JQuery): void; + _hideAll(): void; + _back($elem:JQuery): void; _show($elem:JQuery): void; _hide($elem:JQuery): void; destroy(): void; @@ -97,11 +111,13 @@ declare module FoundationSites { interface IDropdownOptions { hoverDelay?: number; hover?: boolean; + hoverPane?: boolean; vOffset?: number; hOffset?: number; positionClass?: string; trapFocus?: boolean; autoFocus?: boolean; + closeOnClick?: boolean; } // http://foundation.zurb.com/sites/docs/dropdown-menu.html#javascript-reference @@ -115,21 +131,26 @@ declare module FoundationSites { hoverDelay?: number; clickOpen?: boolean; closingTime?: number; - alignments?: string; - verticalClasss?: string; - rightClasss?: string; + alignment?: string; + closeOnClick?:boolean; + verticalClass?: string; + rightClass?: string; + forceFollow?: boolean; } // http://foundation.zurb.com/sites/docs/equalizer.html#javascript-reference interface Equalizer { getHeights(element:Object): Array; - applyHeight($eqParent:Object, heights:Array): void; + getHeightsByRow(cb:Function): void; + applyHeight(heights:Array): void; + applyHeightByRow(groups:Array):void; destroy(): void; } interface IEqualizerOptions { equalizeOnStack?: boolean; - throttleInterval?: number; + equalizeByRow?: boolean; + equalizeOn?:string; } // http://foundation.zurb.com/sites/docs/interchange.html#javascript-reference @@ -155,13 +176,15 @@ declare module FoundationSites { threshold?: number; activeClass?: string; deepLinking?: boolean; + barOffset?: number; } // http://foundation.zurb.com/sites/docs/offcanvas.html#javascript-reference interface OffCanvas { + reveal(isRevealed:boolean): void; open(event:Object, trigger:JQuery): void; - toggle(event:Object, trigger:JQuery): void; close(): void; + toggle(event:Object, trigger:JQuery): void; destroy(): void; } @@ -178,8 +201,8 @@ declare module FoundationSites { // http://foundation.zurb.com/sites/docs/orbit.html#javascript-reference interface Orbit { - changeSlide(isLTR:boolean, chosenSlide?:Object, idx?:number): void; geoSync(): void; + changeSlide(isLTR:boolean, chosenSlide?:Object, idx?:number): void; destroy(): void; } @@ -201,6 +224,7 @@ declare module FoundationSites { boxOfBullets?: string; nextClass?: string; prevClass?: string; + useMUI?: boolean; } // http://foundation.zurb.com/sites/docs/reveal.html#javascript-reference @@ -254,7 +278,7 @@ declare module FoundationSites { _pauseListeners(scrollListener:string): void; _calc(checkSizes:boolean, scroll:number): void; destroy(): void; - emCalc(number:any): void; + emCalc(Number:number): void; } interface IStickyOptions { @@ -279,7 +303,11 @@ declare module FoundationSites { } interface ITabsOptions { - animate?: boolean; + autoFocus?: boolean; + wrapOnKeys?: boolean; + matchHeight?: boolean; + linkClass?: string; + panelClass?: string; } // http://foundation.zurb.com/sites/docs/toggler.html#javascript-reference @@ -328,14 +356,15 @@ declare module FoundationSites { interface KeyBoard { parseKey(event:any): string; + handleKey(event:any, component:any, functions:any):void; findFocusable($element:Object): Object; } interface MediaQuery { get(size:string): string; atLeast(size:string): boolean; - queries:Array; - current:any; + queries:Array; + current:string; } interface Motion { @@ -348,9 +377,8 @@ declare module FoundationSites { } interface Nest { - // TODO - //Feather: function(menu, type) - // Burn: function(menu, type){ + Feather(menu:any, type:any):void; + Burn(menu:any, type:any):void; } interface Timer { @@ -374,6 +402,7 @@ declare module FoundationSites { plugin(plugin:Object, name:string): void; registerPlugin(plugin:Object): void; unregisterPlugin(plugin:Object): void; + reInit(plugins:Array):void; GetYoDigits(length:number, namespace?:string): string; reflow(elem:Object, plugins?:Array|string): void; getFnName(fn:string): string; @@ -382,7 +411,6 @@ declare module FoundationSites { util : { throttle(func:(...args:any[]) => any, delay:number): (...args:any[]) => any; }; - onImagesLoaded(images:Object, cb:Function): void; Abide(element:Object, options?:IAbideOptions): Abide; Accordion(element:Object, options?:IAccordionOptions): Accordion; diff --git a/freedom/freedom.d.ts b/freedom/freedom.d.ts index fa80a530c..c69b800e9 100644 --- a/freedom/freedom.d.ts +++ b/freedom/freedom.d.ts @@ -497,6 +497,7 @@ declare module freedom.Social { interface UserProfile { userId: string; name: string; + status?: number; url?: string; // Image URI (e.g. data:image/png;base64,adkwe329...) imageData?: string; diff --git a/fullname/fullname-tests.ts b/fullname/fullname-tests.ts new file mode 100644 index 000000000..a037f2634 --- /dev/null +++ b/fullname/fullname-tests.ts @@ -0,0 +1,5 @@ +/// + +import fullname = require("fullname"); + +fullname().then(function(name) { name === "string"; }); diff --git a/fullname/fullname.d.ts b/fullname/fullname.d.ts new file mode 100644 index 000000000..a1d44f167 --- /dev/null +++ b/fullname/fullname.d.ts @@ -0,0 +1,11 @@ +// Type definitions for fullname v2.1.0 +// Project: https://www.npmjs.com/package/fullname +// Definitions by: Klaus Reimer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "fullname" { + function fullname(): Promise; + export = fullname; +} diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index ef9c21e52..fd7437a89 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -19,6 +19,8 @@ import { shell } from 'electron'; +require('electron').hideInternalModules(); + import path = require('path'); // Quick start @@ -201,7 +203,7 @@ ipcMain.on('online-status-changed', (event: any, status: any) => { app.on('ready', () => { window = new BrowserWindow({ width: 800, - height: 600, + height: 600, titleBarStyle: 'hidden-inset', }); window.loadURL('https://github.com'); @@ -247,9 +249,21 @@ contentTracing.startRecording('*', contentTracing.DEFAULT_OPTIONS, () => { // dialog // https://github.com/atom/electron/blob/master/docs/api/dialog.md -console.log(dialog.showOpenDialog({ +// variant without browserWindow +var openDialogResult: string[] = dialog.showOpenDialog({ + title: 'Testing showOpenDialog', + defaultPath: '/var/log/syslog', + filters: [{name: '', extensions: ['']}], properties: ['openFile', 'openDirectory', 'multiSelections'] -})); +}); + +// variant with browserWindow +openDialogResult = dialog.showOpenDialog(win, { + title: 'Testing showOpenDialog', + defaultPath: '/var/log/syslog', + filters: [{name: '', extensions: ['']}], + properties: ['openFile', 'openDirectory', 'multiSelections'] +}); // global-shortcut // https://github.com/atom/electron/blob/master/docs/api/global-shortcut.md @@ -273,12 +287,12 @@ globalShortcut.unregisterAll(); // ipcMain // https://github.com/atom/electron/blob/master/docs/api/ipc-main-process.md -ipcMain.on('asynchronous-message', (event: any, arg: any) => { +ipcMain.on('asynchronous-message', (event: GitHubElectron.IPCMainEvent, arg: any) => { console.log(arg); // prints "ping" event.sender.send('asynchronous-reply', 'pong'); }); -ipcMain.on('synchronous-message', (event: any, arg: any) => { +ipcMain.on('synchronous-message', (event: GitHubElectron.IPCMainEvent, arg: any) => { console.log(arg); // prints "ping" event.returnValue = 'pong'; }); diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index a9b83b7dc..290bf06aa 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -70,9 +70,11 @@ declare module GitHubElectron { once(event: string, listener: Function): Screen; removeListener(event: string, listener: Function): Screen; removeAllListeners(event?: string): Screen; - setMaxListeners(n: number): void; + setMaxListeners(n: number): Screen; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; /** * @returns The current absolute position of the mouse pointer. */ @@ -108,9 +110,11 @@ declare module GitHubElectron { once(event: string, listener: Function): WebContents; removeListener(event: string, listener: Function): WebContents; removeAllListeners(event?: string): WebContents; - setMaxListeners(n: number): void; + setMaxListeners(n: number): WebContents; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; constructor(options?: BrowserWindowOptions); /** * @returns All opened browser windows. @@ -522,9 +526,11 @@ declare module GitHubElectron { once(event: string, listener: Function): WebContents; removeListener(event: string, listener: Function): WebContents; removeAllListeners(event?: string): WebContents; - setMaxListeners(n: number): void; + setMaxListeners(n: number): WebContents; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; /** * Loads the url in the window. * @param url Must contain the protocol prefix (e.g., the http:// or file://). @@ -930,9 +936,11 @@ declare module GitHubElectron { once(event: string, listener: Function): App; removeListener(event: string, listener: Function): App; removeAllListeners(event?: string): App; - setMaxListeners(n: number): void; + setMaxListeners(n: number): App; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; /** * Try to close all windows. The before-quit event will first be emitted. * If all windows are successfully closed, the will-quit event will be emitted @@ -1113,7 +1121,7 @@ declare module GitHubElectron { * Note: This API is only available on Mac. */ setMenu(menu: Menu): void; - } + }; } class AutoUpdater implements NodeJS.EventEmitter { @@ -1122,9 +1130,11 @@ declare module GitHubElectron { once(event: string, listener: Function): AutoUpdater; removeListener(event: string, listener: Function): AutoUpdater; removeAllListeners(event?: string): AutoUpdater; - setMaxListeners(n: number): void; + setMaxListeners(n: number): AutoUpdater; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; /** * Set the url and initialize the auto updater. * The url cannot be changed once it is set. @@ -1147,11 +1157,11 @@ declare module GitHubElectron { browserWindow?: BrowserWindow, options?: OpenDialogOptions, callback?: (fileNames: string[]) => void - ): void; + ): string[]; export function showOpenDialog( options?: OpenDialogOptions, callback?: (fileNames: string[]) => void - ): void; + ): string[]; interface OpenDialogOptions { title?: string; @@ -1183,8 +1193,12 @@ declare module GitHubElectron { /** * File types that can be displayed, see dialog.showOpenDialog for an example. */ - filters?: string[]; - }, callback?: (fileName: string) => void): void; + + filters?: { + name: string; + extensions: string[]; + }[] + }, callback?: (fileName: string) => void): string; /** * Shows a message box. It will block until the message box is closed. It returns . @@ -1232,9 +1246,11 @@ declare module GitHubElectron { once(event: string, listener: Function): Tray; removeListener(event: string, listener: Function): Tray; removeAllListeners(event?: string): Tray; - setMaxListeners(n: number): void; + setMaxListeners(n: number): Tray; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; /** * Creates a new tray icon associated with the image. */ @@ -1312,7 +1328,7 @@ declare module GitHubElectron { */ read(format: string, type?: string): any; } - + interface CrashReporterStartOptions { /** * Default: Electron @@ -1341,9 +1357,9 @@ declare module GitHubElectron { * Only string properties are send correctly. * Nested objects are not supported. */ - extra?: {} + extra?: {}; } - + interface CrashReporterPayload extends Object { /** * E.g., "electron-crash-service". @@ -1383,18 +1399,18 @@ declare module GitHubElectron { */ upload_file_minidump: File; } - + interface CrashReporter { start(options?: CrashReporterStartOptions): void; - + /** * @returns The date and ID of the last crash report. When there was no crash report * sent or the crash reporter is not started, null will be returned. */ getLastCrashReport(): CrashReporterPayload; } - - interface Shell{ + + interface Shell { /** * Show the given file in a file manager. If possible, select the file. */ @@ -1426,9 +1442,11 @@ declare module GitHubElectron { once(event: string, listener: Function): IpcRenderer; removeListener(event: string, listener: Function): IpcRenderer; removeAllListeners(event?: string): IpcRenderer; - setMaxListeners(n: number): void; + setMaxListeners(n: number): IpcRenderer; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; /** * Send ...args to the renderer via channel in asynchronous message, the main * process can handle it by listening to the channel event of ipc module. @@ -1450,7 +1468,25 @@ declare module GitHubElectron { sendToHost(channel: string, ...args: any[]): void; } - interface Remote { + class IPCMain implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): IPCMain; + once(event: string, listener: Function): IPCMain; + removeListener(event: string, listener: Function): IPCMain; + removeAllListeners(event?: string): IPCMain; + setMaxListeners(n: number): IPCMain; + getMaxListeners(): number; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; + on(event: string, listener: (event: IPCMainEvent, ...args: any[]) => any): IPCMain; + } + + interface IPCMainEvent { + returnValue?: any; + sender: WebContents; + } + + interface Remote extends CommonElectron { /** * @returns The object returned by require(module) in the main process. */ @@ -1458,7 +1494,7 @@ declare module GitHubElectron { /** * @returns The BrowserWindow object which this web page belongs to. */ - getCurrentWindow(): BrowserWindow + getCurrentWindow(): BrowserWindow; /** * @returns The global variable of name (e.g. global[name]) in the main process. */ @@ -1467,9 +1503,9 @@ declare module GitHubElectron { * Returns the process object in the main process. This is the same as * remote.getGlobal('process'), but gets cached. */ - process: any; + process: NodeJS.Process; } - + interface WebFrame { /** * Changes the zoom factor to the specified factor, zoom factor is @@ -1509,7 +1545,7 @@ declare module GitHubElectron { // Type definitions for main process - interface ContentTracing { + interface ContentTracing { /** * Get a set of category groups. The category groups can change as new code paths are reached. * @param callback Called once all child processes have acked to the getCategories request. @@ -1588,7 +1624,7 @@ declare module GitHubElectron { ENABLE_SAMPLING: number; RECORD_CONTINUOUSLY: number; } - + interface Dialog { /** * @param callback If supplied, the API call will be asynchronous. @@ -1608,7 +1644,7 @@ declare module GitHubElectron { * @returns The index of the clicked button. */ showMessageBox: typeof GitHubElectron.Dialog.showMessageBox; - + /** * Runs a modal dialog that shows an error message. This API can be called safely * before the ready event of app module emits, it is usually used to report errors @@ -1616,7 +1652,7 @@ declare module GitHubElectron { */ showErrorBox(title: string, content: string): void; } - + interface GlobalShortcut { /** * Registers a global shortcut of accelerator. @@ -1643,14 +1679,14 @@ declare module GitHubElectron { */ unregisterAll(): void; } - + class RequestFileJob { /** * Create a request job which would query a file of path and set corresponding mime types. */ constructor(path: string); } - + class RequestStringJob { /** * Create a request job which sends a string as response. @@ -1667,7 +1703,7 @@ declare module GitHubElectron { data?: string; }); } - + class RequestBufferJob { /** * Create a request job which accepts a buffer and sends a string as response. @@ -1684,7 +1720,7 @@ declare module GitHubElectron { data?: Buffer; }); } - + interface Protocol { registerProtocol(scheme: string, handler: (request: any) => void): void; unregisterProtocol(scheme: string): void; @@ -1696,28 +1732,93 @@ declare module GitHubElectron { RequestBufferJob: typeof RequestBufferJob; } + interface PowerSaveBlocker { + start(type: string): number; + stop(id: number): void; + isStarted(id: number): boolean; + } - interface Electron { + interface ClearStorageDataOptions { + origin?: string; + storages?: string[]; + quotas?: string[]; + } + + interface NetworkEmulationOptions { + offline?: boolean; + latency?: number; + downloadThroughput?: number; + uploadThroughput?: number; + } + + interface CertificateVerifyProc { + (hostname: string, cert: any, callback: (accepted: boolean) => any): any; + } + + class Session { + static fromPartition(partition: string): Session; + static defaultSession: Session; + + cookies: any; + clearCache(callback: Function): void; + clearStorageData(callback: Function): void; + clearStorageData(options: ClearStorageDataOptions, callback: Function): void; + setProxy(config: string, callback: Function): void; + resolveProxy(url: URL, callback: (proxy: any) => any): void; + setDownloadPath(path: string): void; + enableNetworkEmulation(options: NetworkEmulationOptions): void; + disableNetworkEmulation(): void; + setCertificateVerifyProc(proc: CertificateVerifyProc): void; + webRequest: any; + } + + interface CommonElectron { clipboard: GitHubElectron.Clipboard; crashReporter: GitHubElectron.CrashReporter; nativeImage: typeof GitHubElectron.NativeImage; - screen: GitHubElectron.Screen; shell: GitHubElectron.Shell; - remote: GitHubElectron.Remote; - ipcRenderer: GitHubElectron.IpcRenderer; - webFrame: GitHubElectron.WebFrame; + app: GitHubElectron.App; autoUpdater: GitHubElectron.AutoUpdater; BrowserWindow: typeof GitHubElectron.BrowserWindow; contentTracing: GitHubElectron.ContentTracing; dialog: GitHubElectron.Dialog; + ipcMain: GitHubElectron.IPCMain; globalShortcut: GitHubElectron.GlobalShortcut; - ipcMain: NodeJS.EventEmitter; Menu: typeof GitHubElectron.Menu; MenuItem: typeof GitHubElectron.MenuItem; powerMonitor: NodeJS.EventEmitter; + powerSaveBlocker: GitHubElectron.PowerSaveBlocker; protocol: GitHubElectron.Protocol; + screen: GitHubElectron.Screen; + session: GitHubElectron.Session; Tray: typeof GitHubElectron.Tray; + hideInternalModules(): void; + } + + interface DesktopCapturerOptions { + types?: string[]; + thumbnailSize?: { + width: number; + height: number; + }; + } + + interface DesktopCapturerSource { + id: string; + name: string; + thumbnail: NativeImage; + } + + interface DesktopCapturer { + getSources(options: any, callback: (error: Error, sources: DesktopCapturerSource[]) => any): void; + } + + interface Electron extends CommonElectron { + desktopCapturer: GitHubElectron.DesktopCapturer; + ipcRenderer: GitHubElectron.IpcRenderer; + remote: GitHubElectron.Remote; + webFrame: GitHubElectron.WebFrame; } } diff --git a/gulp-autoprefixer/gulp-autoprefixer-tests.ts b/gulp-autoprefixer/gulp-autoprefixer-tests.ts index 9fca0fa69..1b3ba0d53 100644 --- a/gulp-autoprefixer/gulp-autoprefixer-tests.ts +++ b/gulp-autoprefixer/gulp-autoprefixer-tests.ts @@ -1,7 +1,7 @@ /// /// -import gulp = require("gulp"); -import autoprefixer = require("gulp-autoprefixer"); +import * as gulp from "gulp"; +import * as autoprefixer from "gulp-autoprefixer"; gulp.src("test.css") .pipe(autoprefixer()) @@ -17,4 +17,4 @@ gulp.src("test.css") gulp.src("test.css") .pipe(autoprefixer({remove: false})) - .pipe(gulp.dest("build")); \ No newline at end of file + .pipe(gulp.dest("build")); diff --git a/gulp-autoprefixer/gulp-autoprefixer.d.ts b/gulp-autoprefixer/gulp-autoprefixer.d.ts index 5abfdc628..4ab8cf40d 100644 --- a/gulp-autoprefixer/gulp-autoprefixer.d.ts +++ b/gulp-autoprefixer/gulp-autoprefixer.d.ts @@ -14,5 +14,7 @@ declare module "gulp-autoprefixer" { function autoPrefixer(opts?: Options): NodeJS.ReadWriteStream; + namespace autoPrefixer {} + export = autoPrefixer; } diff --git a/gulp-csso/gulp-csso-tests.ts b/gulp-csso/gulp-csso-tests.ts index 5f61d4871..0ddf457c7 100644 --- a/gulp-csso/gulp-csso-tests.ts +++ b/gulp-csso/gulp-csso-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require('gulp'); -import csso = require('gulp-csso'); +import * as gulp from 'gulp'; +import * as csso from 'gulp-csso'; gulp.task('default', () => gulp.src('./main.css') diff --git a/gulp-csso/gulp-csso.d.ts b/gulp-csso/gulp-csso.d.ts index d5d338c4a..c2b58777a 100644 --- a/gulp-csso/gulp-csso.d.ts +++ b/gulp-csso/gulp-csso.d.ts @@ -7,6 +7,6 @@ declare module 'gulp-csso' { function csso(structureMinimization?: boolean): NodeJS.ReadWriteStream; - + namespace csso {} export = csso; } diff --git a/gulp-debug/gulp-debug-tests.ts b/gulp-debug/gulp-debug-tests.ts index e6485d8da..970107410 100644 --- a/gulp-debug/gulp-debug-tests.ts +++ b/gulp-debug/gulp-debug-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require('gulp'); -import debug = require('gulp-debug'); +import * as gulp from 'gulp'; +import * as debug from 'gulp-debug'; gulp.task('default', () => gulp.src('foo.js') diff --git a/gulp-debug/gulp-debug.d.ts b/gulp-debug/gulp-debug.d.ts index 743f5f5eb..d7ade91ac 100644 --- a/gulp-debug/gulp-debug.d.ts +++ b/gulp-debug/gulp-debug.d.ts @@ -13,5 +13,7 @@ declare module 'gulp-debug' { function debug(options?: IOptions): NodeJS.ReadWriteStream; + namespace debug {} + export = debug; } diff --git a/gulp-dtsm/gulp-dtsm-tests.ts b/gulp-dtsm/gulp-dtsm-tests.ts index f97f8705e..1eb505738 100644 --- a/gulp-dtsm/gulp-dtsm-tests.ts +++ b/gulp-dtsm/gulp-dtsm-tests.ts @@ -2,10 +2,9 @@ /// /// -import dtsm = require('gulp-dtsm'); -import gulp = require('gulp'); +import * as dtsm from 'gulp-dtsm'; +import * as gulp from 'gulp'; var stream: NodeJS.WritableStream = dtsm(); gulp.task('dtsm', () => gulp.src('./dtsm.json').pipe(dtsm())); - diff --git a/gulp-dtsm/gulp-dtsm.d.ts b/gulp-dtsm/gulp-dtsm.d.ts index a8fe7878f..63f01e1f5 100644 --- a/gulp-dtsm/gulp-dtsm.d.ts +++ b/gulp-dtsm/gulp-dtsm.d.ts @@ -8,6 +8,7 @@ declare module "gulp-dtsm" { function dtsm(): NodeJS.WritableStream; + namespace dtsm {} + export = dtsm; } - diff --git a/gulp-flatten/gulp-flatten-tests.ts b/gulp-flatten/gulp-flatten-tests.ts index ee5622564..5a476195d 100644 --- a/gulp-flatten/gulp-flatten-tests.ts +++ b/gulp-flatten/gulp-flatten-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require("gulp"); -import flatten = require("gulp-flatten"); +import * as gulp from "gulp"; +import * as flatten from "gulp-flatten"; gulp.task("flatten:simple", () => { gulp.src(["files/**/*.txt"]) diff --git a/gulp-flatten/gulp-flatten.d.ts b/gulp-flatten/gulp-flatten.d.ts index ccd9cedf1..2992aff4f 100644 --- a/gulp-flatten/gulp-flatten.d.ts +++ b/gulp-flatten/gulp-flatten.d.ts @@ -13,5 +13,7 @@ declare module "gulp-flatten" { function flatten(options?: IOptions): NodeJS.ReadWriteStream; + namespace flatten {} + export = flatten; } diff --git a/gulp-gh-pages/gulp-gh-pages-tests.ts b/gulp-gh-pages/gulp-gh-pages-tests.ts index a8633c051..0d12c7329 100644 --- a/gulp-gh-pages/gulp-gh-pages-tests.ts +++ b/gulp-gh-pages/gulp-gh-pages-tests.ts @@ -1,7 +1,7 @@ /// /// -import gulp = require("gulp"); -import ghPages = require("gulp-gh-pages"); +import * as gulp from "gulp"; +import * as ghPages from "gulp-gh-pages"; gulp.src("test.css") .pipe(ghPages()); @@ -22,4 +22,4 @@ gulp.src("test.css") .pipe(ghPages({push: false})); gulp.src("test.css") - .pipe(ghPages({message: "master"})); \ No newline at end of file + .pipe(ghPages({message: "master"})); diff --git a/gulp-gh-pages/gulp-gh-pages.d.ts b/gulp-gh-pages/gulp-gh-pages.d.ts index ef7146564..228589914 100644 --- a/gulp-gh-pages/gulp-gh-pages.d.ts +++ b/gulp-gh-pages/gulp-gh-pages.d.ts @@ -17,5 +17,7 @@ declare module "gulp-gh-pages" { function ghPages(opts?: Options): NodeJS.ReadWriteStream; + namespace ghPages {} + export = ghPages; } diff --git a/gulp-inject/gulp-inject-tests.ts b/gulp-inject/gulp-inject-tests.ts index 804e6f9b5..4f535c8d6 100644 --- a/gulp-inject/gulp-inject-tests.ts +++ b/gulp-inject/gulp-inject-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require("gulp"); -import inject = require("gulp-inject"); +import * as gulp from "gulp"; +import * as inject from "gulp-inject"; gulp.task("inject:simple", () => { gulp.src("src/index.html") diff --git a/gulp-inject/gulp-inject.d.ts b/gulp-inject/gulp-inject.d.ts index fb2668a1f..5e72e0673 100644 --- a/gulp-inject/gulp-inject.d.ts +++ b/gulp-inject/gulp-inject.d.ts @@ -35,5 +35,7 @@ declare module "gulp-inject" { function inject(sources: NodeJS.ReadableStream, options?: IOptions): NodeJS.ReadWriteStream; + namespace inject {} + export = inject; } diff --git a/gulp-less/gulp-less-tests.ts b/gulp-less/gulp-less-tests.ts index a0671e766..ba9758649 100644 --- a/gulp-less/gulp-less-tests.ts +++ b/gulp-less/gulp-less-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require("gulp"); -import less = require("gulp-less"); +import * as gulp from "gulp"; +import * as less from "gulp-less"; // Without options gulp.task("less", () => { diff --git a/gulp-less/gulp-less.d.ts b/gulp-less/gulp-less.d.ts index 84adca370..8ee0a9b48 100644 --- a/gulp-less/gulp-less.d.ts +++ b/gulp-less/gulp-less.d.ts @@ -15,5 +15,7 @@ declare module "gulp-less" { function less(options?: IOptions): NodeJS.ReadWriteStream; + namespace less {} + export = less; } diff --git a/gulp-load-plugins/gulp-load-plugins-tests.ts b/gulp-load-plugins/gulp-load-plugins-tests.ts index f479be00c..50930358f 100644 --- a/gulp-load-plugins/gulp-load-plugins-tests.ts +++ b/gulp-load-plugins/gulp-load-plugins-tests.ts @@ -3,9 +3,9 @@ /// /// -import gulp = require('gulp'); -import gulpConcat = require('gulp-concat'); -import gulpLoadPlugins = require('gulp-load-plugins'); +import * as gulp from 'gulp'; +import * as gulpConcat from 'gulp-concat'; +import * as gulpLoadPlugins from 'gulp-load-plugins'; interface GulpPlugins extends IGulpPlugins { concat: typeof gulpConcat; @@ -29,8 +29,8 @@ gulp.task('taskName', () => { }); /* - * From 0.8.0, you can pass in an object of mappings for renaming plugins. For example, - * imagine you want to load the gulp-ruby-sass plugin, but want to refer to it as just + * From 0.8.0, you can pass in an object of mappings for renaming plugins. For example, + * imagine you want to load the gulp-ruby-sass plugin, but want to refer to it as just * sass : */ plugins = gulpLoadPlugins({ @@ -39,9 +39,9 @@ plugins = gulpLoadPlugins({ } }); /* - * gulp-load-plugins comes with npm scope support. The major difference is that scoped - * plugins are accessible through an object on plugins that represents the scope. For - * example, if the plugin is @myco/gulp-test-plugin then you can access the plugin as + * gulp-load-plugins comes with npm scope support. The major difference is that scoped + * plugins are accessible through an object on plugins that represents the scope. For + * example, if the plugin is @myco/gulp-test-plugin then you can access the plugin as * shown in the following example: */ interface GulpPlugins { @@ -49,5 +49,5 @@ interface GulpPlugins { testPlugin(): NodeJS.ReadWriteStream; } } - + plugins.myco.testPlugin(); diff --git a/gulp-load-plugins/gulp-load-plugins.d.ts b/gulp-load-plugins/gulp-load-plugins.d.ts index c8a11091d..d72ca87c4 100644 --- a/gulp-load-plugins/gulp-load-plugins.d.ts +++ b/gulp-load-plugins/gulp-load-plugins.d.ts @@ -7,7 +7,7 @@ /** Loads in any gulp plugins and attaches them to an object, freeing you up from having to manually require each gulp plugin. */ declare module 'gulp-load-plugins' { - + interface IOptions { /** the glob(s) to search for, default ['gulp-*', 'gulp.*'] */ pattern?: string[]; @@ -24,14 +24,16 @@ declare module 'gulp-load-plugins' { /** a mapping of plugins to rename, the key being the NPM name of the package, and the value being an alias you define */ rename?: IPluginNameMappings; } - + interface IPluginNameMappings { [npmPackageName: string]: string } - + /** Loads in any gulp plugins and attaches them to an object, freeing you up from having to manually require each gulp plugin. */ function gulpLoadPlugins(options?: IOptions): T; - + + namespace gulpLoadPlugins {} + export = gulpLoadPlugins; } diff --git a/gulp-minify-css/gulp-minify-css-tests.ts b/gulp-minify-css/gulp-minify-css-tests.ts index 1375042dd..d8ac4d9df 100644 --- a/gulp-minify-css/gulp-minify-css-tests.ts +++ b/gulp-minify-css/gulp-minify-css-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require("gulp"); -import minifyCSS = require("gulp-minify-css"); +import * as gulp from "gulp"; +import * as minifyCSS from "gulp-minify-css"; gulp.task("minify-css", () => { gulp.src("css/**/*.css") diff --git a/gulp-minify-css/gulp-minify-css.d.ts b/gulp-minify-css/gulp-minify-css.d.ts index be6d45b8b..bc990a6e0 100644 --- a/gulp-minify-css/gulp-minify-css.d.ts +++ b/gulp-minify-css/gulp-minify-css.d.ts @@ -27,5 +27,7 @@ declare module "gulp-minify-css" { function minifyCSS(options?: IOptions): NodeJS.ReadWriteStream; + namespace minifyCSS {} + export = minifyCSS; } diff --git a/gulp-minify-html/gulp-minify-html-tests.ts b/gulp-minify-html/gulp-minify-html-tests.ts index 9714818f5..2ec41e556 100644 --- a/gulp-minify-html/gulp-minify-html-tests.ts +++ b/gulp-minify-html/gulp-minify-html-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require('gulp'); -import minifyHtml = require('gulp-minify-html'); +import * as gulp from 'gulp'; +import * as minifyHtml from 'gulp-minify-html'; minifyHtml(); minifyHtml({conditionals: true, loose: true}); diff --git a/gulp-minify-html/gulp-minify-html.d.ts b/gulp-minify-html/gulp-minify-html.d.ts index 747104084..11ce298a4 100644 --- a/gulp-minify-html/gulp-minify-html.d.ts +++ b/gulp-minify-html/gulp-minify-html.d.ts @@ -31,5 +31,7 @@ declare module 'gulp-minify-html' { function minifyHtml(options?: IOptions): NodeJS.ReadWriteStream; + namespace minifyHtml {} + export = minifyHtml; } diff --git a/gulp-mocha/gulp-mocha-tests.ts b/gulp-mocha/gulp-mocha-tests.ts index 09f62b83d..8d3eda4ea 100644 --- a/gulp-mocha/gulp-mocha-tests.ts +++ b/gulp-mocha/gulp-mocha-tests.ts @@ -1,9 +1,9 @@ /// /// -import gulp = require("gulp"); -import mocha = require("gulp-mocha"); +import * as gulp from "gulp"; +import * as mocha from "gulp-mocha"; gulp.task('default', function () { return gulp.src('test.js', {read: false}) .pipe(mocha({reporter: 'nyan'})); -}); \ No newline at end of file +}); diff --git a/gulp-mocha/gulp-mocha.d.ts b/gulp-mocha/gulp-mocha.d.ts index 8d21b1323..b63714b77 100644 --- a/gulp-mocha/gulp-mocha.d.ts +++ b/gulp-mocha/gulp-mocha.d.ts @@ -8,5 +8,6 @@ declare module "gulp-mocha" { function mocha(setupOptions?: MochaSetupOptions): NodeJS.ReadWriteStream; + namespace mocha {} export = mocha; -} \ No newline at end of file +} diff --git a/gulp-ruby-sass/gulp-ruby-sass-tests.ts b/gulp-ruby-sass/gulp-ruby-sass-tests.ts index cba0c4c60..5237527a4 100644 --- a/gulp-ruby-sass/gulp-ruby-sass-tests.ts +++ b/gulp-ruby-sass/gulp-ruby-sass-tests.ts @@ -1,7 +1,7 @@ /// /// -import gulp = require("gulp"); -import sass = require("gulp-ruby-sass"); +import * as gulp from "gulp"; +import * as sass from "gulp-ruby-sass"; gulp.task('sass', function () { sass('./scss/*.scss') diff --git a/gulp-ruby-sass/gulp-ruby-sass.d.ts b/gulp-ruby-sass/gulp-ruby-sass.d.ts index bb0c56328..2b0d26fdf 100644 --- a/gulp-ruby-sass/gulp-ruby-sass.d.ts +++ b/gulp-ruby-sass/gulp-ruby-sass.d.ts @@ -64,5 +64,7 @@ declare module "gulp-ruby-sass" { */ function sass(source: string, options?: Options): NodeJS.ReadableStream; + namespace sass {} + export = sass; } diff --git a/gulp-size/gulp-size-tests.ts b/gulp-size/gulp-size-tests.ts index bfa2c6a04..8981960f2 100644 --- a/gulp-size/gulp-size-tests.ts +++ b/gulp-size/gulp-size-tests.ts @@ -2,9 +2,9 @@ /// /// -import gulp = require('gulp'); -import size = require('gulp-size'); -import debug = require('gulp-debug'); +import * as gulp from 'gulp'; +import * as size from 'gulp-size'; +import * as debug from 'gulp-debug'; gulp.task('default', () => gulp.src('fixture.js') diff --git a/gulp-size/gulp-size.d.ts b/gulp-size/gulp-size.d.ts index d25f6ed94..022e9b171 100644 --- a/gulp-size/gulp-size.d.ts +++ b/gulp-size/gulp-size.d.ts @@ -19,5 +19,7 @@ declare module 'gulp-size' { function size(options?: IOptions): ISizeStream; + namespace size {} + export = size; } diff --git a/gulp-sort/gulp-sort-tests.ts b/gulp-sort/gulp-sort-tests.ts index 12685c085..d94f5cfdc 100644 --- a/gulp-sort/gulp-sort-tests.ts +++ b/gulp-sort/gulp-sort-tests.ts @@ -3,9 +3,9 @@ /// /// -import gulp = require('gulp'); -import sort = require('gulp-sort'); -import gulpUtil = require('gulp-util'); +import * as gulp from 'gulp'; +import * as sort from 'gulp-sort'; +import * as gulpUtil from 'gulp-util'; // default sort gulp.src('./src/js/**/*.js') @@ -38,7 +38,7 @@ gulp.src('./src/js/**/*.js') } })) .pipe(gulp.dest('./build/js')); - + function customComparator(file1: gulpUtil.File, file2: gulpUtil.File) { if (file1.path.indexOf('build') > -1) { return 1; @@ -47,4 +47,4 @@ function customComparator(file1: gulpUtil.File, file2: gulpUtil.File) { return -1; } return 0; -} \ No newline at end of file +} diff --git a/gulp-sort/gulp-sort.d.ts b/gulp-sort/gulp-sort.d.ts index c06b9c3e0..d4e740fc5 100644 --- a/gulp-sort/gulp-sort.d.ts +++ b/gulp-sort/gulp-sort.d.ts @@ -8,11 +8,11 @@ /** Sort files in stream by path or any custom sort comparator */ declare module 'gulp-sort' { - + import gulpUtil = require('gulp-util'); - + interface IOptions { - /** + /** * A function to compare two files. * Returns: * -1 if file1 should be before file2, @@ -23,9 +23,9 @@ declare module 'gulp-sort' { /** Whether to sort in ascending order, default is true */ asc?: boolean; } - + interface IComparatorFunction { - /** + /** * A function to compare two files. * Returns: * -1 if file1 should be before file2, @@ -34,11 +34,13 @@ declare module 'gulp-sort' { */ (file1: gulpUtil.File, file2: gulpUtil.File): number; } - + /** Sort files in stream by path or any custom sort comparator */ function gulpSort(): NodeJS.ReadWriteStream; function gulpSort(comparator: IComparatorFunction): NodeJS.ReadWriteStream; function gulpSort(options: IOptions): NodeJS.ReadWriteStream; - + + namespace gulpSort {} + export = gulpSort; } diff --git a/gulp-tsd/gulp-tsd-tests.ts b/gulp-tsd/gulp-tsd-tests.ts index a7c20519c..734db65e8 100644 --- a/gulp-tsd/gulp-tsd-tests.ts +++ b/gulp-tsd/gulp-tsd-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require("gulp"); -import tsd = require("gulp-tsd"); +import * as gulp from "gulp"; +import * as tsd from "gulp-tsd"; gulp.task("tsd", () => { gulp.src("gulp_tsd.json") diff --git a/gulp-tsd/gulp-tsd.d.ts b/gulp-tsd/gulp-tsd.d.ts index 816d50d25..4e9380ebf 100644 --- a/gulp-tsd/gulp-tsd.d.ts +++ b/gulp-tsd/gulp-tsd.d.ts @@ -18,5 +18,7 @@ declare module "gulp-tsd" { function tsd(opts?: IOptions, callback?: gulp.TaskCallback): NodeJS.ReadWriteStream; + namespace tsd {} + export = tsd; } diff --git a/gulp-watch/gulp-watch-tests.ts b/gulp-watch/gulp-watch-tests.ts index dd237dccc..d912199fd 100644 --- a/gulp-watch/gulp-watch-tests.ts +++ b/gulp-watch/gulp-watch-tests.ts @@ -1,8 +1,8 @@ /// /// -import gulp = require('gulp'); -import watch = require('gulp-watch'); +import * as gulp from 'gulp'; +import * as watch from 'gulp-watch'; gulp.task('stream', () => gulp.src('css/**/*.css') diff --git a/gulp-watch/gulp-watch.d.ts b/gulp-watch/gulp-watch.d.ts index 35fb7de95..74af52547 100644 --- a/gulp-watch/gulp-watch.d.ts +++ b/gulp-watch/gulp-watch.d.ts @@ -22,6 +22,6 @@ declare module 'gulp-watch' { } function watch(glob: string | Array, options?: IOptions, callback?: Function): IWatchStream; - + namespace watch {} export = watch; } diff --git a/hammerjs/hammerjs.d.ts b/hammerjs/hammerjs.d.ts index 0df86dfc6..e2d4a8c52 100644 --- a/hammerjs/hammerjs.d.ts +++ b/hammerjs/hammerjs.d.ts @@ -107,7 +107,7 @@ interface HammerManager emit( event:string, data:any ):void; get( recogniser:Recognizer ):Recognizer; get( recogniser:string ):Recognizer; - off( events:string, handler:( event:HammerInput ) => void ):void; + off( events:string, handler?:( event:HammerInput ) => void ):void; on( events:string, handler:( event:HammerInput ) => void ):void; recognize( inputData:any ):void; remove( recogniser:Recognizer ):HammerManager; diff --git a/hopscotch/hopscotch.d.ts b/hopscotch/hopscotch.d.ts index 1baac775b..46fdf17c6 100644 --- a/hopscotch/hopscotch.d.ts +++ b/hopscotch/hopscotch.d.ts @@ -77,23 +77,84 @@ interface StepDefinition { } interface HopscotchStatic { + /** + * Actually starts the tour. Optional stepNum argument specifies what step to start at. + */ startTour(tour: TourDefinition, stepNum?: number): void; + + /** + * Skips to a given step in the tour + */ showStep(id: number): void; + + /** + * Goes back one step in the tour + */ prevStep(): void; + + /** + * Goes forward one step in the tour + */ nextStep(): void; + + /** + * Ends the current tour. If clearCookie is set to false, the tour state is preserved. + * Otherwise, if clearCookie is set to true or is not provided, the tour state is cleared. + */ endTour(clearCookie: boolean): void; + + /** + * Sets options for running the tour. + */ configure(options: HopscotchConfiguration): void; + + /** + * Returns the currently running tour. + */ getCurrTour(): TourDefinition; + + /** + * Returns the currently running tour. + */ getCurrStepNum(): number; + + /** + * Checks for tour state saved in sessionStorage/cookies and returns the state if + * it exists. Use this method to determine whether or not you should resume a tour. + */ getState(): string; + /** + * Adds a callback for one of the event types. Valid event types are: + * *start*, *end*, *next*, *prev*, *show*, *close*, *error* + */ listen(eventName: string, callback: () => void): void; + + /** + * Removes a callback for one of the event types. + */ unlisten(eventName: string, callback: () => void): void; + + /** + * Remove callbacks for hopscotch events. If tourOnly is set to true, only removes + * callbacks specified by a tour (callbacks set by hopscotch.configure or hopscotch.listen + * will remain). If eventName is null or undefined, callbacks for all events will be removed. + */ removeCallbacks(eventName?: string, tourOnly?: boolean): void; + /** + * Registers a callback helper. See the section about Helpers below. + */ registerHelper(id: string, helper: (...args: any[]) => void): void; + /** + * Resets i18n strings to original default values. + */ resetDefaultI18N(): void; + + /** + * Resets all config options to original values. + */ resetDefaultOptions(): void; } diff --git a/http-errors/http-errors-tests.ts b/http-errors/http-errors-tests.ts index 06b91f13b..440325900 100644 --- a/http-errors/http-errors-tests.ts +++ b/http-errors/http-errors-tests.ts @@ -1,8 +1,8 @@ /// /// -import createError = require('http-errors'); -import express = require('express'); +import * as createError from 'http-errors'; +import * as express from 'express'; var app = express(); @@ -67,3 +67,5 @@ var err = new createError['404'](); //createError['404'](); // TypeScript should fail with "Did you mean to include 'new'?" //new createError(); // TypeScript should fail with "Only a void function can be called with the 'new' keyword" + +let error: createError.HttpError; diff --git a/http-errors/http-errors.d.ts b/http-errors/http-errors.d.ts index 6f78ff6a7..e15a7cb4e 100644 --- a/http-errors/http-errors.d.ts +++ b/http-errors/http-errors.d.ts @@ -4,82 +4,86 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module 'http-errors' { - interface HttpError extends Error { - status: number; - statusCode: number; - expose: boolean; + namespace createHttpError { + + // See https://github.com/jshttp/http-errors/blob/1.3.1/index.js#L42 + interface HttpError extends Error { + status: number; + statusCode: number; + expose: boolean; + } + + interface CreateHttpError { + // See https://github.com/Microsoft/TypeScript/issues/227#issuecomment-50092674 + [code: string]: new() => HttpError; + + (...args: Array): HttpError; + + Continue: new() => HttpError; + SwitchingProtocols: new() => HttpError; + Processing: new() => HttpError; + OK: new() => HttpError; + Created: new() => HttpError; + Accepted: new() => HttpError; + NonAuthoritativeInformation: new() => HttpError; + NoContent: new() => HttpError; + ResetContent: new() => HttpError; + PartialContent: new() => HttpError; + MultiStatus: new() => HttpError; + AlreadyReported: new() => HttpError; + IMUsed: new() => HttpError; + MultipleChoices: new() => HttpError; + MovedPermanently: new() => HttpError; + Found: new() => HttpError; + SeeOther: new() => HttpError; + NotModified: new() => HttpError; + UseProxy: new() => HttpError; + Unused: new() => HttpError; + TemporaryRedirect: new() => HttpError; + PermanentRedirect: new() => HttpError; + BadRequest: new() => HttpError; + Unauthorized: new() => HttpError; + PaymentRequired: new() => HttpError; + Forbidden: new() => HttpError; + NotFound: new() => HttpError; + MethodNotAllowed: new() => HttpError; + NotAcceptable: new() => HttpError; + ProxyAuthenticationRequired: new() => HttpError; + RequestTimeout: new() => HttpError; + Conflict: new() => HttpError; + Gone: new() => HttpError; + LengthRequired: new() => HttpError; + PreconditionFailed: new() => HttpError; + PayloadTooLarge: new() => HttpError; + URITooLong: new() => HttpError; + UnsupportedMediaType: new() => HttpError; + RangeNotSatisfiable: new() => HttpError; + ExpectationFailed: new() => HttpError; + ImATeapot: new() => HttpError; + UnprocessableEntity: new() => HttpError; + Locked: new() => HttpError; + FailedDependency: new() => HttpError; + UnorderedCollection: new() => HttpError; + UpgradeRequired: new() => HttpError; + PreconditionRequired: new() => HttpError; + TooManyRequests: new() => HttpError; + RequestHeaderFieldsTooLarge: new() => HttpError; + UnavailableForLegalReasons: new() => HttpError; + InternalServerError: new() => HttpError; + NotImplemented: new() => HttpError; + BadGateway: new() => HttpError; + ServiceUnavailable: new() => HttpError; + GatewayTimeout: new() => HttpError; + HTTPVersionNotSupported: new() => HttpError; + VariantAlsoNegotiates: new() => HttpError; + InsufficientStorage: new() => HttpError; + LoopDetected: new() => HttpError; + BandwidthLimitExceeded: new() => HttpError; + NotExtended: new() => HttpError; + NetworkAuthenticationRequired: new() => HttpError; + } } - interface CreateHttpError { - // See https://github.com/Microsoft/TypeScript/issues/227#issuecomment-50092674 - [code: string]: new() => HttpError; - - (...args: Array): HttpError; - - Continue: new() => HttpError; - SwitchingProtocols: new() => HttpError; - Processing: new() => HttpError; - OK: new() => HttpError; - Created: new() => HttpError; - Accepted: new() => HttpError; - NonAuthoritativeInformation: new() => HttpError; - NoContent: new() => HttpError; - ResetContent: new() => HttpError; - PartialContent: new() => HttpError; - MultiStatus: new() => HttpError; - AlreadyReported: new() => HttpError; - IMUsed: new() => HttpError; - MultipleChoices: new() => HttpError; - MovedPermanently: new() => HttpError; - Found: new() => HttpError; - SeeOther: new() => HttpError; - NotModified: new() => HttpError; - UseProxy: new() => HttpError; - Unused: new() => HttpError; - TemporaryRedirect: new() => HttpError; - PermanentRedirect: new() => HttpError; - BadRequest: new() => HttpError; - Unauthorized: new() => HttpError; - PaymentRequired: new() => HttpError; - Forbidden: new() => HttpError; - NotFound: new() => HttpError; - MethodNotAllowed: new() => HttpError; - NotAcceptable: new() => HttpError; - ProxyAuthenticationRequired: new() => HttpError; - RequestTimeout: new() => HttpError; - Conflict: new() => HttpError; - Gone: new() => HttpError; - LengthRequired: new() => HttpError; - PreconditionFailed: new() => HttpError; - PayloadTooLarge: new() => HttpError; - URITooLong: new() => HttpError; - UnsupportedMediaType: new() => HttpError; - RangeNotSatisfiable: new() => HttpError; - ExpectationFailed: new() => HttpError; - ImATeapot: new() => HttpError; - UnprocessableEntity: new() => HttpError; - Locked: new() => HttpError; - FailedDependency: new() => HttpError; - UnorderedCollection: new() => HttpError; - UpgradeRequired: new() => HttpError; - PreconditionRequired: new() => HttpError; - TooManyRequests: new() => HttpError; - RequestHeaderFieldsTooLarge: new() => HttpError; - UnavailableForLegalReasons: new() => HttpError; - InternalServerError: new() => HttpError; - NotImplemented: new() => HttpError; - BadGateway: new() => HttpError; - ServiceUnavailable: new() => HttpError; - GatewayTimeout: new() => HttpError; - HTTPVersionNotSupported: new() => HttpError; - VariantAlsoNegotiates: new() => HttpError; - InsufficientStorage: new() => HttpError; - LoopDetected: new() => HttpError; - BandwidthLimitExceeded: new() => HttpError; - NotExtended: new() => HttpError; - NetworkAuthenticationRequired: new() => HttpError; - } - - var httpError: CreateHttpError; - export = httpError; + var createHttpError: createHttpError.CreateHttpError; + export = createHttpError; } diff --git a/icepick/icepick-tests.ts b/icepick/icepick-tests.ts new file mode 100644 index 000000000..350e5f2dc --- /dev/null +++ b/icepick/icepick-tests.ts @@ -0,0 +1,177 @@ +/// +/// + + +import i = require("icepick"); + +"use strict"; // so attempted modifications of frozen objects will throw errors + +// freeze(collection) +{ + let coll = { + a: "foo", + b: [1, 2, 3], + c: { + d: "bar" + } + }; + + i.freeze(coll); +} + +// thaw(collection) +class Foo {} + +{ + let coll = i.freeze({ a: "foo", b: [1, 2, 3], c: { d: "bar" }, e: new Foo() }); + let thawed = i.thaw(coll); +} + +// assoc(collection, key, value) +{ + let coll = { a: 1, b: 2 }; + let newColl = i.assoc(coll, "b", 3); // {a: 1, b: 3} + + let arr = ["a", "b", "c"]; + let newArr = i.assoc(arr, 2, "d"); // ["a", "b", "d"] +} + +// alias: set(collection, key, value) +{ + let coll = { a: 1, b: 2 }; + let newColl = i.set(coll, "b", 3); // {a: 1, b: 3} + + let arr = ["a", "b", "c"]; + let newArr = i.set(arr, 2, "d"); // ["a", "b", "d"] +} + +// dissoc(collection, key) +{ + let coll = { a: 1, b: 2, c: 3 }; + let newColl = i.dissoc(coll, "b"); // {a: 1, c: 3} + + let arr = ["a", "b", "c"]; + let newArr = i.dissoc(arr, 2); // ["a", , "c"] +} + +// alias: unset(collection, key) +{ + let coll = { a: 1, b: 2, c: 3 }; + let newColl = i.unset(coll, "b"); // {a: 1, c: 3} + + let arr = ["a", "b", "c"]; + let newArr = i.unset(arr, 2); // ["a", , "c"] +} + +// assocIn(collection, path, value) +{ + let coll = { + a: "foo", + b: [1, 2, 3], + c: { + d: "bar" + } + }; + + let newColl = i.assocIn(coll, ["c", "d"], "baz"); + + let coll2 = {}; + let newColl2 = i.assocIn(coll2, ["a", "b", "c"], 1); +} + +// alias: setIn(collection, path, value) +{ + let coll = { + a: "foo", + b: [1, 2, 3], + c: { + d: "bar" + } + }; + + let newColl = i.setIn(coll, ["c", "d"], "baz"); + + let coll2 = {}; + let newColl2 = i.setIn(coll2, ["a", "b", "c"], 1); +} + +// getIn(collection, path) +{ + let coll = i.freeze([ + { a: 1 }, + { b: 2 } + ]); + + let result = i.getIn(coll, [1, "b"]); // 2 +} + +// updateIn(collection, path, callback) +{ + let coll = i.freeze([ + { a: 1 }, + { b: 2 } + ]); + + let newColl = i.updateIn(coll, [1, "b"], function(val: number) { + return val * 2; + }); // [ {a: 1}, {b: 4} ] +} + +// assign(coll1, coll2, ...) +{ + let obj1 = { a: 1, b: 2, c: 3 }; + let obj2 = { c: 4, d: 5 }; + + let result = i.assign(obj1, obj2); // {a: 1, b: 2, c: 4, d: 5} +} + +// merge(target, source) +{ + let defaults = { a: 1, c: { d: 1, e: [1, 2, 3], f: { g: 1 } } }; + let obj = { c: { d: 2, e: [2], f: null as any } }; + + let result1 = i.merge(defaults, obj); // {a: 1, c: {d: 2, e: [2]}, f: null} + + let obj2 = { c: { d: 2 } }; + let result2 = i.merge(result1, obj2); + + (result1 === result2); // true +} + +// arrays +{ + var a = [1]; + a = i.push(a, 2); // [1, 2]; + a = i.unshift(a, 0); // [0, 1, 2]; + a = i.pop(a); // [0, 1]; + a = i.shift(a); // [1]; +} +{ + i.map(function(v) { return v * 2 }, [1, 2, 3]); // [2, 4, 6] + + var removeEvens = _.partial(i.filter, function(v: number) { return v % 2; }); + + removeEvens([1, 2, 3]); // [1, 3] +} +{ + var arr = i.freeze([{ a: 1 }, { b: 2 }]); + + //ECMAScript 2015 + //arr.find(function(item) { return item.b != null; }); // {b: 2} +} + +// chain(coll) - not defined +{ + let o = { + a: [1, 2, 3], + b: { c: 1 }, + d: 4 + }; + + let result = i.chain(o) + .assocIn(["a", 2], 4) + .merge({ b: { c: 2, c2: 3 } }) + .assoc("e", 2) + .dissoc("d") + .value(); +} diff --git a/icepick/icepick.d.ts b/icepick/icepick.d.ts new file mode 100644 index 000000000..85bbf0ae3 --- /dev/null +++ b/icepick/icepick.d.ts @@ -0,0 +1,72 @@ +// Type definitions for icepick v1.1.0 +// Project: https://github.com/aearly/icepick +// Definitions by: Nathan Brown +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "icepick" { + export function freeze(collection: T): T; + export function thaw(collection: T): T; + export function assoc(collection: T, key: number | string, value: any): T; + export function dissoc(collection: T, key: number | string): T; + export function assocIn(collection: T, path: Array, value: any): T; + export function getIn(collection: any, path: Array): Result; + export function updateIn(collection: T, path: Array, callback: (value: V) => V): T; + + export {assoc as set}; + export {dissoc as unset}; + export {assocIn as setIn}; + + export function assign(target: T): T; + export function assign(target: T, source1: S1): (T & S1); + export function assign(target: T, s1: S1, s2: S2): (T & S1 & S2); + export function assign(target: T, s1: S1, s2: S2, s3: S3): (T & S1 & S2 & S3); + export function assign(target: T, s1: S1, s2: S2, s3: S3, s4: S4): (T & S1 & S2 & S3 & S4); + + export {assign as extend}; + + export function merge(target: T, source: S1): (T & S1); + + export function push(array: T[], element: T): T[]; + export function pop(array: T[]): T[]; + export function shift(array: T[]): T[]; + export function unshift(array: T[], element: T): T[]; + export function reverse(array: T[]): T[]; + export function sort(array: T[], compareFunction?: (a:T, b:T) => number): T[]; + export function splice(array: T[], start: number, deleteCount: number, ...items: T[]): T[]; + export function slice(array: T[], begin?: number, end?: number): T[]; + + export function map(fn: (value: T) => U, array: T[]): U[]; + export function filter(fn: (value: T) => boolean, array: T[]): T[]; + + interface IcepickWrapper { + value(): T; + + freeze(): IcepickWrapper; + thaw(): IcepickWrapper; + + assoc(key: number | string, value: any): IcepickWrapper; + set(key: number | string, value: any): IcepickWrapper; + + dissoc(key: number | string): IcepickWrapper; + unset(key: number | string): IcepickWrapper; + + assocIn(path: Array, value: any): IcepickWrapper; + setIn(path: Array, value: any): IcepickWrapper; + + getIn(collection: any, path: Array): IcepickWrapper; + updateIn(collection: T, path: Array, callback: (value: V) => V): IcepickWrapper; + + assign(source1: S1): IcepickWrapper; + assign(s1: S1, s2: S2): IcepickWrapper; + assign(s1: S1, s2: S2, s3: S3): IcepickWrapper; + assign(s1: S1, s2: S2, s3: S3, s4: S4): IcepickWrapper; + extend(source1: S1): IcepickWrapper; + extend(s1: S1, s2: S2): IcepickWrapper; + extend(s1: S1, s2: S2, s3: S3): IcepickWrapper; + extend(s1: S1, s2: S2, s3: S3, s4: S4): IcepickWrapper; + + merge(source: S1): IcepickWrapper; + } + + export function chain(target: T): IcepickWrapper; +} diff --git a/imap/imap.d.ts b/imap/imap.d.ts index 105e64c85..4b88279ae 100644 --- a/imap/imap.d.ts +++ b/imap/imap.d.ts @@ -246,9 +246,11 @@ declare module IMAP { once(event: string, listener: Function): this; removeListener(event: string, listener: Function): this; removeAllListeners(event?: string): this; - setMaxListeners(n: number): void; + setMaxListeners(n: number): this; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; // from MessageFunctions /** Searches the currently open mailbox for messages using given criteria. criteria is a list describing what you want to find. For criteria types that require arguments, use an array instead of just the string criteria type name (e.g. ['FROM', 'foo@bar.com']). Prefix criteria types with an "!" to negate. */ diff --git a/ionic/ionic-tests.ts b/ionic/ionic-tests.ts index 9c5cfdad0..8491fc13f 100644 --- a/ionic/ionic-tests.ts +++ b/ionic/ionic-tests.ts @@ -149,6 +149,7 @@ class IonicTestController { ionicModalController.initialize(modalOptions); ionicModalController.show().then(() => console.log("shown modal")) ionicModalController.hide().then(() => console.log("hid modal")) + ionicModalController.remove().then(() => console.log("removed modal")) var isShown: boolean = ionicModalController.isShown(); this.$ionicModal.fromTemplateUrl("templateUrl", modalOptions) @@ -199,8 +200,9 @@ class IonicTestController { }; var ionicPopoverController: ionic.popover.IonicPopoverController = this.$ionicPopover.fromTemplate("template", popoverOptions); ionicPopoverController.initialize(popoverOptions); - ionicPopoverController.show(angular.element("body")).then(() => console.log("shown popover")) - ionicPopoverController.hide().then(() => console.log("hid popover")) + ionicPopoverController.show(angular.element("body")).then(() => console.log("shown popover")); + ionicPopoverController.hide().then(() => console.log("hid popover")); + ionicPopoverController.remove().then(() => console.log("removed popover")); var isShown: boolean = ionicPopoverController.isShown(); this.$ionicPopover.fromTemplateUrl("templateUrl", popoverOptions) diff --git a/ionic/ionic.d.ts b/ionic/ionic.d.ts index ce097a226..a767b851b 100644 --- a/ionic/ionic.d.ts +++ b/ionic/ionic.d.ts @@ -174,6 +174,7 @@ declare module ionic { initialize(options: IonicModalOptions): void; show(): ng.IPromise; hide(): ng.IPromise; + remove(): ng.IPromise; isShown(): boolean; } @@ -237,6 +238,7 @@ declare module ionic { show($event?: any): ng.IPromise; hide(): ng.IPromise; isShown(): boolean; + remove(): ng.IPromise; } interface IonicPopoverOptions { scope?: any; diff --git a/istanbul/istanbul-tests.ts b/istanbul/istanbul-tests.ts new file mode 100644 index 000000000..b283e2dcc --- /dev/null +++ b/istanbul/istanbul-tests.ts @@ -0,0 +1,27 @@ +/// + +import * as istanbul from 'istanbul'; + +// Instrument code +var instrumenter = new istanbul.Instrumenter(); + +var generatedCode = instrumenter.instrumentSync('function meaningOfLife() { return 42; }', + 'filename.js'); + + +// Generate reports given a bunch of coverage JSON objects +var collector = new istanbul.Collector(), + reporter = new istanbul.Reporter(), + sync = false; + +var obj1 = {}, + obj2 = {}; + +collector.add(obj1); +collector.add(obj2); //etc. + +reporter.add('text'); +reporter.addAll([ 'lcov', 'clover' ]); +reporter.write(collector, sync, function () { + console.log('All reports generated'); +}); diff --git a/istanbul/istanbul.d.ts b/istanbul/istanbul.d.ts new file mode 100644 index 000000000..026ad8b00 --- /dev/null +++ b/istanbul/istanbul.d.ts @@ -0,0 +1,73 @@ +// Type definitions for Istanbul v0.4.0 +// Project: https://github.com/gotwarlost/istanbul +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'istanbul' { + namespace istanbul { + interface Istanbul { + new (options?: any): Istanbul; + Collector: Collector; + config: Config; + ContentWriter: ContentWriter; + FileWriter: FileWriter; + hook: Hook; + Instrumenter: Instrumenter; + Report: Report; + Reporter: Reporter; + Store: Store; + utils: ObjectUtils; + VERSION: string; + Writer: Writer; + } + + interface Collector { + new (options?: any): Collector; + add(coverage: any, testName?: string): void; + } + + interface Config { + } + + interface ContentWriter { + } + + interface FileWriter { + } + + interface Hook { + } + + interface Instrumenter { + new (options?: any): Instrumenter; + instrumentSync(code: string, filename: string): string; + } + + interface Report { + } + + interface Configuration { + new (obj: any, overrides: any): Configuration; + } + + interface Reporter { + new (cfg?: Configuration, dir?: string): Reporter; + add(fmt: string): void; + addAll(fmts: Array): void; + write(collector: Collector, sync: boolean, callback: Function): void; + } + + interface Store { + } + + interface ObjectUtils { + } + + interface Writer { + } + } + + var istanbul: istanbul.Istanbul; + + export = istanbul; +} diff --git a/jade/jade-tests.ts b/jade/jade-tests.ts index 8a2b6b48d..6b4774021 100644 --- a/jade/jade-tests.ts +++ b/jade/jade-tests.ts @@ -1,10 +1,10 @@ /// -import jade from 'jade'; +import * as jade from 'jade'; jade.compile("b")(); jade.compileFile("foo.jade", {})(); jade.compileClient("a")({ a: 1 }); jade.compileClientWithDependenciesTracked("test").body(); jade.render("h1",{}); -jade.renderFile("foo.jade"); \ No newline at end of file +jade.renderFile("foo.jade"); diff --git a/jade/jade.d.ts b/jade/jade.d.ts index 9615fa8c8..0764006e5 100644 --- a/jade/jade.d.ts +++ b/jade/jade.d.ts @@ -4,16 +4,13 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module 'jade' { - module jade { - function compile(template: string, options?: any): (locals?: any) => string; - function compileFile(path: string, options?: any): (locals?: any) => string; - function compileClient(template: string, options?: any): (locals?: any) => string; - function compileClientWithDependenciesTracked(template: string, options?: any): { - body: (locals?: any) => string; - dependencies: string[]; - }; - function render(template: string, options?: any): string; - function renderFile(path: string, options?: any): string; - } - export default jade; + export function compile(template: string, options?: any): (locals?: any) => string; + export function compileFile(path: string, options?: any): (locals?: any) => string; + export function compileClient(template: string, options?: any): (locals?: any) => string; + export function compileClientWithDependenciesTracked(template: string, options?: any): { + body: (locals?: any) => string; + dependencies: string[]; + }; + export function render(template: string, options?: any): string; + export function renderFile(path: string, options?: any): string; } diff --git a/jake/jake.d.ts b/jake/jake.d.ts index 95614374c..84d5c5079 100644 --- a/jake/jake.d.ts +++ b/jake/jake.d.ts @@ -231,9 +231,11 @@ declare module jake{ once(event: string, listener: Function): NodeJS.EventEmitter; removeListener(event: string, listener: Function): NodeJS.EventEmitter; removeAllListeners(event?: string): NodeJS.EventEmitter; - setMaxListeners(n: number): void; + setMaxListeners(n: number): NodeJS.EventEmitter; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; value: any; } diff --git a/jasmine-jquery/jasmine-jquery.d.ts b/jasmine-jquery/jasmine-jquery.d.ts index 903e3f7e2..0e1f2b82b 100644 --- a/jasmine-jquery/jasmine-jquery.d.ts +++ b/jasmine-jquery/jasmine-jquery.d.ts @@ -195,8 +195,8 @@ declare module jasmine { * // returns true * expect($('

    header

    ')).toContainHtml('
      ') */ - //toContainHtml(html: string): boolean; - + toContainHtml(html: string): boolean; + /** * Check if DOM element has the given Text. * @param text Accepts a string or regular expression @@ -213,8 +213,8 @@ declare module jasmine { * // returns true * expect($('

        header

        ')).toContainText('header') */ - //toContainText(text: string): boolean; - + toContainText(text: string): boolean; + /** * Check if DOM element has the given value. * This can only be applied for element on with jQuery val() can be called. diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index ed8591488..46a1937f4 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -281,7 +281,7 @@ declare module jasmine { toBe(expected: any, expectationFailOutput?: any): boolean; toEqual(expected: any, expectationFailOutput?: any): boolean; - toMatch(expected: any, expectationFailOutput?: any): boolean; + toMatch(expected: string | RegExp, expectationFailOutput?: any): boolean; toBeDefined(expectationFailOutput?: any): boolean; toBeUndefined(expectationFailOutput?: any): boolean; toBeNull(expectationFailOutput?: any): boolean; @@ -291,13 +291,12 @@ declare module jasmine { toHaveBeenCalled(): boolean; toHaveBeenCalledWith(...params: any[]): boolean; toContain(expected: any, expectationFailOutput?: any): boolean; - toBeLessThan(expected: any, expectationFailOutput?: any): boolean; - toBeGreaterThan(expected: any, expectationFailOutput?: any): boolean; - toBeCloseTo(expected: any, precision: any, expectationFailOutput?: any): boolean; - toContainHtml(expected: string): boolean; - toContainText(expected: string): boolean; + toBeLessThan(expected: number, expectationFailOutput?: any): boolean; + toBeGreaterThan(expected: number, expectationFailOutput?: any): boolean; + toBeCloseTo(expected: number, precision: any, expectationFailOutput?: any): boolean; toThrow(expected?: any): boolean; - toThrowError(expected?: any, message?: string): boolean; + toThrowError(message?: string | RegExp): boolean; + toThrowError(expected?: Error, message?: string | RegExp): boolean; not: Matchers; Any: Any; diff --git a/javascript-bignum/javascript-bignum-tests.ts b/javascript-bignum/javascript-bignum-tests.ts new file mode 100644 index 000000000..57555fcce --- /dev/null +++ b/javascript-bignum/javascript-bignum-tests.ts @@ -0,0 +1,21 @@ +/// +let m = SchemeNumber("1"); +let n = SchemeNumber(2); + +let sum: SchemeNumber = SchemeNumber.fn["+"](m, n); +sum = SchemeNumber.fn["+"](m, 1); +sum = SchemeNumber.fn["+"](m, "12"); +sum = SchemeNumber.fn["+"]("12", "25"); + +let floored: SchemeNumber = SchemeNumber.fn.floor(m); + +let str: string = floored.toString(16); +str = floored.toExponential(2); +str = floored.toPrecision(2); +str = floored.toFixed(2); + +let num: number = maxIntegerDigits; +num = VERSION[0]; +num = VERSION.length; + +raise("fake error", "This is not really an error", m); diff --git a/javascript-bignum/javascript-bignum.d.ts b/javascript-bignum/javascript-bignum.d.ts new file mode 100644 index 000000000..a088837d1 --- /dev/null +++ b/javascript-bignum/javascript-bignum.d.ts @@ -0,0 +1,53 @@ +// Type definitions for javascript-bignum +// Project: https://github.com/jtobey/javascript-bignum +// Definitions by: Nathan Shively-Sanders +// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Documentation: http://john-edwin-tobey.org/Scheme/javascript-bignum/docs/files/schemeNumber-js.html + +// This version only includes typing for schemeNumber, not the full library +declare type SchemeOperator = (...args: (string | SchemeNumber | number)[]) => SchemeNumber; +declare var VERSION: number[]; +declare function raise(conditionType: string, message: string, ...irritants: any[]): void; +declare var maxIntegerDigits: number; +declare interface SchemeFn { + [opname: string]: SchemeOperator; + inexact: SchemeOperator; + exact: SchemeOperator; + max: SchemeOperator; + min: SchemeOperator; + abs: SchemeOperator; + div: SchemeOperator; + mod: SchemeOperator; + div0: SchemeOperator; + mod0: SchemeOperator; + gcd: SchemeOperator; + lcm: SchemeOperator; + numerator: SchemeOperator; + denominator: SchemeOperator; + floor: SchemeOperator; + ceiling: SchemeOperator; + truncate: SchemeOperator; + round: SchemeOperator; + rationalize: SchemeOperator; + exp: SchemeOperator; + log: SchemeOperator; + sin: SchemeOperator; + cos: SchemeOperator; + tan: SchemeOperator; + asin: SchemeOperator; + acos: SchemeOperator; + atan: SchemeOperator; + sqrt: SchemeOperator; + expt: SchemeOperator; + magnitude: SchemeOperator; + angle: SchemeOperator; +} +declare interface SchemeNumber { + (value: string | number): SchemeNumber; + toString(radix: number): string; + toFixed(fractionDigits: number): string; + toExponential(fractionDigits: number): string; + toPrecision(precision: number): string; + fn: SchemeFn; +} +declare var SchemeNumber: SchemeNumber; diff --git a/joi/joi-tests.ts b/joi/joi-tests.ts index 9e631e3e3..c8c05bf87 100644 --- a/joi/joi-tests.ts +++ b/joi/joi-tests.ts @@ -579,7 +579,9 @@ objSchema = objSchema.without(str, strArr); objSchema = objSchema.rename(str, str); objSchema = objSchema.rename(str, str, renOpts); +objSchema = objSchema.assert(str, schema); objSchema = objSchema.assert(str, schema, str); +objSchema = objSchema.assert(ref, schema); objSchema = objSchema.assert(ref, schema, str); objSchema = objSchema.unknown(); diff --git a/joi/joi.d.ts b/joi/joi.d.ts index 2e230dcb8..c774b36ab 100644 --- a/joi/joi.d.ts +++ b/joi/joi.d.ts @@ -1,6 +1,6 @@ // Type definitions for joi v4.6.0 // Project: https://github.com/spumko/joi -// Definitions by: Bart van der Schoor , Laurence Dougal Myers , Christopher Glantschnig +// Definitions by: Bart van der Schoor , Laurence Dougal Myers , Christopher Glantschnig , David Broder-Rodgers // Definitions: https://github.com/borisyankov/DefinitelyTyped // TODO express type of Schema in a type-parameter (.default, .valid, .example etc) @@ -584,8 +584,8 @@ declare module 'joi' { /** * Verifies an assertion where. */ - assert(ref: string, schema: Schema, message: string): ObjectSchema; - assert(ref: Reference, schema: Schema, message: string): ObjectSchema; + assert(ref: string, schema: Schema, message?: string): ObjectSchema; + assert(ref: Reference, schema: Schema, message?: string): ObjectSchema; /** * Overrides the handling of unknown keys for the scope of the current object only (does not apply to children). diff --git a/jointjs/jointjs.d.ts b/jointjs/jointjs.d.ts index 1c7e91571..cbabf0095 100644 --- a/jointjs/jointjs.d.ts +++ b/jointjs/jointjs.d.ts @@ -60,12 +60,12 @@ declare module joint { } interface IOptions { - width: number; - height: number; - gridSize: number; - perpendicularLinks: boolean; - elementView: ElementView; - linkView: LinkView; + width?: number; + height?: number; + gridSize?: number; + perpendicularLinks?: boolean; + elementView?: ElementView; + linkView?: LinkView; } class Paper extends Backbone.View { diff --git a/jquery.mmenu/jquery.mmenu-tests.ts b/jquery.mmenu/jquery.mmenu-tests.ts new file mode 100644 index 000000000..ae52793d6 --- /dev/null +++ b/jquery.mmenu/jquery.mmenu-tests.ts @@ -0,0 +1,85 @@ +/// +/// + + +// -------------------------------------------------------- +// ---------------- TEST DEFAULT OPTIONS ------------------ +// -------------------------------------------------------- + +var menu: JQuery = $("#my-menu"); +menu.mmenu( + // options + { + extensions: [], + navbar: { + add: true, + title: "Menu", + titleLink: "parent" + }, + onClick: { + close: true, + preventDefault: false, + setSelected: false + }, + slidingSubmenus: true + }, + // configurations + { + classNames: { + divider: "Divider", + inset: "Inset", + panel: "Panel", + selected: "Selected", + vertical: "vertical" + }, + clone: false, + openingInterval: 25, + panelNodetype: "div, ul, ol", + transitionDuration: 400 + } +); + + +// -------------------------------------------------------- +// ------------------- TEST MMENU API --------------------- +// -------------------------------------------------------- + +var api = menu.data("mmenu"); +var myPanel: JQuery = $("#panel"); +var listItem: JQuery = $(".list-item"); + +api.closeAllPanels(); +api.bind("closeAllPanels", function() { + console.log("close all opened panels and go back to the first panel."); +}); + +api.closePanel(myPanel); +api.bind("closePanel", function(panel) { + console.log("close this ", panel); +}); + +api.getInstance(); +api.bind("getInstance", function() { + console.log("get the class instance for the menu."); +}); + +api.init(myPanel); +api.bind("init", function(panel) { + console.log("method to (re)initialize a newly added ", panel); +}); + +api.openPanel(myPanel); +api.bind("openPanel", function(panel) { + console.log("This panel is now opened ", panel); +}); + +api.setSelected(listItem, true); +api.bind("setSelected", function(listItem, selected) { + console.log("set or unset a list item as selected ", listItem); + console.log("has selected ", selected); +}); + +api.update(); +api.bind("update", function() { + console.log("update the appearance for the menu"); +}); diff --git a/jquery.mmenu/jquery.mmenu.d.ts b/jquery.mmenu/jquery.mmenu.d.ts new file mode 100644 index 000000000..a502c37cd --- /dev/null +++ b/jquery.mmenu/jquery.mmenu.d.ts @@ -0,0 +1,242 @@ +// Type definitions for jQuery mmenu v5.5.3 +// Project: http://mmenu.frebsite.nl/ +// Definitions by: John Gouigouix +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module JQueryMmenu { + + interface NavbarOptions { + + /** + * Whether or not to add a navbar above the panels. + * Default: true + */ + add?: boolean; + + /** + * The title above the main panel. + * Default: "Menu" + */ + title?: string; + + /** + * The type of link to set for the title. + * Possible values: "parent", "anchor" or "none". + * Default: "parent" + */ + titleLink?: string; + + } + + interface OnclickOptions { + + /** + * Whether or not the menu should close after clicking a link inside it. + * The default value varies per link: true if the default behavior for + * the clicked link is prevented, false otherwise. + * Default: null + */ + close?: boolean | any; + + /** + * Whether or not to prevent the default behavior for the clicked link. + * The default value varies per link: true if its href is equal to + * or starts with a hash (#), false otherwise. + * Default: null + */ + preventDefault?: boolean | any; + + /** + * Whether or not the clicked link should be visibly "selected". + * Default: true + */ + setSelected?: boolean | any; + + } + + interface Options { + + /** + * A collection of extension names to enable for the menu. + * You'll need this option when using the extensions. + * Default: [] + */ + extensions?: Array; + + /** + * navbar options + */ + navbar?: NavbarOptions; + + /** + * onClick options + */ + onClick?: OnclickOptions; + + /** + * Whether or not submenus should come sliding in from the right. + * If false, submenus expand below their parent. + * To expand a single submenu below its parent item, add the class "Vertical" to it. + * Default: true + */ + slidingSubmenus?: boolean; + + } + + interface ClassnamesConfigurations { + + /** + * The classname on a LI that should be displayed as a divider. + * Default: "Divider" + */ + divider?: string; + + /** + * The classname on a submenu (a nested UL) that should be displayed as a default list. + * Default: "Inset" + */ + inset?: string; + + /** + * The classname on an element (for example a DIV) that should be considered to be a panel. + * Only applies if the "isMenu" option is set to false. + * Default: "Panel" + */ + panel?: string; + + /** + * The classname on the LI that should be displayed as selected. + * Default: "Selected" + */ + selected?: string; + + /** + * The classname on a submenu (a nested UL) that should expand below + * their parent instead of slide in from the right. + * Default: "vertical" + */ + vertical?: string; + + } + + interface Configurations { + + /** + * the CSS class names object + */ + classNames?: ClassnamesConfigurations; + + /** + * Whether or not the menu should be cloned (and the original menu kept intact). + * Default: false + */ + clone?: boolean; + + /** + * The number of milliseconds between opening/closing the menu and panels, + * needed to force CSS transitions. + * Default: 25 + */ + openingInterval?: number; + + /** + * jQuery selector containing the node-type of panels. + * Default: "div, ul, ol" + */ + panelNodetype?: string; + + /** + * The number of milliseconds used in the CSS transitions. + * Default: 400 (The value should match the associated CSS value.) + */ + transitionDuration?: number; + + } + + interface API { + + /** + * Trigger non-specialized signature method + * @param methodName + * @param callback + */ + bind(methodName: string, callback: (...args: any[]) => void): any; + + /** + * Trigger this method to close all opened panels and go back to the first panel. + */ + closeAllPanels(): JQuery; + /** @see closeAllPanels() */ + bind(methodName: "closeAllPanels", callback: () => void): JQuery; + + /** + * Trigger this method to close a panel + * (only available if the "slidingSubmenus" option is set to false). + * @param panel + */ + closePanel(panel: JQuery): void; + /** @see closePanel() */ + bind(methodName: "closePanel", callback: (panel: JQuery) => void): void; + + /** + * Trigger this method to get the class instance for the menu. + */ + getInstance(): void; + /** @see getInstance() */ + bind(methodName: "getInstance", callback: () => void): void; + + /** + * Trigger this method to (re)initialize a newly added panel. + * @param panel The panel to (re)initialize. + */ + init(panel: JQuery): void; + /** @see init() */ + bind(methodName: "init", callback: (panel: JQuery) => void): void; + + /** + * Trigger this method to open a panel. + * @param panel The panel to open. + */ + openPanel(panel: JQuery): void; + /** @see openPanel() */ + bind(methodName: "openPanel", callback: (panel: JQuery) => void): void; + + /** + * Trigger this method to set or unset a list item as "selected". + * @param li The list item to set or unset as "selected". + * @param selected Whether to set or unset the list item as "selected". Default: true + */ + setSelected(li: JQuery, selected?: boolean): void; + /** @see setSelected() */ + bind(methodName: "setSelected", callback: (li: JQuery, selected?: boolean) => void): void; + + /** + * Trigger this method to update the appearance for the menu. + */ + update(): void; + /** @see update() */ + bind(methodName: "update", callback: () => void): void; + + } + +} + + +interface JQuery { + + /** + * Create mmenu component + */ + mmenu(): JQuery; + mmenu(options: JQueryMmenu.Options): JQuery; + mmenu(options: JQueryMmenu.Options, configurations: JQueryMmenu.Configurations): JQuery; + + /** + * Return the mmenu object + * @param element + */ + data(element: "mmenu"): JQueryMmenu.API; + +} diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index 197c4dbd1..c6c55e37f 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -49,7 +49,7 @@ declare module JQueryUI { delay?: number; disabled?: boolean; minLength?: number; - position?: string; + position?: any; // object source?: any; // [], string or () } @@ -1836,4 +1836,4 @@ interface JQueryEasingFunctions { easeInBounce: JQueryEasingFunction; easeOutBounce: JQueryEasingFunction; easeInOutBounce: JQueryEasingFunction; -} \ No newline at end of file +} diff --git a/jsurl/jsurl-tests.ts b/jsurl/jsurl-tests.ts new file mode 100644 index 000000000..a10d0a763 --- /dev/null +++ b/jsurl/jsurl-tests.ts @@ -0,0 +1,80 @@ +/// + +interface UModel extends UrlQuery { + a: any; + b: string; +} + +interface U2Model extends UrlQuery { + a: any; +} + +interface U3Model extends UrlQuery { + foo: string; +} + +var u = new Url(); // curent document URL will be used +// or we can instantiate as +var u2 = new Url("http://example.com/some/path?a=b&c=d#someAnchor"); +// it should support relative URLs also +var u3 = new Url("/my/site/doc/path?foo=bar#baz"); + +// get the value of some query string parameter +alert(u2.query.a); +// or +alert(u3.query["foo"]); + +// Manupulating query string parameters +u.query.a = [1, 2, 3]; // adds/replaces in query string params a=1&a=2&a=3 +u.query.b = 'woohoo'; // adds/replaces in query string param b=woohoo + +if (u.query.a instanceof Array) { // the way to add a parameter + u.query.a.push(4); // now it's "a=1&a=2&a=3&a=4&b=woohoo" +} + +else { // if not an array but scalar value here is a way how to convert to array + u.query.a = [u.query.a]; + u.query.a.push(8) +} + + +// The way to remove the parameter: +delete u.query.a +// or: +delete u.query["a"] + +// If you need to remove all query string params: +u.query.clear(); +alert(u); + +// Lookup URL parts: +alert( + 'protocol = ' + u.protocol + '\n' + + 'user = ' + u.user + '\n' + + 'pass = ' + u.pass + '\n' + + 'host = ' + u.host + '\n' + + 'port = ' + u.port + '\n' + + 'path = ' + u.path + '\n' + + 'query = ' + u.query + '\n' + + 'hash = ' + u.hash +); + +// Manipulating URL parts +u.path = '/some/new/path'; // the way to change URL path +u.protocol = 'https' // the way to force https protocol on the source URL + +// inject into string +var str = 'My Cool Link'; + +// or use in DOM context +var a = document.createElement('a'); +a.href = u.toString(); +a.innerHTML = 'test'; +document.body.appendChild(a); + +// Stringify +var su1 = u + ''; +var su2 = String(u); +var su3 = u.toString(); +// NOTE, that usually it will be done automatically, so only in special +// cases direct stringify is required \ No newline at end of file diff --git a/jsurl/jsurl.d.ts b/jsurl/jsurl.d.ts new file mode 100644 index 000000000..cbe985851 --- /dev/null +++ b/jsurl/jsurl.d.ts @@ -0,0 +1,23 @@ +// Type definitions for jsurl 1.2.7 +// Project: https://github.com/Mikhus/jsurl +// Definitions by: Alexey Gorshkov +// Definitions: https://github.com/agorshkov23/DefinitelyTyped + +interface UrlQuery { + clear: () => void; +} + +declare class Url { + constructor(); + constructor(url: string); + query: T; + protocol: string; + user: string; + pass: string; + host: string; + port: string; + path: string; + hash: string; + href: string; + toString: () => string; +} \ No newline at end of file diff --git a/karma-coverage/karma-coverage-tests.ts b/karma-coverage/karma-coverage-tests.ts new file mode 100644 index 000000000..8ca9edc63 --- /dev/null +++ b/karma-coverage/karma-coverage-tests.ts @@ -0,0 +1,220 @@ +/// + +import * as karma from 'karma-coverage'; + + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/README.md#basic +module.exports = function(config: karma.Config) { + config.set({ + files: [ + 'src/**/*.js', + 'test/**/*.js' + ], + + // coverage reporter generates the coverage + reporters: ['progress', 'coverage'], + + preprocessors: { + // source files, that you wanna generate coverage for + // do not include tests or libraries + // (these files will be instrumented by Istanbul) + 'src/**/*.js': ['coverage'] + }, + + // optionally, configure the reporter + coverageReporter: { + type : 'html', + dir : 'coverage/' + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/README.md#advanced-multiple-reporters +module.exports = function(config: karma.Config) { + config.set({ + files: [ + 'src/**/*.js', + 'test/**/*.js' + ], + reporters: ['progress', 'coverage'], + preprocessors: { + 'src/**/*.js': ['coverage'] + }, + coverageReporter: { + // specify a common output directory + dir: 'build/reports/coverage', + reporters: [ + // reporters not supporting the `file` property + { type: 'html', subdir: 'report-html' }, + { type: 'lcov', subdir: 'report-lcov' }, + // reporters supporting the `file` property, use `subdir` to directly + // output them in the `dir` directory + { type: 'cobertura', subdir: '.', file: 'cobertura.txt' }, + { type: 'lcovonly', subdir: '.', file: 'report-lcovonly.txt' }, + { type: 'teamcity', subdir: '.', file: 'teamcity.txt' }, + { type: 'text', subdir: '.', file: 'text.txt' }, + { type: 'text-summary', subdir: '.', file: 'text-summary.txt' }, + ] + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/README.md#dont-minify-instrumenter-output +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + instrumenterOptions: { + istanbul: { noCompact: true } + } + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#subdir +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + dir: 'coverage', + subdir: '.' + // Would output the results into: .'/coverage/' + } + }); +}; + +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + dir: 'coverage', + subdir: 'report' + // Would output the results into: .'/coverage/report/' + } + }); +}; + +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + dir: 'coverage', + subdir: function(browser) { + // normalization process to keep a consistent browser name accross different + // OS + return browser.toLowerCase().split(/[ /-]/)[0]; + } + // Would output the results into: './coverage/firefox/' + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#file +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + type : 'text', + dir : 'coverage/', + file : 'coverage.txt' + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#check +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + check: { + global: { + statements: 50, + branches: 50, + functions: 50, + lines: 50, + excludes: [ + 'foo/bar/**/*.js' + ] + }, + each: { + statements: 50, + branches: 50, + functions: 50, + lines: 50, + excludes: [ + 'other/directory/**/*.js' + ], + overrides: { + 'baz/component/**/*.js': { + statements: 98 + } + } + } + } + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#watermarks +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + watermarks: { + statements: [ 50, 75 ], + functions: [ 50, 75 ], + branches: [ 50, 75 ], + lines: [ 50, 75 ] + } + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#sourcestore +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + type : 'text', + dir : 'coverage/', + file : 'coverage.txt', + sourceStore : require('istanbul').Store.create('fslookup') + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#reporters +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + reporters:[ + {type: 'html', dir:'coverage/'}, + {type: 'teamcity'}, + {type: 'text-summary'} + ], + } + }); +}; + +// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#instrumenter +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + instrumenters: { ibrik : require('ibrik') }, + instrumenter: { + '**/*.coffee': 'ibrik' + }, + // ... + } + }); +}; + +var to5Options = { experimental: true }; + +// [...] + +module.exports = function(config: karma.Config) { + config.set({ + coverageReporter: { + instrumenters: { isparta : require('isparta') }, + instrumenter: { + '**/*.js': 'isparta' + }, + instrumenterOptions: { + isparta: { to5 : to5Options } + } + } + }); +}; diff --git a/karma-coverage/karma-coverage.d.ts b/karma-coverage/karma-coverage.d.ts new file mode 100644 index 000000000..7b78a36de --- /dev/null +++ b/karma-coverage/karma-coverage.d.ts @@ -0,0 +1,42 @@ +// Type definitions for karma-coverage v0.5.3 +// Project: https://github.com/karma-runner/karma-coverage +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module 'karma-coverage' { + import * as karma from 'karma'; + import * as istanbul from 'istanbul'; + + namespace karmaCoverage { + interface Karma extends karma.Karma {} + + interface Config extends karma.Config { + set: (config: ConfigOptions) => void; + } + + interface ConfigOptions extends karma.ConfigOptions { + /** + * See https://github.com/karma-runner/karma-coverage/blob/master/docs/configuration.md + */ + coverageReporter?: (Reporter|Reporter[]); + } + + interface Reporter { + type?: string; + dir?: string; + subdir?: string | ((browser: string) => string); + check?: any; + watermarks?: any; + includeAllSources?: boolean; + sourceStore?: istanbul.Store; + instrumenter?: any; + } + } + + var karmaCoverage: karmaCoverage.Karma; + + export = karmaCoverage; +} diff --git a/karma/karma.d.ts b/karma/karma.d.ts index c489535eb..87d05843d 100644 --- a/karma/karma.d.ts +++ b/karma/karma.d.ts @@ -82,8 +82,8 @@ declare module 'karma' { interface ServerCallback { (exitCode: number): void; } - - interface Config { + + interface Config { set: (config: ConfigOptions) => void; LOG_DISABLE: string; LOG_ERROR: string; @@ -91,7 +91,7 @@ declare module 'karma' { LOG_INFO: string; LOG_DEBUG: string; } - + interface ConfigFile { configFile: string; } diff --git a/kefir/kefir-tests.ts b/kefir/kefir-tests.ts index a0d0a9618..94300550b 100644 --- a/kefir/kefir-tests.ts +++ b/kefir/kefir-tests.ts @@ -30,7 +30,7 @@ import { Observable, ObservablePool, Stream, Property, Event, Emitter } from 'ke let stream10: Stream = Kefir.stream(emitter => { let count = 0; emitter.emit(count); - + let intervalId = setInterval(() => { count++; if (count < 4) { @@ -39,7 +39,7 @@ import { Observable, ObservablePool, Stream, Property, Event, Emitter } from 'ke emitter.end(); } }, 1000); - + return () => clearInterval(intervalId); }); } @@ -77,6 +77,7 @@ import { Observable, ObservablePool, Stream, Property, Event, Emitter } from 'ke let observable01: Stream = Kefir.sequentially(100, [1, 2, 3]).map(x => x + 1); let observable02: Stream = Kefir.sequentially(100, [1, 2, 3]).filter(x => x > 1); let observable03: Stream = Kefir.sequentially(100, [1, 2, 3]).take(2); + let observable29: Stream = Kefir.sequentially(100, [1, 2, 3]).takeErrors(2); let observable04: Stream = Kefir.sequentially(100, [1, 2, 3]).takeWhile(x => x < 3); let observable05: Stream = Kefir.sequentially(100, [1, 2, 3]).last(); let observable06: Stream = Kefir.sequentially(100, [1, 2, 3]).skip(2); @@ -103,14 +104,16 @@ import { Observable, ObservablePool, Stream, Property, Event, Emitter } from 'ke }).endOnError(); let observable22: Stream = Kefir.sequentially(100, [0, -1, 2, -3]).valuesToErrors(x => { return {convert: x < 0, error: x}; - }).skipValues(); + }).ignoreValues(); let observable23: Stream = Kefir.sequentially(100, [0, -1, 2, -3]).valuesToErrors(x => { return {convert: x < 0, error: x}; - }).skipErrors(); - let observable24: Stream = Kefir.sequentially(100, [1, 2, 3]).skipEnd(); + }).ignoreErrors(); + let observable24: Stream = Kefir.sequentially(100, [1, 2, 3]).ignoreEnd(); let ovservable25: Stream = Kefir.sequentially(100, [1, 2, 3]).beforeEnd(() => 0); let observable26: Stream = Kefir.sequentially(100, [1, 2, 3, 4, 5]).slidingWindow(3, 2) let observable27: Stream = Kefir.sequentially(100, [1, 2, 3, 4, 5]).bufferWhile(x => x !== 3); + let observable30: Stream = Kefir.sequentially(100, [1, 2, 3, 4, 5]).bufferWithCount(2); + let observable31: Stream = Kefir.sequentially(100, [1, 2, 3, 4, 5]).bufferWithTimeOrCount(330, 10); { var myTransducer: any; let observable28: Stream = Kefir.sequentially(100, [1, 2, 3, 4, 5, 6]).transduce(myTransducer); diff --git a/kefir/kefir.d.ts b/kefir/kefir.d.ts index 9e3303f01..a95b12a88 100644 --- a/kefir/kefir.d.ts +++ b/kefir/kefir.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Kefir 2.8.1 +// Type definitions for Kefir 3.2.0 // Project: http://rpominov.github.io/kefir/ // Definitions by: Aya Morisawa // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -6,7 +6,7 @@ /// declare module "kefir" { - + export interface Observable { // Subscribe / add side effects onValue(callback: (value: T) => void): void; @@ -19,12 +19,14 @@ declare module "kefir" { offAny(callback: (event: Event) => void): void; log(name?: string): void; offLog(name?: string): void; + flatten(transformer?: (value: T) => U[]): Stream; toPromise(PromiseConstructor?: any): any; + toESObservable(): any; } - + export interface Stream extends Observable { toProperty(getCurrent?: () => T): Property; - + // Modify an stream map(fn: (value: T) => U): Stream; filter(predicate?: (value: T) => boolean): Stream; @@ -36,24 +38,26 @@ declare module "kefir" { skipDuplicates(comparator?: (a: T, b: T) => boolean): Stream; diff(fn?: (prev: T, next: T) => T, seed?: T): Stream; scan(fn: (prev: T, next: T) => T, seed?: T): Stream; - flatten(transformer?: (value: T) => U[]): Stream; delay(wait: number): Stream; - throttle(wait: number, options?: {leading: boolean, trailing: boolean}): Stream; + throttle(wait: number, options?: {leading?: boolean, trailing?: boolean}): Stream; debounce(wait: number, options?: {immediate: boolean}): Stream; valuesToErrors(handler?: (value: T) => {convert: boolean, error: U}): Stream; errorsToValues(handler?: (error: S) => {convert: boolean, value: U}): Stream; mapErrors(fn: (error: S) => U): Stream; filterErrors(predicate?: (error: S) => boolean): Stream; endOnError(): Stream; - skipValues(): Stream; - skipErrors(): Stream; - skipEnd(): Stream; + takeErrors(n: number): Stream; + ignoreValues(): Stream; + ignoreErrors(): Stream; + ignoreEnd(): Stream; beforeEnd(fn: () => U): Stream; slidingWindow(max: number, mix?: number): Stream; bufferWhile(predicate: (value: T) => boolean): Stream; + bufferWithCount(count: number, options?: {flushOnEnd: boolean}): Stream; + bufferWithTimeOrCount(interval: number, count: number, options?: {flushOnEnd: boolean}): Stream; transduce(transducer: any): Stream; withHandler(handler: (emitter: Emitter, event: Event) => void): Stream; - + // Combine streams combine(otherObs: Stream, combinator?: (value: T, ...values: U[]) => W): Stream; zip(otherObs: Stream, combinator?: (value: T, ...values: U[]) => W): Stream; @@ -65,20 +69,20 @@ declare module "kefir" { flatMapConcat(fn: (value: T) => Stream): Stream; flatMapConcurLimit(fn: (value: T) => Stream, limit: number): Stream; flatMapErrors(transform: (error: S) => Stream): Stream; - + // Combine two streams filterBy(otherObs: Observable): Stream; sampledBy(otherObs: Observable, combinator?: (a: T, b: U) => W): Stream; skipUntilBy(otherObs: Observable): Stream; takeUntilBy(otherObs: Observable): Stream; bufferBy(otherObs: Observable, options?: {flushOnEnd: boolean}): Stream; - bufferWhileBy(otherObs: Observable): Stream; + bufferWhileBy(otherObs: Observable, options?: {flushOnEnd?: boolean, flushOnChange?: boolean}): Stream; awaiting(otherObs: Observable): Stream; } - + export interface Property extends Observable { changes(): Stream; - + // Modify an property map(fn: (value: T) => U): Property; filter(predicate?: (value: T) => boolean): Property; @@ -90,24 +94,26 @@ declare module "kefir" { skipDuplicates(comparator?: (a: T, b: T) => boolean): Property; diff(fn?: (prev: T, next: T) => T, seed?: T): Property; scan(fn: (prev: T, next: T) => T, seed?: T): Property; - flatten(transformer?: (value: T) => U[]): Property; delay(wait: number): Property; - throttle(wait: number, options?: {leading: boolean, trailing: boolean}): Property; + throttle(wait: number, options?: {leading?: boolean, trailing?: boolean}): Property; debounce(wait: number, options?: {immediate: boolean}): Property; valuesToErrors(handler?: (value: T) => {convert: boolean, error: U}): Property; errorsToValues(handler?: (error: S) => {convert: boolean, value: U}): Property; mapErrors(fn: (error: S) => U): Property; filterErrors(predicate?: (error: S) => boolean): Property; endOnError(): Property; - skipValues(): Property; - skipErrors(): Property; - skipEnd(): Property; + takeErrors(n: number): Stream; + ignoreValues(): Property; + ignoreErrors(): Property; + ignoreEnd(): Property; beforeEnd(fn: () => U): Property; slidingWindow(max: number, mix?: number): Property; bufferWhile(predicate: (value: T) => boolean): Property; + bufferWithCount(count: number, options?: {flushOnEnd: boolean}): Property; + bufferWithTimeOrCount(interval: number, count: number, options?: {flushOnEnd: boolean}): Property; transduce(transducer: any): Property; withHandler(handler: (emitter: Emitter, event: Event) => void): Property; - + // Combine properties combine(otherObs: Property, combinator?: (value: T, ...values: U[]) => W): Property; zip(otherObs: Property, combinator?: (value: T, ...values: U[]) => W): Property; @@ -119,35 +125,34 @@ declare module "kefir" { flatMapConcat(fn: (value: T) => Property): Property; flatMapConcurLimit(fn: (value: T) => Property, limit: number): Property; flatMapErrors(transform: (error: S) => Property): Property; - + // Combine two properties filterBy(otherObs: Observable): Property; sampledBy(otherObs: Observable, combinator?: (a: T, b: U) => W): Property; skipUntilBy(otherObs: Observable): Property; takeUntilBy(otherObs: Observable): Property; bufferBy(otherObs: Observable, options?: {flushOnEnd: boolean}): Property; - bufferWhileBy(otherObs: Observable): Property; + bufferWhileBy(otherObs: Observable, options?: {flushOnEnd?: boolean, flushOnChange?: boolean}): Property; awaiting(otherObs: Observable): Property; } - + export interface ObservablePool extends Observable { plug(obs: Observable): void; unPlug(obs: Observable): void; } - + export interface Event { type: string; value: T; - current: boolean; } - + export interface Emitter { emit(value: T): void; error(error: S): void; end(): void; emitEvent(event: {type: string, value: T | S}): void; } - + // Create a stream export function never(): Stream; export function later(wait: number, value: T): Stream; @@ -159,12 +164,13 @@ declare module "kefir" { export function fromNodeCallback(fn: (callback: (error: S, result: T) => void) => void): Stream; export function fromEvents(target: EventTarget | NodeJS.EventEmitter | { on: Function, off: Function }, eventName: string, transform?: (value: T) => S): Stream; export function stream(subscribe: (emitter: Emitter) => Function | void): Stream; - + export function fromESObservable(observable: any): Stream + // Create a property export function constant(value: T): Property; export function constantError(error: T): Property; export function fromPromise(promise: any): Property; - + // Combine observables export function combine(obss: Observable[], passiveObss: Observable[], combinator?: (...values: T[]) => U): Observable; export function combine(obss: Observable[], combinator?: (...values: T[]) => U): Observable; diff --git a/kii-cloud-sdk/kii-cloud-sdk-tests.ts b/kii-cloud-sdk/kii-cloud-sdk-tests.ts index f92642538..ed5bb2966 100644 --- a/kii-cloud-sdk/kii-cloud-sdk-tests.ts +++ b/kii-cloud-sdk/kii-cloud-sdk-tests.ts @@ -46,4 +46,15 @@ function main() { object.set("foo", 1); object.save(); + + KiiGroup.registerGroupWithID("Group ID", "Group Name", [user], { + success: function(theSavedGroup: KiiGroup) { + theSavedGroup.saveWithOwner("user ID"); + }, + failure: function(theGroup: KiiGroup, + anErrorString: String, + addMembersArray: KiiUser[], + removeMembersArray: KiiUser[]) { + } + }); } diff --git a/kii-cloud-sdk/kii-cloud-sdk.d.ts b/kii-cloud-sdk/kii-cloud-sdk.d.ts index 57c8f50b1..6f14d47bb 100644 --- a/kii-cloud-sdk/kii-cloud-sdk.d.ts +++ b/kii-cloud-sdk/kii-cloud-sdk.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Kii Cloud SDK v2.3.0 +// Type definitions for Kii Cloud SDK v2.4.0 // Project: http://en.kii.com/ // Definitions by: Kii Consortium // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -83,6 +83,11 @@ declare module KiiCloud { */ _lot?: string; + /** + * product name given by thing vendor. + */ + _productName?: string; + /** * arbitrary string field. */ @@ -1028,6 +1033,65 @@ declare module KiiCloud { */ groupWithID(group: string): KiiGroup; + /** + * Register new group own by specified user on Kii Cloud with specified ID. + * This method can be used only by app admin. + * + *

        If the group that has specified id already exists, registration will be failed. + * + * @param groupID ID of the KiiGroup + * @param groupName Name of the KiiGroup + * @param user id of owner + * @param members An array of KiiUser objects to add to the group + * @param callbacks + * + * @return return promise object. + *
          + *
        • fulfill callback function: function(theSavedGroup). theSavedGroup is KiiGroup instance.
        • + *
        • reject callback function: function(error). error is an Error instance. + *
            + *
          • error.target is the KiiGroup instance which this method was called on.
          • + *
          • error.message
          • + *
          • error.addMembersArray is array of KiiUser to be added as memebers of this group.
          • + *
          • error.removeMembersArray is array of KiiUser to be removed from the memebers list of this group.
          • + *
          + *
        • + *
        + * + * @example + * // example to use callbacks directly + * Kii.authenticateAsAppAdmin("client-id", "client-secret", { + * success: function(adminContext) { + * var members = []; + * members.push(KiiUser.userWithID("Member User Id")); + * adminContext.registerGroupWithOwnerAndID("Group ID", "Group Name", "Owner User ID", members, { + * success: function(theSavedGroup) { + * // do something with the saved group + * }, + * failure: function(theGroup, anErrorString, addMembersArray, removeMembersArray) { + * // do something with the error response + * } + * }); + * }, + * failure: function(errorString, errorCode) { + * // auth failed. + * } + * }); + * // example to use Promise + * Kii.authenticateAsAppAdmin("client-id", "client-secret").then( + * function(adminContext) { + * var members = []; + * members.push(KiiUser.userWithID("Member User Id")); + * return adminContext.registerGroupWithOwnerAndID("Group ID", "Group Name", "Owner User ID", members); + * } + * ).then( + * function(group) { + * // do something with the saved group + * } + * ); + */ + registerGroupWithOwnerAndID(groupID: string, groupName: string, user: string, members: KiiUser[], callbacks?: { success(adminContext: KiiAppAdminContext): any; failure(theGroup: KiiGroup, anErrorString: string, addMembersArray: KiiUser[], removeMembersArray: KiiUser[]): any; }): Promise; + /** * Creates a reference to a group operated by app admin using group's URI. *

        @@ -1362,7 +1426,7 @@ declare module KiiCloud { * Register user/group as owner of specified thing by app admin. * * @param thingID The ID of thing - * @param owner to be registered as owner. + * @param owner instnce of KiiUser/KiiGroup to be registered as owner. * @param callbacks object holds callback functions. * * @return return promise object. @@ -1415,7 +1479,7 @@ declare module KiiCloud { * Register user/group as owner of specified thing by app admin. * * @param vendorThingID The vendor thing ID of thing - * @param owner to be registered as owner. + * @param owner instance of KiiUser/KiiGroupd to be registered as owner. * @param callbacks object holds callback functions. * * @return return promise object. @@ -2205,6 +2269,58 @@ declare module KiiCloud { */ objectURI(): string; + /** + * Register new group own by current user on Kii Cloud with specified ID. + * + *

        If the group that has specified id already exists, registration will be failed. + * + * @param groupID ID of the KiiGroup + * @param groupName Name of the KiiGroup + * @param members An array of KiiUser objects to add to the group + * @param callbacks An object with callback methods defined + * + * @return return promise object. + *
          + *
        • fulfill callback function: function(theSavedGroup). theSavedGroup is KiiGroup instance.
        • + *
        • reject callback function: function(error). error is an Error instance. + *
            + *
          • error.target is the KiiGroup instance which this method was called on.
          • + *
          • error.message
          • + *
          • error.addMembersArray is array of KiiUser to be added as memebers of this group.
          • + *
          • error.removeMembersArray is array of KiiUser to be removed from the memebers list of this group.
          • + *
          + *
        • + *
        + * + * @example + * // example to use callbacks directly + * var members = []; + * members.push(KiiUser.userWithID("Member User Id")); + * KiiGroup.registerGroupWithID("Group ID", "Group Name", members, { + * success: function(theSavedGroup) { + * // do something with the saved group + * }, + * failure: function(theGroup, anErrorString, addMembersArray, removeMembersArray) { + * // do something with the error response + * } + * }); + * + * // example to use Promise + * var members = []; + * members.push(KiiUser.userWithID("Member User Id")); + * KiiGroup.registerGroupWithID("Group ID", "Group Name", members).then( + * function(theSavedGroup) { + * // do something with the saved group + * }, + * function(error) { + * var theGroup = error.target; + * var anErrorString = error.message; + * var addMembersArray = error.addMembersArray; + * // do something with the error response + * }); + */ + static registerGroupWithID(groupID: string, groupName: string, members: KiiUser[], callbacks?: { success(theSavedGroup: KiiGroup): any; failure(theGroup: KiiGroup, anErrorString: string, addMembersArray: KiiUser[], removeMembersArray: KiiUser[]): any; }): Promise; + /** * Creates a reference to a bucket for this group * @@ -2420,6 +2536,65 @@ declare module KiiCloud { */ save(callbacks?: { success(theSavedGroup: KiiGroup): any; failure(theGroup: KiiGroup, anErrorString: string, addMembersArray: KiiUser[], removeMembersArray: KiiUser[]): any; }): Promise; + /** + * Saves the latest group values to the server with specified owner. + * This method can be used only by the group owner or app admin. + * + *

        If the group does not yet exist, it will be created. If the group already exists, the members and owner that have changed will be updated accordingly. If the group already exists and there is no updates of members and owner, it will allways succeed but does not execute update. To change the name of group, use {@link #changeGroupName}. + * + * @param user id of owner + * @param callbacks An object with callback methods defined + * + * @return return promise object. + *
          + *
        • fulfill callback function: function(theSavedGroup). theSavedGroup is KiiGroup instance.
        • + *
        • reject callback function: function(error). error is an Error instance. + *
            + *
          • error.target is the KiiGroup instance which this method was called on.
          • + *
          • error.message
          • + *
          • error.addMembersArray is array of KiiUser to be added as memebers of this group.
          • + *
          • error.removeMembersArray is array of KiiUser to be removed from the memebers list of this group.
          • + *
          + *
        • + *
        + * + * @example + * // example to use callbacks directly + * var group = . . .; // a KiiGroup + * group.saveWithOwner("UserID of owner", { + * success: function(theSavedGroup) { + * // do something with the saved group + * }, + * + * failure: function(theGroup, anErrorString, addMembersArray, removeMembersArray) { + * // do something with the error response + * } + * }); + * + * // example to use Promise + * var group = . . .; // a KiiGroup + * group.saveWithOwner("UserID of owner", { + * success: function(theSavedGroup) { + * // do something with the saved group + * }, + * + * failure: function(theGroup, anErrorString, addMembersArray, removeMembersArray) { + * // do something with the error response + * } + * }).then( + * function(theSavedGroup) { + * // do something with the saved group + * }, + * function(error) { + * var theGroup = error.target; + * var anErrorString = error.message; + * var addMembersArray = error.addMembersArray; + * var removeMembersArray = error.removeMembersArray; + * // do something with the error response + * }); + */ + saveWithOwner(user: string, callbacks?: { success(theSavedGroup: KiiGroup): any; failure(theGroup: KiiGroup, anErrorString: string, addMembersArray: KiiUser[], removeMembersArray: KiiUser[]): any; }): Promise; + /** * Updates the local group's data with the group data on the server * @@ -2735,14 +2910,14 @@ declare module KiiCloud { /** * Get the application-defined type name of the object * - * @return + * @return type of this object. null or undefined if none exists */ getObjectType(): string; /** * Get the body content-type. * It will be updated after the success of {@link KiiObject#uploadBody} and {@link KiiObject#downloadBody} - * returns null when this object doesn't have body content-type information. + * returns null or undefined when this object doesn't have body content-type information. * * @return content-type of object body */ @@ -2751,15 +2926,18 @@ declare module KiiCloud { /** * Sets a key/value pair to a KiiObject * - *

        If the key already exists, its value will be written over. If the object is of invalid type, it will return false and a KiiError will be thrown (quietly). Accepted types are any JSON-encodable objects. + *

        If the key already exists, its value will be written over. *
        NOTE: Before involving floating point value, please consider using integer instead. For example, use percentage, permil, ppm, etc.
        * The reason is: *
      • Will dramatically improve the performance of bucket query.
      • *
      • Bucket query does not support the mixed result of integer and floating point. * ex.) If you use same key for integer and floating point and inquire object with the integer value, objects which has floating point value with the key would not be evaluated in the query. (and vice versa)
      • * - * @param key The key to set. The key must not be a system key (created, metadata, modified, type, uuid) or begin with an underscore (_) - * @param value The value to be set. Object must be of a JSON-encodable type (Ex: dictionary, array, string, number, etc) + * @param key The key to set. + * if null, empty string or string prefixed with '_' is specified, silently ignored and have no effect. + * We don't check if actual type is String or not. If non-string type is specified, it will be encoded as key by JSON.stringify() + * @param value The value to be set. Object must be JSON-encodable type (dictionary, array, string, number, boolean) + * We don't check actual type of the value. It will be encoded as value by JSON.stringify() * * @example * var obj = . . .; // a KiiObject @@ -2772,7 +2950,7 @@ declare module KiiCloud { * * @param key The key to retrieve * - * @return The object associated with the key. null if none exists + * @return The object associated with the key. null or undefined if none exists * * @example * var obj = . . .; // a KiiObject @@ -4665,6 +4843,11 @@ declare module KiiCloud { * '_thingID', '_created', '_accessToken'
        * Following properties are readonly after creation and will be ignored on {@link #update} of thing.
        * '_vendorThingID', '_password'
        + * As Property prefixed with '_' is reserved by Kii Cloud, + * properties other than ones described in the parameter secion + * and '_layoutPosition' are ignored on creation/{@link #update} of thing.
        + * Those ignored properties won't be removed from fields object passed as argument. + * However it won't be reflected to fields object property of created/updated Thing. * * @param fields of the thing to be registered. * @param callbacks object holds callback functions. @@ -5007,7 +5190,7 @@ declare module KiiCloud { * API is authorized by app admin.
        * * @param thingID The ID of thing - * @param owner to be registered as owner. + * @param owner instance of KiiUser/KiiGroup to be registered as owner. * @param callbacks object holds callback functions. * * @return return promise object. @@ -5059,7 +5242,7 @@ declare module KiiCloud { * API is authorized by app admin.
        * * @param vendorThingID The vendor thing ID of thing - * @param owner to be registered as owner. + * @param owner instance of KiiUser/KiiGroup to be registered as owner. * @param callbacks object holds callback functions. * * @return return promise object. @@ -5850,7 +6033,7 @@ declare module KiiCloud { * * @param key The key to retrieve * - * @return The object associated with the key. null if none exists + * @return The object associated with the key. null or undefined if none exists * * @example * var user = . . .; // a KiiUser diff --git a/knockout/tests/jasmine.extensions.d.ts b/knockout/tests/jasmine.extensions.d.ts new file mode 100644 index 000000000..c3b12213f --- /dev/null +++ b/knockout/tests/jasmine.extensions.d.ts @@ -0,0 +1,10 @@ +// Knockout specs depend on custom Jasmine matchers +// See https://github.com/knockout/knockout/blob/v3.4.0/spec/lib/jasmine.extensions.js +// FYI jasmine-jquery.d.ts (https://github.com/velesin/jasmine-jquery) also defines toContainHtml() and toContainText() + +declare module jasmine { + interface Matchers { + toContainHtml(expected: string): boolean; + toContainText(expected: string): boolean; + } +} diff --git a/knockout/tests/knockout-templatingBehaviors-tests.ts b/knockout/tests/knockout-templatingBehaviors-tests.ts index 50ec27572..cd86465b2 100644 --- a/knockout/tests/knockout-templatingBehaviors-tests.ts +++ b/knockout/tests/knockout-templatingBehaviors-tests.ts @@ -1,4 +1,5 @@ /// +/// /// /// diff --git a/leaflet.fullscreen/leaflet.fullscreen-tests.ts b/leaflet.fullscreen/leaflet.fullscreen-tests.ts new file mode 100644 index 000000000..d74a19dcb --- /dev/null +++ b/leaflet.fullscreen/leaflet.fullscreen-tests.ts @@ -0,0 +1,23 @@ +/// + +var map: L.Map; + +// Defaults +var icon: L.Control.Fullscreen = L.control.fullscreen({ + position: 'topleft', + title: 'Full Screen', + titleCancel: 'Exit Full Screen', + forceSeparateButton: false, + forcePseudoFullscreen: false +}); + +icon.addTo(map); + + +// My Usage + +L.control.fullscreen({ + position: 'topleft', + content: '', + forceSeparateButton: true, +}).addTo(map); diff --git a/leaflet.fullscreen/leaflet.fullscreen.d.ts b/leaflet.fullscreen/leaflet.fullscreen.d.ts new file mode 100644 index 000000000..864817f22 --- /dev/null +++ b/leaflet.fullscreen/leaflet.fullscreen.d.ts @@ -0,0 +1,32 @@ +// Type definitions for Leaflet.fullscreen v1.3.0 +// Project: https://github.com/brunob/leaflet.fullscreen +// Definitions by: William Comartin +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module L { + + namespace Control { + + export interface Fullscreen extends L.Control {} + + export interface FullscreenOptions { + content?: string, + position?: string, + title?: string, + titleCancel?: string, + forceSeparateButton?: boolean, + forcePseudoFullscreen?: boolean + } + } + + namespace control { + + /** + * Creates a fullscreen control. + */ + export function fullscreen(options?: Control.FullscreenOptions): L.Control.Fullscreen; + + } +} diff --git a/lime-js/lime-js-tests.ts b/lime-js/lime-js-tests.ts new file mode 100644 index 000000000..aa73444b1 --- /dev/null +++ b/lime-js/lime-js-tests.ts @@ -0,0 +1,35 @@ +/// + +var transport = new Lime.WebSocketTransport(true); +var clientChannel = new Lime.ClientChannel(transport, true, true); + +clientChannel.onMessage = (m) => { + // message received callback +}; +clientChannel.onNotification = (n) => { + // notification received callback +}; +clientChannel.onCommand = (c) => { + // command received callback +}; + +transport.onOpen = () => { + var authentication: Lime.Authentication = new Lime.GuestAuthentication(); + Lime.ClientChannelExtensions.establishSession(clientChannel, "none", "none", "test@msging.net", authentication, "test", (err, session) => { + var message: Lime.Message = { + id: "123", + to: "someone@test.net", + type: "text/plain", + content: "Hello, world!" + }; + clientChannel.sendMessage(message); + }); +}; +transport.onClose = () => { + // transport closed callback +}; +transport.onError = (err) => { + // transport error callback +}; + +transport.open("ws://test.net"); diff --git a/lime-js/lime-js.d.ts b/lime-js/lime-js.d.ts new file mode 100644 index 000000000..7e26733d3 --- /dev/null +++ b/lime-js/lime-js.d.ts @@ -0,0 +1,200 @@ +// Type definitions for lime-js 0.0.3 +// Project: https://github.com/takenet/lime-js +// Definitions by: Arthur Xavier +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare namespace Lime { + + interface Envelope { + id?: string; + from?: string; + to?: string; + pp?: string; + metadata?: any; + } + interface Reason { + code: number; + description?: string; + } + + interface Message extends Envelope { + type: string; + content: any; + } + + interface Notification extends Envelope { + event: string; + reason?: Reason; + } + class NotificationEvent { + static accepted: string; + static validated: string; + static authorized: string; + static dispatched: string; + static received: string; + static consumed: string; + } + + interface Command extends Envelope { + uri?: string; + type?: string; + resource?: any; + method: string; + status?: string; + reason?: Reason; + } + class CommandMethod { + static get: string; + static set: string; + static delete: string; + static observe: string; + static subscribe: string; + } + class CommandStatus { + static success: string; + static failure: string; + } + + interface Session extends Envelope { + state: string; + encryptionOptions?: string[]; + encryption?: string; + compressionOptions?: string[]; + compression?: string; + scheme?: string; + authentication?: any; + reason?: Reason; + } + class SessionState { + static new: string; + static negotiating: string; + static authenticating: string; + static established: string; + static finishing: string; + static finished: string; + static failed: string; + } + class SessionEncryption { + static none: string; + static tls: string; + } + class SessionCompression { + static none: string; + static gzip: string; + } + + class Authentication { + scheme: string; + static guest: string; + static plain: string; + static transport: string; + static key: string; + } + class GuestAuthentication extends Authentication { + scheme: string; + } + class TransportAuthentication extends Authentication { + scheme: string; + } + class PlainAuthentication extends Authentication { + scheme: string; + password: string; + } + class KeyAuthentication extends Authentication { + scheme: string; + key: string; + } + + class Channel { + constructor(transport: Transport, autoReplyPings: boolean, autoNotifyReceipt: boolean); + sendMessage(message: Message): void; + onMessage(message: Message): void; + sendCommand(command: Command): void; + onCommand(command: Command): void; + sendNotification(notification: Notification): void; + onNotification(notification: Notification): void; + sendSession(session: Session): void; + onSession(session: Session): void; + transport: Transport; + remoteNode: string; + localNode: string; + sessionId: string; + state: string; + } + + class ClientChannel extends Channel { + constructor(transport: Transport, autoReplyPings?: boolean, autoNotifyReceipt?: boolean); + startNewSession(): void; + negotiateSession(sessionCompression: string, sessionEncryption: string): void; + authenticateSession(identity: string, authentication: Authentication, instance: string): void; + sendFinishingSession(): void; + onSessionNegotiating(session: Session): void; + onSessionAuthenticating(session: Session): void; + onSessionEstablished(session: Session): void; + onSessionFinished(session: Session): void; + onSessionFailed(session: Session): void; + } + + class ClientChannelExtensions { + static establishSession(clientChannel: ClientChannel, compression: string, encryption: string, identity: string, authentication: Authentication, instance: string, callback: (error: Error, session: Session) => any): void; + } + + interface IMessageChannel { + sendMessage(message: Message): void; + onMessage: (message: Message) => any; + } + interface ICommandChannel { + sendCommand(command: Command): void; + onCommand: (command: Command) => any; + } + interface INotificationChannel { + sendNotification(notification: Notification): void; + onNotification: (notification: Notification) => any; + } + interface ISessionChannel { + sendSession(session: Session): void; + onSession: (session: Session) => any; + } + interface ISessionListener { + (session: Session): void; + } + + interface Transport extends ITransportStateListener { + send(envelope: Envelope): void; + onEnvelope: (envelope: Envelope) => any; + open(uri: string): void; + close(): void; + getSupportedCompression(): string[]; + setCompression(compression: string): void; + compression: string; + getSupportedEncryption(): string[]; + setEncryption(encryption: string): void; + encryption: string; + } + interface ITransportEnvelopeListener { + (envelope: Envelope): void; + } + interface ITransportStateListener { + onOpen: () => void; + onClose: () => void; + onError: (error: string) => void; + } + + class WebSocketTransport implements Transport { + webSocket: WebSocket; + constructor(traceEnabled?: boolean); + send(envelope: Envelope): void; + onEnvelope(envelope: Envelope): void; + open(uri: string): void; + close(): void; + getSupportedCompression(): string[]; + setCompression(compression: string): void; + compression: string; + getSupportedEncryption(): string[]; + setEncryption(encryption: string): void; + encryption: string; + onOpen(): void; + onClose(): void; + onError(error: string): void; + } +} diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index d661839d5..77a20e2e2 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1671,37 +1671,329 @@ module TestUnion { } } -result = _.uniq([1, 2, 1, 3, 1]); -result = _.uniq([1, 1, 2, 2, 3], true); -result = _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function (letter) { - return letter.toLowerCase(); -}); -result = _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function (num) { return this.floor(num); }, Math); -result = <{ x: number; }[]>_.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); +// _.uniq +module TestUniq { + type SampleObject = {a: number; b: string; c: boolean}; -result = _.unique([1, 2, 1, 3, 1]); -result = _.unique([1, 1, 2, 2, 3], true); -result = _.unique(['A', 'b', 'C', 'a', 'B', 'c'], function (letter) { - return letter.toLowerCase(); -}); -result = _.unique([1, 2.5, 3, 1.5, 2, 3.5], function (num) { return this.floor(num); }, Math); -result = <{ x: number; }[]>_.unique([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + let array: SampleObject[]; + let list: _.List; -result = _([1, 2, 1, 3, 1]).uniq().value(); -result = _([1, 1, 2, 2, 3]).uniq(true).value(); -result = _(['A', 'b', 'C', 'a', 'B', 'c']).uniq(function (letter) { - return letter.toLowerCase(); -}).value(); -result = _([1, 2.5, 3, 1.5, 2, 3.5]).uniq(function (num) { return this.floor(num); }, Math).value(); -result = <{ x: number; }[]>_([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }]).uniq('x').value(); + let stringIterator: (value: string, index: number, collection: string) => string; + let listIterator: (value: SampleObject, index: number, collection: _.List) => number; -result = _([1, 2, 1, 3, 1]).unique().value(); -result = _([1, 1, 2, 2, 3]).unique(true).value(); -result = _(['A', 'b', 'C', 'a', 'B', 'c']).unique(function (letter) { - return letter.toLowerCase(); -}).value(); -result = _([1, 2.5, 3, 1.5, 2, 3.5]).unique(function (num) { return this.floor(num); }, Math).value(); -result = <{ x: number; }[]>_([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }]).unique('x').value(); + { + let result: string[]; + + result = _.uniq('abc'); + result = _.uniq('abc', true); + result = _.uniq('abc', true, stringIterator); + result = _.uniq('abc', true, stringIterator, any); + result = _.uniq('abc', true, stringIterator); + result = _.uniq('abc', true, stringIterator, any); + result = _.uniq('abc', stringIterator); + result = _.uniq('abc', stringIterator, any); + result = _.uniq('abc', stringIterator); + result = _.uniq('abc', stringIterator, any); + } + + { + let result: SampleObject[]; + + result = _.uniq(array); + result = _.uniq(array, true); + result = _.uniq(array, true, listIterator); + result = _.uniq(array, true, listIterator, any); + result = _.uniq(array, true, listIterator); + result = _.uniq(array, true, listIterator, any); + result = _.uniq(array, listIterator); + result = _.uniq(array, listIterator, any); + result = _.uniq(array, listIterator); + result = _.uniq(array, listIterator, any); + result = _.uniq(array, true, 'a'); + result = _.uniq(array, true, 'a', any); + result = _.uniq(array, 'a'); + result = _.uniq(array, 'a', any); + result = _.uniq(array, true, {a: 42}); + result = _.uniq<{a: number}, SampleObject>(array, true, {a: 42}); + result = _.uniq(array, {a: 42}); + result = _.uniq<{a: number}, SampleObject>(array, {a: 42}); + + result = _.uniq(list); + result = _.uniq(list, true); + result = _.uniq(list, true, listIterator); + result = _.uniq(list, true, listIterator, any); + result = _.uniq(list, true, listIterator); + result = _.uniq(list, true, listIterator, any); + result = _.uniq(list, listIterator); + result = _.uniq(list, listIterator, any); + result = _.uniq(list, listIterator); + result = _.uniq(list, listIterator, any); + result = _.uniq(list, true, 'a'); + result = _.uniq(list, true, 'a', any); + result = _.uniq(list, 'a'); + result = _.uniq(list, 'a', any); + result = _.uniq(list, true, {a: 42}); + result = _.uniq<{a: number}, SampleObject>(list, true, {a: 42}); + result = _.uniq(list, {a: 42}); + result = _.uniq<{a: number}, SampleObject>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').uniq(); + result = _('abc').uniq(true); + result = _('abc').uniq(true, stringIterator); + result = _('abc').uniq(true, stringIterator, any); + result = _('abc').uniq(stringIterator); + result = _('abc').uniq(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).uniq(); + result = _(array).uniq(true); + result = _(array).uniq(true, listIterator); + result = _(array).uniq(true, listIterator, any); + result = _(array).uniq(listIterator); + result = _(array).uniq(listIterator, any); + result = _(array).uniq(true, 'a'); + result = _(array).uniq(true, 'a', any); + result = _(array).uniq('a'); + result = _(array).uniq('a', any); + result = _(array).uniq<{a: number}>(true, {a: 42}); + result = _(array).uniq<{a: number}>({a: 42}); + + result = _(list).uniq(); + result = _(list).uniq(true); + result = _(list).uniq(true, listIterator); + result = _(list).uniq(true, listIterator, any); + result = _(list).uniq(true, listIterator); + result = _(list).uniq(true, listIterator, any); + result = _(list).uniq(listIterator); + result = _(list).uniq(listIterator, any); + result = _(list).uniq(listIterator); + result = _(list).uniq(listIterator, any); + result = _(list).uniq(true, 'a'); + result = _(list).uniq(true, 'a', any); + result = _(list).uniq('a'); + result = _(list).uniq('a', any); + result = _(list).uniq(true, {a: 42}); + result = _(list).uniq<{a: number}, SampleObject>(true, {a: 42}); + result = _(list).uniq({a: 42}); + result = _(list).uniq<{a: number}, SampleObject>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().uniq(); + result = _('abc').chain().uniq(true); + result = _('abc').chain().uniq(true, stringIterator); + result = _('abc').chain().uniq(true, stringIterator, any); + result = _('abc').chain().uniq(stringIterator); + result = _('abc').chain().uniq(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().uniq(); + result = _(array).chain().uniq(true); + result = _(array).chain().uniq(true, listIterator); + result = _(array).chain().uniq(true, listIterator, any); + result = _(array).chain().uniq(listIterator); + result = _(array).chain().uniq(listIterator, any); + result = _(array).chain().uniq(true, 'a'); + result = _(array).chain().uniq(true, 'a', any); + result = _(array).chain().uniq('a'); + result = _(array).chain().uniq('a', any); + result = _(array).chain().uniq<{a: number}>(true, {a: 42}); + result = _(array).chain().uniq<{a: number}>({a: 42}); + + result = _(list).chain().uniq(); + result = _(list).chain().uniq(true); + result = _(list).chain().uniq(true, listIterator); + result = _(list).chain().uniq(true, listIterator, any); + result = _(list).chain().uniq(true, listIterator); + result = _(list).chain().uniq(true, listIterator, any); + result = _(list).chain().uniq(listIterator); + result = _(list).chain().uniq(listIterator, any); + result = _(list).chain().uniq(listIterator); + result = _(list).chain().uniq(listIterator, any); + result = _(list).chain().uniq(true, 'a'); + result = _(list).chain().uniq(true, 'a', any); + result = _(list).chain().uniq('a'); + result = _(list).chain().uniq('a', any); + result = _(list).chain().uniq(true, {a: 42}); + result = _(list).chain().uniq<{a: number}, SampleObject>(true, {a: 42}); + result = _(list).chain().uniq({a: 42}); + result = _(list).chain().uniq<{a: number}, SampleObject>({a: 42}); + } +} + +// _.unique +module TestUnique { + type SampleObject = {a: number; b: string; c: boolean}; + + let array: SampleObject[]; + let list: _.List; + + let stringIterator: (value: string, index: number, collection: string) => string; + let listIterator: (value: SampleObject, index: number, collection: _.List) => number; + + { + let result: string[]; + + result = _.unique('abc'); + result = _.unique('abc', true); + result = _.unique('abc', true, stringIterator); + result = _.unique('abc', true, stringIterator, any); + result = _.unique('abc', true, stringIterator); + result = _.unique('abc', true, stringIterator, any); + result = _.unique('abc', stringIterator); + result = _.unique('abc', stringIterator, any); + result = _.unique('abc', stringIterator); + result = _.unique('abc', stringIterator, any); + } + + { + let result: SampleObject[]; + + result = _.unique(array); + result = _.unique(array, true); + result = _.unique(array, true, listIterator); + result = _.unique(array, true, listIterator, any); + result = _.unique(array, true, listIterator); + result = _.unique(array, true, listIterator, any); + result = _.unique(array, listIterator); + result = _.unique(array, listIterator, any); + result = _.unique(array, listIterator); + result = _.unique(array, listIterator, any); + result = _.unique(array, true, 'a'); + result = _.unique(array, true, 'a', any); + result = _.unique(array, 'a'); + result = _.unique(array, 'a', any); + result = _.unique(array, true, {a: 42}); + result = _.unique<{a: number}, SampleObject>(array, true, {a: 42}); + result = _.unique(array, {a: 42}); + result = _.unique<{a: number}, SampleObject>(array, {a: 42}); + + result = _.unique(list); + result = _.unique(list, true); + result = _.unique(list, true, listIterator); + result = _.unique(list, true, listIterator, any); + result = _.unique(list, true, listIterator); + result = _.unique(list, true, listIterator, any); + result = _.unique(list, listIterator); + result = _.unique(list, listIterator, any); + result = _.unique(list, listIterator); + result = _.unique(list, listIterator, any); + result = _.unique(list, true, 'a'); + result = _.unique(list, true, 'a', any); + result = _.unique(list, 'a'); + result = _.unique(list, 'a', any); + result = _.unique(list, true, {a: 42}); + result = _.unique<{a: number}, SampleObject>(list, true, {a: 42}); + result = _.unique(list, {a: 42}); + result = _.unique<{a: number}, SampleObject>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').unique(); + result = _('abc').unique(true); + result = _('abc').unique(true, stringIterator); + result = _('abc').unique(true, stringIterator, any); + result = _('abc').unique(stringIterator); + result = _('abc').unique(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).unique(); + result = _(array).unique(true); + result = _(array).unique(true, listIterator); + result = _(array).unique(true, listIterator, any); + result = _(array).unique(listIterator); + result = _(array).unique(listIterator, any); + result = _(array).unique(true, 'a'); + result = _(array).unique(true, 'a', any); + result = _(array).unique('a'); + result = _(array).unique('a', any); + result = _(array).unique<{a: number}>(true, {a: 42}); + result = _(array).unique<{a: number}>({a: 42}); + + result = _(list).unique(); + result = _(list).unique(true); + result = _(list).unique(true, listIterator); + result = _(list).unique(true, listIterator, any); + result = _(list).unique(true, listIterator); + result = _(list).unique(true, listIterator, any); + result = _(list).unique(listIterator); + result = _(list).unique(listIterator, any); + result = _(list).unique(listIterator); + result = _(list).unique(listIterator, any); + result = _(list).unique(true, 'a'); + result = _(list).unique(true, 'a', any); + result = _(list).unique('a'); + result = _(list).unique('a', any); + result = _(list).unique(true, {a: 42}); + result = _(list).unique<{a: number}, SampleObject>(true, {a: 42}); + result = _(list).unique({a: 42}); + result = _(list).unique<{a: number}, SampleObject>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().unique(); + result = _('abc').chain().unique(true); + result = _('abc').chain().unique(true, stringIterator); + result = _('abc').chain().unique(true, stringIterator, any); + result = _('abc').chain().unique(stringIterator); + result = _('abc').chain().unique(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().unique(); + result = _(array).chain().unique(true); + result = _(array).chain().unique(true, listIterator); + result = _(array).chain().unique(true, listIterator, any); + result = _(array).chain().unique(listIterator); + result = _(array).chain().unique(listIterator, any); + result = _(array).chain().unique(true, 'a'); + result = _(array).chain().unique(true, 'a', any); + result = _(array).chain().unique('a'); + result = _(array).chain().unique('a', any); + result = _(array).chain().unique<{a: number}>(true, {a: 42}); + result = _(array).chain().unique<{a: number}>({a: 42}); + + result = _(list).chain().unique(); + result = _(list).chain().unique(true); + result = _(list).chain().unique(true, listIterator); + result = _(list).chain().unique(true, listIterator, any); + result = _(list).chain().unique(true, listIterator); + result = _(list).chain().unique(true, listIterator, any); + result = _(list).chain().unique(listIterator); + result = _(list).chain().unique(listIterator, any); + result = _(list).chain().unique(listIterator); + result = _(list).chain().unique(listIterator, any); + result = _(list).chain().unique(true, 'a'); + result = _(list).chain().unique(true, 'a', any); + result = _(list).chain().unique('a'); + result = _(list).chain().unique('a', any); + result = _(list).chain().unique(true, {a: 42}); + result = _(list).chain().unique<{a: number}, SampleObject>(true, {a: 42}); + result = _(list).chain().unique({a: 42}); + result = _(list).chain().unique<{a: number}, SampleObject>({a: 42}); + } +} // _.upzip module TestUnzip { @@ -2694,9 +2986,11 @@ module TestAny { let array: TResult[]; let list: _.List; let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; let listIterator: (value: TResult, index: number, collection: _.List) => boolean; let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; + let numericDictionaryIterator: (value: TResult, key: number, collection: _.NumericDictionary) => boolean; { let result: boolean; @@ -2719,6 +3013,12 @@ module TestAny { result = _.any(dictionary, ''); result = _.any<{a: number}, TResult>(dictionary, {a: 42}); + result = _.any(numericDictionary); + result = _.any(numericDictionary, numericDictionaryIterator); + result = _.any(numericDictionary, numericDictionaryIterator, any); + result = _.any(numericDictionary, ''); + result = _.any<{a: number}, TResult>(numericDictionary, {a: 42}); + result = _(array).any(); result = _(array).any(listIterator); result = _(array).any(listIterator, any); @@ -2736,6 +3036,12 @@ module TestAny { result = _(dictionary).any(dictionaryIterator, any); result = _(dictionary).any(''); result = _(dictionary).any<{a: number}>({a: 42}); + + result = _(numericDictionary).any(); + result = _(numericDictionary).any(numericDictionaryIterator); + result = _(numericDictionary).any(numericDictionaryIterator, any); + result = _(numericDictionary).any(''); + result = _(numericDictionary).any<{a: number}>({a: 42}); } { @@ -2758,6 +3064,12 @@ module TestAny { result = _(dictionary).chain().any(dictionaryIterator, any); result = _(dictionary).chain().any(''); result = _(dictionary).chain().any<{a: number}>({a: 42}); + + result = _(numericDictionary).chain().any(); + result = _(numericDictionary).chain().any(numericDictionaryIterator); + result = _(numericDictionary).chain().any(numericDictionaryIterator, any); + result = _(numericDictionary).chain().any(''); + result = _(numericDictionary).chain().any<{a: number}>({a: 42}); } } @@ -4378,9 +4690,11 @@ module TestSome { let array: TResult[]; let list: _.List; let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; let listIterator: (value: TResult, index: number, collection: _.List) => boolean; let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; + let numericDictionaryIterator: (value: TResult, key: number, collection: _.NumericDictionary) => boolean; { let result: boolean; @@ -4403,6 +4717,12 @@ module TestSome { result = _.some(dictionary, ''); result = _.some<{a: number}, TResult>(dictionary, {a: 42}); + result = _.some(numericDictionary); + result = _.some(numericDictionary, numericDictionaryIterator); + result = _.some(numericDictionary, numericDictionaryIterator, any); + result = _.some(numericDictionary, ''); + result = _.some<{a: number}, TResult>(numericDictionary, {a: 42}); + result = _(array).some(); result = _(array).some(listIterator); result = _(array).some(listIterator, any); @@ -4420,6 +4740,12 @@ module TestSome { result = _(dictionary).some(dictionaryIterator, any); result = _(dictionary).some(''); result = _(dictionary).some<{a: number}>({a: 42}); + + result = _(numericDictionary).some(); + result = _(numericDictionary).some(numericDictionaryIterator); + result = _(numericDictionary).some(numericDictionaryIterator, any); + result = _(numericDictionary).some(''); + result = _(numericDictionary).some<{a: number}>({a: 42}); } { @@ -4442,6 +4768,12 @@ module TestSome { result = _(dictionary).chain().some(dictionaryIterator, any); result = _(dictionary).chain().some(''); result = _(dictionary).chain().some<{a: number}>({a: 42}); + + result = _(numericDictionary).chain().some(); + result = _(numericDictionary).chain().some(numericDictionaryIterator); + result = _(numericDictionary).chain().some(numericDictionaryIterator, any); + result = _(numericDictionary).chain().some(''); + result = _(numericDictionary).chain().some<{a: number}>({a: 42}); } } @@ -4695,16 +5027,43 @@ var addTwoNumbers = function (x: number, y: number) { return x + y }; var plusTwo = _.bind(addTwoNumbers, null, 2); plusTwo(100); -var view = { - 'label': 'docs', - 'onClick': function () { console.log('clicked ' + this.label); } -}; +// _.bindAll +module TestBindAll { + interface SampleObject { + a: Function; + b: Function; + c: Function; + } -view = _.bindAll(view); -jQuery('#docs').on('click', view.onClick); + let object: SampleObject; -view = _(view).bindAll().value(); -jQuery('#docs').on('click', view.onClick); + { + let result: SampleObject; + + result = _.bindAll(object); + result = _.bindAll(object, 'c'); + result = _.bindAll(object, ['b'], 'c'); + result = _.bindAll(object, 'a', ['b'], 'c'); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(object).bindAll(); + result = _(object).bindAll('c'); + result = _(object).bindAll(['b'], 'c'); + result = _(object).bindAll('a', ['b'], 'c'); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(object).chain().bindAll(); + result = _(object).chain().bindAll('c'); + result = _(object).chain().bindAll(['b'], 'c'); + result = _(object).chain().bindAll('a', ['b'], 'c'); + } +} var objectBindKey = { 'name': 'moe', @@ -5395,21 +5754,39 @@ result = _({}).isArguments(); } // _.isArray -result = _.isArray(any); -result = _(1).isArray(); -result = _([]).isArray(); -result = _({}).isArray(); -{ - let value: number[]|string = [1, 3, 5]; - if (_.isArray(value)) { - let length: number[] = value.concat(4); - // compile error - // let char: string = value.charAt(0); - } else { - let char: string = value.charAt(0); - // compile error - // let length: number[] = value.concat(4); - } +module TestIsArray { + { + let value: number|string[]|boolean[]; + + if (_.isArray(value)) { + let result: string[] = value; + } + else { + if (_.isArray(value)) { + let result: boolean[] = value; + } + else { + let result: number = value; + } + } + } + + { + let result: boolean; + + result = _.isArray(any); + result = _(1).isArray(); + result = _([]).isArray(); + result = _({}).isArray(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isArray(); + result = _([]).chain().isArray(); + result = _({}).chain().isArray(); + } } // _.isBoolean @@ -5543,10 +5920,24 @@ result = _({}).isError(); } // _.isFinite -result = _.isFinite(any); -result = _(1).isFinite(); -result = _([]).isFinite(); -result = _({}).isFinite(); +module TestIsFinite { + { + let result: boolean; + + result = _.isFinite(any); + result = _(1).isFinite(); + result = _([]).isFinite(); + result = _({}).isFinite(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isFinite(); + result = _([]).chain().isFinite(); + result = _({}).chain().isFinite(); + } +} // _.isFunction module TestIsFunction { @@ -5610,15 +6001,35 @@ module TestIsNaN { } // _.isNative -result = _.isNative(Array.prototype.push); -result = _(Array.prototype.push).isNative(); -{ - let value: Function|string = "foo"; - if (_.isNative(value)) { - value(); - } else { - let result: string = value; - } +module TestIsNative { + { + let value: number|Function; + + if (_.isNative(value)) { + let result: Function = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isNative(any); + + result = _(1).isNative(); + result = _([]).isNative(); + result = _({}).isNative(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNative(); + result = _([]).chain().isNative(); + result = _({}).chain().isNative(); + } } // _.isNull @@ -5643,24 +6054,56 @@ module TestIsNull { } // _.isNumber -result = _.isNumber(any); -result = _(1).isNumber(); -result = _([]).isNumber(); -result = _({}).isNumber(); -{ - let value: number|string = "foo"; - if (_.isNumber(value)) { - let result: number = value * 42; - } else { - let result: string = value; - } +module TestIsNumber { + { + let value: string|number; + + if (_.isNumber(value)) { + let result: number = value; + } + else { + let result: string = value; + } + } + + { + let result: boolean; + + result = _.isNumber(any); + + result = _(1).isNumber(); + result = _([]).isNumber(); + result = _({}).isNumber(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNumber(); + result = _([]).chain().isNumber(); + result = _({}).chain().isNumber(); + } } // _.isObject -result = _.isObject(any); -result = _(1).isObject(); -result = _([]).isObject(); -result = _({}).isObject(); +module TestIsObject { + { + let result: boolean; + + result = _.isObject(any); + result = _(1).isObject(); + result = _([]).isObject(); + result = _({}).isObject(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isObject(); + result = _([]).chain().isObject(); + result = _({}).chain().isObject(); + } +} // _.isPlainObject result = _.isPlainObject(any); @@ -5700,17 +6143,34 @@ module TestIsRegExp { } // _.isString -result = _.isString(any); -result = _(1).isString(); -result = _([]).isString(); -result = _({}).isString(); -{ - let value: string|number = "foo"; - if (_.isString(value)) { - let result: string = value; - } else { - let result: number = value * 42; - } +module TestIsString { + { + let value: number|string; + + if (_.isString(value)) { + let result: string = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isString(any); + result = _(1).isString(); + result = _([]).isString(); + result = _({}).isString(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isString(); + result = _([]).chain().isString(); + result = _({}).chain().isString(); + } } // _.isTypedArray @@ -5730,10 +6190,25 @@ module TestIsTypedArray { } // _.isUndefined -result = _.isUndefined(any); -result = _(1).isUndefined(); -result = _([]).isUndefined(); -result = _({}).isUndefined(); +module TestIsUndefined { + { + let result: boolean; + + result = _.isUndefined(any); + + result = _(1).isUndefined(); + result = _([]).isUndefined(); + result = _({}).isUndefined(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isUndefined(); + result = _([]).chain().isUndefined(); + result = _({}).chain().isUndefined(); + } +} // _.lt module TestLt { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 4e86afb66..c45ec90ee 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2837,343 +2837,810 @@ declare module _ { //_.uniq interface LoDashStatic { /** - * Creates a duplicate-value-free version of an array using strict equality for comparisons, - * i.e. ===. If the array is sorted, providing true for isSorted will use a faster algorithm. - * If a callback is provided each element of array is passed through the callback before - * uniqueness is computed. The callback is bound to thisArg and invoked with three arguments; - * (value, index, array). - * - * If a property name is provided for callback the created "_.pluck" style callback will - * return the property value of the given element. - * - * If an object is provided for callback the created "_.where" style callback will return - * true for elements that have the properties of the given object, else false. - * @param array Array to remove duplicates from. - * @param isSorted True if `array` is already sorted, optiona, default = false. - * @param iterator Transform the elements of `array` before comparisons for uniqueness. - * @param context 'this' object in `iterator`, optional. - * @return Copy of `array` where all elements are unique. - **/ - uniq(array: Array, isSorted?: boolean): T[]; - - /** - * @see _.uniq - **/ - uniq(array: List, isSorted?: boolean): T[]; - - /** - * @see _.uniq - **/ - uniq( - array: Array, - isSorted: boolean, - callback: ListIterator, - thisArg?: any): T[]; - - /** - * @see _.uniq - **/ - uniq( - array: List, - isSorted: boolean, - callback: ListIterator, - thisArg?: any): T[]; - - /** - * @see _.uniq - **/ - uniq( - array: Array, - callback: ListIterator, - thisArg?: any): T[]; - - /** - * @see _.uniq - **/ - uniq( - array: List, - callback: ListIterator, - thisArg?: any): T[]; - - /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ - uniq( - array: Array, - isSorted: boolean, - pluckValue: string): T[]; - - /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ + * Creates a duplicate-free version of an array, using SameValueZero for equality comparisons, in which only + * the first occurrence of each element is kept. Providing true for isSorted performs a faster search + * algorithm for sorted arrays. If an iteratee function is provided it’s invoked for each element in the + * array to generate the criterion by which uniqueness is computed. The iteratee is bound to thisArg and + * invoked with three arguments: (value, index, array). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.matchesProperty style callback returns true for + * elements that have a matching property value, else false. + * + * If an object is provided for iteratee the created _.matches style callback returns true for elements that + * have the properties of the given object, else false. + * + * @alias _.unique + * + * @param array The array to inspect. + * @param isSorted Specify the array is sorted. + * @param iteratee The function invoked per iteration. + * @param thisArg iteratee + * @return Returns the new duplicate-value-free array. + */ uniq( array: List, - isSorted: boolean, - pluckValue: string): T[]; + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ - uniq( - array: Array, - pluckValue: string): T[]; + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ + * @see _.uniq + */ uniq( array: List, - pluckValue: string): T[]; + iteratee?: ListIterator, + thisArg?: any + ): T[]; /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - uniq( - array: Array, - isSorted: boolean, - whereValue: W): T[]; - - /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - uniq( + * @see _.uniq + */ + uniq( array: List, - isSorted: boolean, - whereValue: W): T[]; + iteratee?: ListIterator, + thisArg?: any + ): T[]; /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - uniq( - array: Array, - whereValue: W): T[]; - - /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - uniq( + * @see _.uniq + */ + uniq( array: List, - whereValue: W): T[]; + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): T[]; /** - * @see _.uniq - **/ - unique(array: Array, isSorted?: boolean): T[]; - - /** - * @see _.uniq - **/ - unique(array: List, isSorted?: boolean): T[]; - - /** - * @see _.uniq - **/ - unique( - array: Array, - callback: ListIterator, - thisArg?: any): T[]; - - /** - * @see _.uniq - **/ - unique( + * @see _.uniq + */ + uniq( array: List, - callback: ListIterator, - thisArg?: any): T[]; + iteratee?: string, + thisArg?: any + ): T[]; /** - * @see _.uniq - **/ - unique( - array: Array, - isSorted: boolean, - callback: ListIterator, - thisArg?: any): T[]; - - /** - * @see _.uniq - **/ - unique( + * @see _.uniq + */ + uniq( array: List, - isSorted: boolean, - callback: ListIterator, - thisArg?: any): T[]; + isSorted?: boolean, + iteratee?: Object + ): T[]; /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ - unique( - array: Array, - isSorted: boolean, - pluckValue: string): T[]; - - /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ - unique( + * @see _.uniq + */ + uniq( array: List, - isSorted: boolean, - pluckValue: string): T[]; + isSorted?: boolean, + iteratee?: TWhere + ): T[]; /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ - unique( - array: Array, - pluckValue: string): T[]; - - /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ - unique( + * @see _.uniq + */ + uniq( array: List, - pluckValue: string): T[]; + iteratee?: Object + ): T[]; /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - unique( - array: Array, - whereValue?: W): T[]; - - /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - unique( + * @see _.uniq + */ + uniq( array: List, - whereValue?: W): T[]; + iteratee?: TWhere + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - unique( - array: Array, - isSorted: boolean, - whereValue?: W): T[]; - - /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - unique( - array: List, - isSorted: boolean, - whereValue?: W): T[]; + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; } interface LoDashImplicitArrayWrapper { /** - * @see _.uniq - **/ - uniq(isSorted?: boolean): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - **/ + * @see _.uniq + */ uniq( - isSorted: boolean, - callback: ListIterator, - thisArg?: any): LoDashImplicitArrayWrapper; + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - **/ + * @see _.uniq + */ uniq( - callback: ListIterator, - thisArg?: any): LoDashImplicitArrayWrapper; + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ + * @see _.uniq + */ uniq( - isSorted: boolean, - pluckValue: string): LoDashImplicitArrayWrapper; + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ - uniq(pluckValue: string): LoDashImplicitArrayWrapper; + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - uniq( - isSorted: boolean, - whereValue: W): LoDashImplicitArrayWrapper; + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - uniq( - whereValue: W): LoDashImplicitArrayWrapper; + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - **/ - unique(isSorted?: boolean): LoDashImplicitArrayWrapper; + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - **/ + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.unique + interface LoDashStatic { + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: TWhere + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: TWhere + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniq + */ unique( - isSorted: boolean, - callback: ListIterator, - thisArg?: any): LoDashImplicitArrayWrapper; + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - **/ + * @see _.uniq + */ unique( - callback: ListIterator, - thisArg?: any): LoDashImplicitArrayWrapper; + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ unique( - isSorted: boolean, - pluckValue: string): LoDashImplicitArrayWrapper; + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ - unique(pluckValue: string): LoDashImplicitArrayWrapper; + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - unique( - isSorted: boolean, - whereValue: W): LoDashImplicitArrayWrapper; + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - unique( - whereValue: W): LoDashImplicitArrayWrapper; + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; } //_.unzip @@ -4062,7 +4529,16 @@ declare module _ { * @see _.some */ any( - collection: List|Dictionary, + collection: NumericDictionary, + predicate?: NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: List|Dictionary|NumericDictionary, predicate?: string, thisArg?: any ): boolean; @@ -4071,7 +4547,7 @@ declare module _ { * @see _.some */ any( - collection: List|Dictionary, + collection: List|Dictionary|NumericDictionary, predicate?: TObject ): boolean; } @@ -4081,7 +4557,7 @@ declare module _ { * @see _.some */ any( - predicate?: ListIterator, + predicate?: ListIterator|NumericDictionaryIterator, thisArg?: any ): boolean; @@ -4106,7 +4582,7 @@ declare module _ { * @see _.some */ any( - predicate?: ListIterator|DictionaryIterator, + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, thisArg?: any ): boolean; @@ -4131,7 +4607,7 @@ declare module _ { * @see _.some */ any( - predicate?: ListIterator, + predicate?: ListIterator|NumericDictionaryIterator, thisArg?: any ): LoDashExplicitWrapper; @@ -4156,7 +4632,7 @@ declare module _ { * @see _.some */ any( - predicate?: ListIterator|DictionaryIterator, + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, thisArg?: any ): LoDashExplicitWrapper; @@ -7477,7 +7953,16 @@ declare module _ { * @see _.some */ some( - collection: List|Dictionary, + collection: NumericDictionary, + predicate?: NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: List|Dictionary|NumericDictionary, predicate?: string, thisArg?: any ): boolean; @@ -7486,7 +7971,7 @@ declare module _ { * @see _.some */ some( - collection: List|Dictionary, + collection: List|Dictionary|NumericDictionary, predicate?: TObject ): boolean; } @@ -7496,7 +7981,7 @@ declare module _ { * @see _.some */ some( - predicate?: ListIterator, + predicate?: ListIterator|NumericDictionaryIterator, thisArg?: any ): boolean; @@ -7521,7 +8006,7 @@ declare module _ { * @see _.some */ some( - predicate?: ListIterator|DictionaryIterator, + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, thisArg?: any ): boolean; @@ -7546,7 +8031,7 @@ declare module _ { * @see _.some */ some( - predicate?: ListIterator, + predicate?: ListIterator|NumericDictionaryIterator, thisArg?: any ): LoDashExplicitWrapper; @@ -7571,7 +8056,7 @@ declare module _ { * @see _.some */ some( - predicate?: ListIterator|DictionaryIterator, + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, thisArg?: any ): LoDashExplicitWrapper; @@ -8103,24 +8588,35 @@ declare module _ { //_.bindAll interface LoDashStatic { /** - * Binds methods of an object to the object itself, overwriting the existing method. Method - * names may be specified as individual arguments or as arrays of method names. If no method - * names are provided all the function properties of object will be bound. - * @param object The object to bind and assign the bound methods to. - * @param methodNames The object method names to bind, specified as individual method names - * or arrays of method names. - * @return object - **/ + * Binds methods of an object to the object itself, overwriting the existing method. Method names may be + * specified as individual arguments or as arrays of method names. If no method names are provided all + * enumerable function properties, own and inherited, of object are bound. + * + * Note: This method does not set the "length" property of bound functions. + * + * @param object The object to bind and assign the bound methods to. + * @param methodNames The object method names to bind, specified as individual method names or arrays of + * method names. + * @return Returns object. + */ bindAll( object: T, - ...methodNames: string[]): T; + ...methodNames: (string|string[])[] + ): T; } interface LoDashImplicitObjectWrapper { /** - * @see _.bindAll - **/ - bindAll(...methodNames: string[]): LoDashImplicitWrapper; + * @see _.bindAll + */ + bindAll(...methodNames: (string|string[])[]): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.bindAll + */ + bindAll(...methodNames: (string|string[])[]): LoDashExplicitObjectWrapper; } //_.bindKey @@ -9243,9 +9739,10 @@ declare module _ { /** * Checks if value is classified as an Array object. * @param value The value to check. + * * @return Returns true if value is correctly classified, else false. - **/ - isArray(value?: any): value is any[]; + */ + isArray(value?: any): value is T[]; } interface LoDashImplicitWrapperBase { @@ -9255,6 +9752,13 @@ declare module _ { isArray(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * @see _.isArray + */ + isArray(): LoDashExplicitWrapper; + } + //_.isBoolean interface LoDashStatic { /** @@ -9424,11 +9928,13 @@ declare module _ { interface LoDashStatic { /** * Checks if value is a finite primitive number. + * * Note: This method is based on Number.isFinite. + * * @param value The value to check. * @return Returns true if value is a finite number, else false. - **/ - isFinite(value?: any): value is number; + */ + isFinite(value?: any): boolean; } interface LoDashImplicitWrapperBase { @@ -9438,6 +9944,13 @@ declare module _ { isFinite(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * @see _.isFinite + */ + isFinite(): LoDashExplicitWrapper; + } + //_.isFunction interface LoDashStatic { /** @@ -9522,6 +10035,7 @@ declare module _ { /** * Checks if value is a native function. * @param value The value to check. + * * @retrun Returns true if value is a native function, else false. */ isNative(value: any): value is Function; @@ -9534,6 +10048,13 @@ declare module _ { isNative(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * see _.isNative + */ + isNative(): LoDashExplicitWrapper; + } + //_.isNull interface LoDashStatic { /** @@ -9563,7 +10084,9 @@ declare module _ { interface LoDashStatic { /** * Checks if value is classified as a Number primitive or object. + * * Note: To exclude Infinity, -Infinity, and NaN, which are classified as numbers, use the _.isFinite method. + * * @param value The value to check. * @return Returns true if value is correctly classified, else false. */ @@ -9577,14 +10100,22 @@ declare module _ { isNumber(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * see _.isNumber + */ + isNumber(): LoDashExplicitWrapper; + } + //_.isObject interface LoDashStatic { /** * Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes, new Number(0), * and new String('')) + * * @param value The value to check. * @return Returns true if value is an object, else false. - **/ + */ isObject(value?: any): boolean; } @@ -9595,6 +10126,13 @@ declare module _ { isObject(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * see _.isObject + */ + isObject(): LoDashExplicitWrapper; + } + //_.isPlainObject interface LoDashStatic { /** @@ -9645,9 +10183,10 @@ declare module _ { interface LoDashStatic { /** * Checks if value is classified as a String primitive or object. + * * @param value The value to check. * @return Returns true if value is correctly classified, else false. - **/ + */ isString(value?: any): value is string; } @@ -9658,6 +10197,13 @@ declare module _ { isString(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * see _.isString + */ + isString(): LoDashExplicitWrapper; + } + //_.isTypedArray interface LoDashStatic { /** @@ -9687,9 +10233,10 @@ declare module _ { interface LoDashStatic { /** * Checks if value is undefined. + * * @param value The value to check. * @return Returns true if value is undefined, else false. - **/ + */ isUndefined(value: any): boolean; } @@ -9700,6 +10247,13 @@ declare module _ { isUndefined(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * see _.isUndefined + */ + isUndefined(): LoDashExplicitWrapper; + } + //_.lt interface LoDashStatic { /** @@ -13751,6 +14305,10 @@ declare module _ { (value: T, key?: string, collection?: Dictionary): TResult; } + interface NumericDictionaryIterator { + (value: T, key?: number, collection?: Dictionary): TResult; + } + interface ObjectIterator { (element: T, key?: string, collection?: any): TResult; } @@ -13785,6 +14343,10 @@ declare module _ { [index: string]: T; } + interface NumericDictionary { + [index: number]: T; + } + interface StringRepresentable { toString(): string; } diff --git a/lwip/lwip.d.ts b/lwip/lwip.d.ts index 63d2c701b..0f40c63d2 100644 --- a/lwip/lwip.d.ts +++ b/lwip/lwip.d.ts @@ -12,6 +12,10 @@ declare module "lwip" { interface ImageCallback { (err: any, image: Image): void; } + + interface BufferCallback { + (err: any, buffer: Buffer): void; + } /** * Open an image @@ -386,7 +390,7 @@ declare module "lwip" { * * @param format Encoding format. */ - toBuffer(format: "jpg", callback: ImageCallback): void; + toBuffer(format: "jpg", callback: BufferCallback): void; /** * Get encoded binary image data as a NodeJS Buffer. @@ -396,7 +400,7 @@ declare module "lwip" { * @param format Encoding format. * @param params Format-specific parameters. */ - toBuffer(format: "jpg", params: JpegBufferParams, callback: ImageCallback): void; + toBuffer(format: "jpg", params: JpegBufferParams, callback: BufferCallback): void; /** * Get encoded binary image data as a NodeJS Buffer. @@ -405,7 +409,7 @@ declare module "lwip" { * * @param format Encoding format. */ - toBuffer(format: "png", callback: ImageCallback): void; + toBuffer(format: "png", callback: BufferCallback): void; /** * Get encoded binary image data as a NodeJS Buffer. @@ -415,7 +419,7 @@ declare module "lwip" { * @param format Encoding format. * @param params Format-specific parameters. */ - toBuffer(format: "png", params: PngBufferParams, callback: ImageCallback): void; + toBuffer(format: "png", params: PngBufferParams, callback: BufferCallback): void; /** * Get encoded binary image data as a NodeJS Buffer. @@ -424,7 +428,7 @@ declare module "lwip" { * * @param format Encoding format. */ - toBuffer(format: "gif", callback: ImageCallback): void; + toBuffer(format: "gif", callback: BufferCallback): void; /** * Get encoded binary image data as a NodeJS Buffer. @@ -434,7 +438,7 @@ declare module "lwip" { * @param format Encoding format. * @param params Format-specific parameters. */ - toBuffer(format: "gif", params: GifBufferParams, callback: ImageCallback): void; + toBuffer(format: "gif", params: GifBufferParams, callback: BufferCallback): void; /** * Get encoded binary image data as a NodeJS Buffer. @@ -443,7 +447,7 @@ declare module "lwip" { * * @param format Encoding format. */ - toBuffer(format: string, callback: ImageCallback): void; + toBuffer(format: string, callback: BufferCallback): void; /** * Get encoded binary image data as a NodeJS Buffer. @@ -453,7 +457,7 @@ declare module "lwip" { * @param format Encoding format. * @param params Format-specific parameters. */ - toBuffer(format: string, params: JpegBufferParams | PngBufferParams | GifBufferParams, callback: ImageCallback): void; + toBuffer(format: string, params: JpegBufferParams | PngBufferParams | GifBufferParams, callback: BufferCallback): void; /** * Write encoded binary image data directly to a file. @@ -848,7 +852,7 @@ declare module "lwip" { * * @param format Encoding format. */ - toBuffer(format: "jpg", callback: ImageCallback): void; + toBuffer(format: "jpg", callback: BufferCallback): void; /** * Execute batch and obtain a Buffer object @@ -858,7 +862,7 @@ declare module "lwip" { * @param format Encoding format. * @param params Format-specific parameters. */ - toBuffer(format: "jpg", params: JpegBufferParams, callback: ImageCallback): void; + toBuffer(format: "jpg", params: JpegBufferParams, callback: BufferCallback): void; /** * Execute batch and obtain a Buffer object @@ -867,7 +871,7 @@ declare module "lwip" { * * @param format Encoding format. */ - toBuffer(format: "png", callback: ImageCallback): void; + toBuffer(format: "png", callback: BufferCallback): void; /** * Execute batch and obtain a Buffer object @@ -877,7 +881,7 @@ declare module "lwip" { * @param format Encoding format. * @param params Format-specific parameters. */ - toBuffer(format: "png", params: PngBufferParams, callback: ImageCallback): void; + toBuffer(format: "png", params: PngBufferParams, callback: BufferCallback): void; /** * Execute batch and obtain a Buffer object @@ -886,7 +890,7 @@ declare module "lwip" { * * @param format Encoding format. */ - toBuffer(format: "gif", callback: ImageCallback): void; + toBuffer(format: "gif", callback: BufferCallback): void; /** * Execute batch and obtain a Buffer object @@ -896,7 +900,7 @@ declare module "lwip" { * @param format Encoding format. * @param params Format-specific parameters. */ - toBuffer(format: "gif", params: GifBufferParams, callback: ImageCallback): void; + toBuffer(format: "gif", params: GifBufferParams, callback: BufferCallback): void; /** * Execute batch and obtain a Buffer object @@ -905,7 +909,7 @@ declare module "lwip" { * * @param format Encoding format. */ - toBuffer(format: string, callback: ImageCallback): void; + toBuffer(format: string, callback: BufferCallback): void; /** * Execute batch and obtain a Buffer object @@ -915,7 +919,7 @@ declare module "lwip" { * @param format Encoding format. * @param params Format-specific parameters. */ - toBuffer(format: string, params: JpegBufferParams | PngBufferParams | GifBufferParams, callback: ImageCallback): void; + toBuffer(format: string, params: JpegBufferParams | PngBufferParams | GifBufferParams, callback: BufferCallback): void; /** * Execute batch and write to file diff --git a/mailparser/mailparser.d.ts b/mailparser/mailparser.d.ts index 9e67cc78a..b45ce05d9 100644 --- a/mailparser/mailparser.d.ts +++ b/mailparser/mailparser.d.ts @@ -78,9 +78,11 @@ declare module 'mailparser' { once(event: string, listener: Function): EventEmitter; removeListener(event: string, listener: Function): EventEmitter; removeAllListeners(event?: string): EventEmitter; - setMaxListeners(n: number): void; + setMaxListeners(n: number): EventEmitter; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; } } diff --git a/maker.js/makerjs-tests.ts b/maker.js/makerjs-tests.ts index ae17a8fe9..4b6b5f80e 100644 --- a/maker.js/makerjs-tests.ts +++ b/maker.js/makerjs-tests.ts @@ -49,8 +49,8 @@ function test() { function testKit() { makerjs.kit.construct(null, null); makerjs.kit.getParameterValues(null); - ({}).max; - ({}).metaParameters; + ({}).max; + ({}).metaParameters; } function testMeasure() { @@ -66,11 +66,14 @@ function test() { } function testModel(){ - makerjs.model.combine(model, model, true, false, true, false); + makerjs.model.breakPathsAtIntersections(model, { paths:{ } }); + var opts: MakerJs.ICombineOptions = { trimDeadEnds: true, pointMatchingDistance: 2 }; + makerjs.model.combine(model, model, true, false, true, false, opts); makerjs.model.convertUnits(model, makerjs.unitType.Centimeter); makerjs.model.countChildModels(model); makerjs.model.detachLoop(model); makerjs.model.findLoops(model); + makerjs.model.getSimilarModelId(model, 'foo'); makerjs.model.getSimilarPathId(model, 'foo'); makerjs.model.isPathInsideModel(paths.line, model); makerjs.model.mirror(model, false, true); @@ -89,19 +92,20 @@ function test() { new makerjs.models.ConnectTheDots(true, [ [0,0], [1,1] ]), new makerjs.models.Dome(5, 7), new makerjs.models.Oval(7, 7), - new makerjs.models.OvalArc(6, 4, 2, 12), + new makerjs.models.OvalArc(6, 4, 2, 12, true), new makerjs.models.Polygon(7, 5), new makerjs.models.Rectangle(8, 9), new makerjs.models.Ring(7, 7), new makerjs.models.RoundRectangle(2, 2, 0), new makerjs.models.SCurve(5, .9), + new makerjs.models.Slot([0, 0], [1, 1], 7), new makerjs.models.Square(8), new makerjs.models.Star(5, 10, 5) ]; } function testPath() { - makerjs.path.areEqual(paths.line, paths.circle); + makerjs.path.areEqual(paths.line, paths.circle, 4); makerjs.path.breakAtPoint(paths.arc, [0,0]).type; makerjs.path.dogbone(paths.line, paths.line, 7); makerjs.path.fillet(paths.arc, paths.line, 4); @@ -140,6 +144,7 @@ function test() { makerjs.point.add(p1, p2); makerjs.point.areEqual(p1, p2); makerjs.point.areEqualRounded(p1, p2); + makerjs.point.average(p1, p2); makerjs.point.clone(p1); makerjs.point.closest([0,0], [p1, p2]); makerjs.point.fromAngleOnCircle(22, paths.circle); diff --git a/maker.js/makerjs.d.ts b/maker.js/makerjs.d.ts index 779af0534..cb217adb4 100644 --- a/maker.js/makerjs.d.ts +++ b/maker.js/makerjs.d.ts @@ -252,9 +252,22 @@ declare module MakerJs { */ interface IPointMatchOptions { /** - * Optional exemplar of number of decimal places. + * Max distance to consider two points as the same. */ - accuracy?: number; + pointMatchingDistance?: number; + } + /** + * Options to pass to model.combine. + */ + interface ICombineOptions extends IPointMatchOptions { + /** + * Flag to remove paths which are not part of a loop. + */ + trimDeadEnds?: boolean; + /** + * Point which is known to be outside of the model. + */ + farPoint?: IPoint; } /** * Options to pass to model.findLoops. @@ -343,6 +356,63 @@ declare module MakerJs { * Test to see if an object implements the required properties of a model. */ function isModel(item: any): boolean; + /** + * Reference to a path id within a model. + */ + interface IRefPathIdInModel { + modelContext: IModel; + pathId: string; + } + /** + * Path and its reference id within a model + */ + interface IRefPathInModel extends IRefPathIdInModel { + pathContext: IPath; + } + /** + * Describes a parameter and its limits. + */ + interface IMetaParameter { + /** + * Display text of the parameter. + */ + title: string; + /** + * Type of the parameter. Currently supports "range". + */ + type: string; + /** + * Optional minimum value of the range. + */ + min?: number; + /** + * Optional maximum value of the range. + */ + max?: number; + /** + * Optional step value between min and max. + */ + step?: number; + /** + * Initial sample value for this parameter. + */ + value: any; + } + /** + * An IKit is a model-producing class with some sample parameters. Think of it as a packaged model with instructions on how to best use it. + */ + interface IKit { + /** + * The constructor. The kit must be "new-able" and it must produce an IModel. + * It can have any number of any type of parameters. + */ + new (...args: any[]): IModel; + /** + * Attached to the constructor is a property named metaParameters which is an array of IMetaParameter objects. + * Each element of the array corresponds to a parameter of the constructor, in order. + */ + metaParameters?: IMetaParameter[]; + } } declare module MakerJs.angle { /** @@ -352,7 +422,7 @@ declare module MakerJs.angle { * @param b Second angle. * @returns true if angles are the same, false if they are not */ - function areEqual(angle1: number, angle2: number): boolean; + function areEqual(angle1: number, angle2: number, accuracy?: number): boolean; /** * Ensures an angle is not greater than 360 * @@ -439,7 +509,7 @@ declare module MakerJs.point { * @param b Second point. * @returns true if points are the same, false if they are not */ - function areEqual(a: IPoint, b: IPoint): boolean; + function areEqual(a: IPoint, b: IPoint, withinDistance?: number): boolean; /** * Find out if two points are equal after rounding. * @@ -449,6 +519,14 @@ declare module MakerJs.point { * @returns true if points are the same, false if they are not */ function areEqualRounded(a: IPoint, b: IPoint, accuracy?: number): boolean; + /** + * Get the average of two points. + * + * @param a First point. + * @param b Second point. + * @returns New point object which is the average of a and b. + */ + function average(a: IPoint, b: IPoint): IPoint; /** * Clone a point into a new point. * @@ -567,7 +645,7 @@ declare module MakerJs.path { * @param b Second path. * @returns true if paths are the same, false if they are not */ - function areEqual(path1: IPath, path2: IPath): boolean; + function areEqual(path1: IPath, path2: IPath, withinPointDistance?: number): boolean; /** * Create a clone of a path, mirrored on either or both x and y axes. * @@ -698,11 +776,18 @@ declare module MakerJs.model { * @returns Number of child models. */ function countChildModels(modelContext: IModel): number; + /** + * Get an unused id in the models map with the same prefix. + * + * @param modelContext The model containing the models map. + * @param modelId The id to use directly (if unused), or as a prefix. + */ + function getSimilarModelId(modelContext: IModel, modelId: string): string; /** * Get an unused id in the paths map with the same prefix. * * @param modelContext The model containing the paths map. - * @param pathId The pathId to use directly (if unused), or as a prefix. + * @param pathId The id to use directly (if unused), or as a prefix. */ function getSimilarPathId(modelContext: IModel, pathId: string): string; /** @@ -782,7 +867,14 @@ declare module MakerJs.model { */ function isPathInsideModel(pathContext: IPath, modelContext: IModel, farPoint?: IPoint): boolean; /** - * Combine 2 models. The models should be originated. + * Break a model's paths everywhere they intersect with another path. + * + * @param modelToBreak The model containing paths to be broken. + * @param modelToIntersect Optional model containing paths to look for intersection, or else the modelToBreak will be used. + */ + function breakPathsAtIntersections(modelToBreak: IModel, modelToIntersect?: IModel): void; + /** + * Combine 2 models. The models should be originated, and every path within each model should be part of a loop. * * @param modelA First model to combine. * @param modelB Second model to combine. @@ -793,7 +885,7 @@ declare module MakerJs.model { * @param keepDuplicates Flag to include paths which are duplicate in both models. * @param farPoint Optional point of reference which is outside the bounds of both models. */ - function combine(modelA: IModel, modelB: IModel, includeAInsideB?: boolean, includeAOutsideB?: boolean, includeBInsideA?: boolean, includeBOutsideA?: boolean, keepDuplicates?: boolean, farPoint?: IPoint): void; + function combine(modelA: IModel, modelB: IModel, includeAInsideB?: boolean, includeAOutsideB?: boolean, includeBInsideA?: boolean, includeBOutsideA?: boolean, options?: ICombineOptions): void; } declare module MakerJs.units { /** @@ -1003,50 +1095,6 @@ declare module MakerJs.path { function fillet(path1: IPath, path2: IPath, filletRadius: number, options?: IPointMatchOptions): IPathArc; } declare module MakerJs.kit { - /** - * Describes a parameter and its limits. - */ - interface IMetaParameter { - /** - * Display text of the parameter. - */ - title: string; - /** - * Type of the parameter. Currently supports "range". - */ - type: string; - /** - * Optional minimum value of the range. - */ - min?: number; - /** - * Optional maximum value of the range. - */ - max?: number; - /** - * Optional step value between min and max. - */ - step?: number; - /** - * Initial sample value for this parameter. - */ - value: any; - } - /** - * An IKit is a model-producing class with some sample parameters. Think of it as a packaged model with instructions on how to best use it. - */ - interface IKit { - /** - * The constructor. The kit must be "new-able" and it must produce an IModel. - * It can have any number of any type of parameters. - */ - new (...args: any[]): IModel; - /** - * Attached to the constructor is a property named metaParameters which is an array of IMetaParameter objects. - * Each element of the array corresponds to a parameter of the constructor, in order. - */ - metaParameters?: IMetaParameter[]; - } /** * Helper function to use the JavaScript "apply" function in conjunction with the "new" keyword. * @@ -1064,6 +1112,23 @@ declare module MakerJs.kit { function getParameterValues(ctor: IKit): any[]; } declare module MakerJs.model { + /** + * @private + */ + interface IPointMappedItem { + averagePoint: IPoint; + item: T; + } + /** + * @private + */ + class PointMap { + matchingDistance: number; + list: IPointMappedItem[]; + constructor(matchingDistance?: number); + add(pointToAdd: IPoint, item: T): void; + find(pointToFind: IPoint, saveAverage: boolean): T; + } /** * Find paths that have common endpoints and form loops. * @@ -1078,6 +1143,7 @@ declare module MakerJs.model { * @param loopToDetach The model to search for loops. */ function detachLoop(loopToDetach: IModel): void; + function removeDeadEnds(modelContext: IModel, pointMatchingDistance?: number): void; } declare module MakerJs.exporter { /** @@ -1247,7 +1313,7 @@ declare module MakerJs.models { declare module MakerJs.models { class OvalArc implements IModel { paths: IPathMap; - constructor(startAngle: number, endAngle: number, sweepRadius: number, slotRadius: number); + constructor(startAngle: number, endAngle: number, sweepRadius: number, slotRadius: number, selfIntersect?: boolean); } } declare module MakerJs.models { @@ -1267,6 +1333,13 @@ declare module MakerJs.models { constructor(width: number, height: number); } } +declare module MakerJs.models { + class Slot implements IModel { + paths: IPathMap; + origin: IPoint; + constructor(origin: IPoint, endPoint: IPoint, radius: number); + } +} declare module MakerJs.models { class Square extends Rectangle { constructor(side: number); diff --git a/marked/marked-tests.ts b/marked/marked-tests.ts index 44be0f0e8..efb671548 100644 --- a/marked/marked-tests.ts +++ b/marked/marked-tests.ts @@ -14,7 +14,8 @@ var options: MarkedOptions = { return ''; }, langPrefix: 'lang-', - smartypants: false + smartypants: false, + renderer: new marked.Renderer() }; function callback() { diff --git a/marked/marked.d.ts b/marked/marked.d.ts index 198cd2626..85103b020 100644 --- a/marked/marked.d.ts +++ b/marked/marked.d.ts @@ -3,7 +3,6 @@ // Definitions by: William Orr // Definitions: https://github.com/borisyankov/DefinitelyTyped - interface MarkedStatic { /** * Compiles markdown to HTML. @@ -60,6 +59,43 @@ interface MarkedStatic { * @param options Hash of options */ setOptions(options: MarkedOptions): MarkedStatic; + + Renderer: { + new(): MarkedRenderer; + } + + Parser: { + new(options: MarkedOptions): MarkedParser; + } +} + +interface MarkedRenderer { + code(code: string, language: string): string; + blockquote(quote: string): string; + html(html: string): string; + heading(text: string, level: number): string; + hr(): string; + list(body: string, ordered: boolean): string; + listitem(text: string): string; + paragraph(text: string): string; + table(header: string, body: string): string; + tablerow(content: string): string; + tablecell(content: string, flags: { + header: boolean, + align: string + }): string; + strong(text: string): string; + em(text: string): string; + codespan(code: string): string; + br(): string; + del(text: string): string; + link(href: string, title: string, text: string): string; + image(href: string, title: string, text: string): string; + text(text: string): string; +} + +interface MarkedParser { + parse(source: any[]): string } interface MarkedOptions { @@ -68,7 +104,7 @@ interface MarkedOptions { * * An object containing functions to render tokens to HTML. */ - renderer?: Object; + renderer?: MarkedRenderer; /** * Enable GitHub flavored markdown. diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index 2ef16119c..afa268ba5 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -320,7 +320,7 @@ declare namespace __MaterialUI { interface DatePickerProps extends React.Props { autoOk?: boolean; defaultDate?: Date; - formatDate?: string; + formatDate?: (date:Date) => string; hintText?: string; floatingLabelText?: string; hideToolbarYearChange?: boolean; diff --git a/mmmagic/mmmagic-tests.ts b/mmmagic/mmmagic-tests.ts new file mode 100644 index 000000000..afe93ff09 --- /dev/null +++ b/mmmagic/mmmagic-tests.ts @@ -0,0 +1,30 @@ +/// + +import Magic = require("mmmagic"); + +// get general description of a file +var magic: Magic.Magic; + +magic = new Magic.Magic(); +magic.detectFile('node_modules/mmmagic/build/Release/magic.node', function(err: Error, result: string) { + if (err) throw err; + console.log(result); + // output on Windows with 32-bit node: +}); + +// get mime type for a file +magic = new Magic.Magic(Magic.MAGIC_MIME_TYPE); +magic.detectFile('node_modules/mmmagic/build/Release/magic.node', function(err: Error, result: string) { + if (err) throw err; + console.log(result); +}); + +// get mime type and mime encoding for a file +magic = new Magic.Magic(); +var buf = new Buffer('import Options\nfrom os import unlink, symlink'); + +magic.detect(buf, function(err: Error, result: string) { + if (err) throw err; + console.log(result); + // output: Python script, ASCII text executable +}); \ No newline at end of file diff --git a/mmmagic/mmmagic.d.ts b/mmmagic/mmmagic.d.ts new file mode 100644 index 000000000..b286c9331 --- /dev/null +++ b/mmmagic/mmmagic.d.ts @@ -0,0 +1,37 @@ +// Type definitions for mmmagic v0.4.1 +// Project: https://github.com/mscdex/mmmagic +// Definitions by: Andrei Sebastian Cîmpean +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "mmmagic" { + export type bitmask = number; + export class Magic { + constructor(magicPath?: string, mask?: bitmask); + constructor(mask?: bitmask); + detectFile(path: string, callback: (err: Error, result: string) => void): void; + detect(data: Buffer, callback: (err: Error, result: string) => void): void; + } + export var MAGIC_NONE: bitmask; // no flags set + export var MAGIC_DEBUG: bitmask; // turn on debugging + export var MAGIC_SYMLINK: bitmask; // follow symlinks (default for non-Windows) + export var MAGIC_DEVICES: bitmask; // look at the contents of devices + export var MAGIC_MIME_TYPE: bitmask; // return the MIME type + export var MAGIC_CONTINUE: bitmask; // return all matches (returned as an array of strings) + export var MAGIC_CHECK: bitmask; // print warnings to stderr + export var MAGIC_PRESERVE_ATIME: bitmask; // restore access time on exit + export var MAGIC_RAW: bitmask; // don't translate unprintable chars + export var MAGIC_MIME_ENCODING: bitmask; // return the MIME encoding + export var MAGIC_MIME: bitmask; // (export var MAGIC_MIME_TYPE | export var MAGIC_MIME_ENCODING) + export var MAGIC_APPLE: bitmask; // return the Apple creator and type + export var MAGIC_NO_CHECK_TAR: bitmask; // don't check for tar files + export var MAGIC_NO_CHECK_SOFT: bitmask; // don't check magic entries + export var MAGIC_NO_CHECK_APPTYPE: bitmask; // don't check application type + export var MAGIC_NO_CHECK_ELF: bitmask; // don't check for elf details + export var MAGIC_NO_CHECK_TEXT: bitmask; // don't check for text files + export var MAGIC_NO_CHECK_CDF: bitmask; // don't check for cdf files + export var MAGIC_NO_CHECK_TOKENS: bitmask; // don't check tokens + export var MAGIC_NO_CHECK_ENCODING: bitmask // don't check text encodings + +} \ No newline at end of file diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index babde41c9..3471a8fc3 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -1,10 +1,22 @@ -// Type definitions for Moment.js 2.8.0 +// Type definitions for Moment.js 2.10.5 // Project: https://github.com/timrwood/moment // Definitions by: Michael Lakerveld , Aaron King , Hiroki Horiuchi , Dick van den Brink , Adi Dahiya , Matt Brooks // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module moment { + interface MomentDateObject { + years?: number; + /* One digit */ + months?: number; + /* Day of the month */ + date?: number; + hours?: number; + minutes?: number; + seconds?: number; + milliseconds?: number; + } + interface MomentInput { /** Year */ years?: number; @@ -247,8 +259,8 @@ declare module moment { dayOfYear(): number; dayOfYear(d: number): Moment; - from(f: Moment|string|number|Date|number[], suffix?: boolean): string; - to(f: Moment|string|number|Date|number[], suffix?: boolean): string; + from(f: Moment | string | number | Date | number[], suffix?: boolean): string; + to(f: Moment | string | number | Date | number[], suffix?: boolean): string; toNow(withoutPrefix?: boolean): string; diff(b: Moment): number; @@ -272,13 +284,13 @@ declare module moment { isDST(): boolean; isBefore(): boolean; - isBefore(b: Moment|string|number|Date|number[], granularity?: string): boolean; + isBefore(b: Moment | string | number | Date | number[], granularity?: string): boolean; isAfter(): boolean; - isAfter(b: Moment|string|number|Date|number[], granularity?: string): boolean; + isAfter(b: Moment | string | number | Date | number[], granularity?: string): boolean; - isSame(b: Moment|string|number|Date|number[], granularity?: string): boolean; - isBetween(a: Moment|string|number|Date|number[], b: Moment|string|number|Date|number[], granularity?: string): boolean; + isSame(b: Moment | string | number | Date | number[], granularity?: string): boolean; + isBetween(a: Moment | string | number | Date | number[], b: Moment | string | number | Date | number[], granularity?: string): boolean; // Deprecated as of 2.8.0. lang(language: string): Moment; @@ -294,43 +306,47 @@ declare module moment { localeData(): MomentLanguage; // Deprecated as of 2.7.0. - max(date: Moment|string|number|Date|any[]): Moment; + max(date: Moment | string | number | Date | any[]): Moment; max(date: string, format: string): Moment; // Deprecated as of 2.7.0. - min(date: Moment|string|number|Date|any[]): Moment; + min(date: Moment | string | number | Date | any[]): Moment; min(date: string, format: string): Moment; get(unit: string): number; set(unit: string, value: number): Moment; set(objectLiteral: MomentInput): Moment; + + /*This returns an object containing year, month, day-of-month, hour, minute, seconds, milliseconds.*/ + //Works with version 2.10.5+ + toObject(): MomentDateObject; } type formatFunction = () => string; interface MomentCalendar { - lastDay?: string | formatFunction; - sameDay?: string | formatFunction; - nextDay?: string | formatFunction; - lastWeek?: string | formatFunction; - nextWeek?: string | formatFunction; - sameElse?: string | formatFunction; + lastDay?: string | formatFunction; + sameDay?: string | formatFunction; + nextDay?: string | formatFunction; + lastWeek?: string | formatFunction; + nextWeek?: string | formatFunction; + sameElse?: string | formatFunction; } interface BaseMomentLanguage { - months ?: any; - monthsShort ?: any; - weekdays ?: any; - weekdaysShort ?: any; - weekdaysMin ?: any; - relativeTime ?: MomentRelativeTime; - meridiem ?: (hour: number, minute: number, isLowercase: boolean) => string; - calendar ?: MomentCalendar; - ordinal ?: (num: number) => string; + months?: any; + monthsShort?: any; + weekdays?: any; + weekdaysShort?: any; + weekdaysMin?: any; + relativeTime?: MomentRelativeTime; + meridiem?: (hour: number, minute: number, isLowercase: boolean) => string; + calendar?: MomentCalendar; + ordinal?: (num: number) => string; } interface MomentLanguage extends BaseMomentLanguage { - longDateFormat?: MomentLongDateFormat; + longDateFormat?: MomentLongDateFormat; } interface MomentLanguageData extends BaseMomentLanguage { @@ -341,34 +357,34 @@ declare module moment { } interface MomentLongDateFormat { - L: string; - LL: string; - LLL: string; - LLLL: string; - LT: string; - LTS: string; - l?: string; - ll?: string; - lll?: string; - llll?: string; - lt?: string; - lts?: string; + L: string; + LL: string; + LLL: string; + LLLL: string; + LT: string; + LTS: string; + l?: string; + ll?: string; + lll?: string; + llll?: string; + lt?: string; + lts?: string; } interface MomentRelativeTime { - future: any; - past: any; - s: any; - m: any; - mm: any; - h: any; - hh: any; - d: any; - dd: any; - M: any; - MM: any; - y: any; - yy: any; + future: any; + past: any; + s: any; + m: any; + mm: any; + h: any; + hh: any; + d: any; + dd: any; + M: any; + MM: any; + y: any; + yy: any; } interface MomentStatic { @@ -460,8 +476,8 @@ declare module moment { max(...moments: Moment[]): Moment; normalizeUnits(unit: string): string; - relativeTimeThreshold(threshold: string): number|boolean; - relativeTimeThreshold(threshold: string, limit:number): boolean; + relativeTimeThreshold(threshold: string): number | boolean; + relativeTimeThreshold(threshold: string, limit: number): boolean; /** * Constant used to enable explicit ISO_8601 format parsing. diff --git a/mongoose/mongoose-tests.ts b/mongoose/mongoose-tests.ts index 4ccc9b72d..3cb9c3575 100644 --- a/mongoose/mongoose-tests.ts +++ b/mongoose/mongoose-tests.ts @@ -195,8 +195,8 @@ Model.findOneAndRemove({ type: 'iphone' }, { select: 'name' }, (err: any, res: I Model.findOneAndRemove({ type: 'iphone' }, { select: 'name' }).exec((err: any, res: IActor) => {}); Model.findOneAndUpdate({ type: 'iphone' }, { $set: { name: 'jason borne' }}, { upsert: true }, (err: any, res: IActor) => {}); -Model.geoNear([1, 3], { maxDistance : 5, spherical : true }, (err: any, res: IActor[]) => {}); -Model.geoNear({ type : "Point", coordinates : [9,9] }, { maxDistance : 5, spherical : true }, (err: any, res: IActor[]) => {}); +Model.geoNear([1, 3], { maxDistance : 5, spherical : true }, (err: any, res: IActor[], stats: any) => {}); +Model.geoNear({ type : "Point", coordinates : [9,9] }, { maxDistance : 5, spherical : true }, (err: any, res: IActor[], stats: any) => {}); Model.geoSearch({ type : "house" }, { near: [10, 10], maxDistance: 5 }, (err: any, res: IActor[]) => {}); var o = { diff --git a/mongoose/mongoose.d.ts b/mongoose/mongoose.d.ts index e840d8e05..b97162267 100644 --- a/mongoose/mongoose.d.ts +++ b/mongoose/mongoose.d.ts @@ -212,8 +212,8 @@ declare module "mongoose" { findOneAndUpdate(cond: Object, update: Object, callback?: (err: any, res: T) => void): Query; findOneAndUpdate(cond: Object, update: Object, options: FindAndUpdateOption, callback?: (err: any, res: T) => void): Query; - geoNear(point: { type: string; coordinates: number[] }, options: Object, callback?: (err: any, res: T[]) => void): Query; - geoNear(point: number[], options: Object, callback?: (err: any, res: T[]) => void): Query; + geoNear(point: { type: string; coordinates: number[] }, options: Object, callback?: (err: any, res: T[], stats: any) => void): Query; + geoNear(point: number[], options: Object, callback?: (err: any, res: T[], stats: any) => void): Query; geoSearch(cond: Object, options: GeoSearchOption, callback?: (err: any, res: T[]) => void): Query; increment(): T; mapReduce(options: MapReduceOption, callback?: (err: any, res: MapReduceResult[]) => void): Promise[]>; diff --git a/morgan/morgan-tests.ts b/morgan/morgan-tests.ts index 00e67f875..4a0df9902 100644 --- a/morgan/morgan-tests.ts +++ b/morgan/morgan-tests.ts @@ -23,7 +23,9 @@ morgan('combined', { buffer: true, immediate: true, skip: function (req, res) { return res.statusCode < 400 }, - stream: (str: string) => { - console.log(str); + stream: { + write: (str: string) => { + console.log(str); + } } }); diff --git a/morgan/morgan.d.ts b/morgan/morgan.d.ts index b889bc7be..048fce3d4 100644 --- a/morgan/morgan.d.ts +++ b/morgan/morgan.d.ts @@ -12,6 +12,13 @@ declare module "morgan" { export function token(name: string, callback: (req: express.Request, res: express.Response) => T): express.RequestHandler; + export interface StreamOptions { + /** + * Output stream for writing log lines + */ + write: (str: string) => void; + } + /*** * Morgan accepts these properties in the options object. */ @@ -36,7 +43,7 @@ declare module "morgan" { * Output stream for writing log lines, defaults to process.stdout. * @param str */ - stream?: (str: string) => void; + stream?: StreamOptions; } } diff --git a/mssql/mssql-tests.ts b/mssql/mssql-tests.ts index e508ec354..f1f1a20b2 100644 --- a/mssql/mssql-tests.ts +++ b/mssql/mssql-tests.ts @@ -3,6 +3,10 @@ import sql = require('mssql'); +interface Entity{ + value: number; +} + var config: sql.config = { user: 'user', password: 'password', @@ -33,6 +37,18 @@ var connection: sql.Connection = new sql.Connection(config, function (err: any) } }); + getArticlesQuery = "SELECT 1 as value FROM TABLE"; + + requestQuery.query(getArticlesQuery, function (err, recordSet) { + if (err) { + console.error('Error happened calling Query: ' + err.name + " " + err.message); + + } + // checking to see if the articles returned as at least one. + else if (recordSet.length > 0 && recordSet[0].value) { + } + }); + var requestStoredProcedure = new sql.Request(connection); var testId: number = 0; var testString: string = 'test'; @@ -50,6 +66,15 @@ var connection: sql.Connection = new sql.Connection(config, function (err: any) } }); + requestStoredProcedure.execute('StoredProcedureName', function (err, recordsets, returnValue) { + if (err != null) { + console.error('Error happened calling Query: ' + err.name + " " + err.message); + } + else { + console.info(returnValue); + } + }); + var requestStoredProcedureWithOutput = new sql.Request(connection); var testId: number = 0; var testString: string = 'test'; @@ -74,6 +99,15 @@ var connection: sql.Connection = new sql.Connection(config, function (err: any) console.info(requestStoredProcedureWithOutput.parameters['output'].value); } }); + + requestStoredProcedure.execute('StoredProcedureName', function (err, recordsets, returnValue) { + if (err != null) { + console.error('Error happened calling Query: ' + err.name + " " + err.message); + } + else { + console.info(requestStoredProcedureWithOutput.parameters['output'].value); + } + }); } }); @@ -109,8 +143,10 @@ function test_promise_returns() { var request = new sql.Request(); request.batch('create procedure #temporary as select * from table').then((recordset) => { }); + request.batch('create procedure #temporary as select * from table;select 1 as value').then((recordset) => { }); request.bulk(new sql.Table("table_name")).then(() => { }); request.query('SELECT 1').then((recordset) => { }); + request.query('SELECT 1 as value').then(res => { }); request.execute('procedure_name').then((recordset) => { }); } @@ -120,7 +156,7 @@ function test_request_constructor() { var connection: sql.Connection = new sql.Connection(config); var preparedStatment = new sql.PreparedStatement(connection); var transaction = new sql.Transaction(connection); - + var request1 = new sql.Request(connection); var request2 = new sql.Request(preparedStatment); var request3 = new sql.Request(transaction); @@ -141,4 +177,4 @@ function test_classes_extend_eventemitter() { request.on('error', () => { }); preparedStatment.on('error', () => { }) -} \ No newline at end of file +} diff --git a/mssql/mssql.d.ts b/mssql/mssql.d.ts index c434444d3..2b3db4807 100644 --- a/mssql/mssql.d.ts +++ b/mssql/mssql.d.ts @@ -7,7 +7,7 @@ /// declare module "mssql" { - import events = require('events'); + import events = require('events'); type sqlTypeWithNoParams = { type: sqlTypeFactoryWithNoParams } type sqlTypeWithLength = { type: sqlTypeFactoryWithLength, length: number } @@ -200,15 +200,19 @@ declare module "mssql" { public constructor(transaction: Transaction); public constructor(preparedStatement: PreparedStatement); public execute(procedure: string): Promise; - public execute(procedure: string, callback: (err?: any, recordsets?: any, returnValue?: any) => void): void; + public execute(procedure: string, callback: (err?: any, recordsets?: Entity[], returnValue?: any) => void): void; public input(name: string, value: any): void; public input(name: string, type: any, value: any): void; public output(name: string, type: any, value?: any): void; public pipe(stream: NodeJS.WritableStream): void; public query(command: string): Promise; + public query(command: string): Promise; public query(command: string, callback: (err?: any, recordset?: any) => void): void; + public query(command: string, callback: (err?: any, recordset?: Entity[]) => void): void; public batch(batch: string): Promise; + public batch(batch: string): Promise; public batch(batch: string, callback: (err?: any, recordset?: any) => void): void; + public batch(batch: string, callback: (err?: any, recordset?: Entity[]) => void): void; public bulk(table: Table): Promise; public bulk(table: Table, callback: (err: any, rowCount: any) => void): void; public cancel(): void; @@ -254,7 +258,9 @@ declare module "mssql" { public prepare(statement?: string): Promise; public prepare(statement?: string, callback?: (err?: any) => void): void; public execute(values: Object): Promise; + public execute(values: Object): Promise; public execute(values: Object, callback: (err: any, recordSet: recordSet) => void): void; + public execute(values: Object, callback: (err: any, recordSet: Entity[]) => void): void; public unprepare(): Promise; public unprepare(callback: (err?: any) => void): void; } diff --git a/multer/multer-tests.ts b/multer/multer-tests.ts index 8131293f5..009ec4fbd 100644 --- a/multer/multer-tests.ts +++ b/multer/multer-tests.ts @@ -4,5 +4,30 @@ import express = require('express'); import multer = require('multer'); -var app: express.Express = express(); -app.use(multer()); \ No newline at end of file +var upload = multer({ dest: 'uploads/' }); + +var app = express(); + +app.post('/profile', upload.single('avatar'), (req, res, next) => { +}); + +app.post('/photos/upload', upload.array('photos', 12), (req, res, next) => { +}); + +var cpUpload = upload.fields([{ name: 'avatar', maxCount: 1 }, { name: 'gallery', maxCount: 8 }]) +app.post('/cool-profile', cpUpload, (req, res, next) => { +}); + +var diskStorage = multer.diskStorage({ + destination(req, file, cb) { + cb(null, '/tmp/my-uploads'); + }, + filename(req, file, cb) { + cb(null, file.fieldname + '-' + Date.now()); + } +}) + +var diskUpload = multer({ storage: diskStorage }); + +var memoryStorage = multer.memoryStorage(); +var memoryUpload = multer({ storage: memoryStorage }); diff --git a/multer/multer.d.ts b/multer/multer.d.ts index 06a9d4f7a..facd3da53 100644 --- a/multer/multer.d.ts +++ b/multer/multer.d.ts @@ -1,16 +1,16 @@ // Type definitions for multer // Project: https://github.com/expressjs/multer -// Definitions by: jt000 , vilicvane +// Definitions by: jt000 , vilicvane , David Broder-Rodgers // Definitions: https://github.com/borisyankov/DefinitelyTyped /// - declare module Express { export interface Request { + file: Multer.File; files: { [fieldname: string]: Multer.File - } + }; } module Multer { @@ -40,13 +40,19 @@ declare module Express { declare module "multer" { import express = require('express'); - function multer(options?: multer.Options): express.RequestHandler; - module multer { + interface Field { + /** The field name. */ + name: string; + /** Optional maximum number of files per field to accept. */ + maxCount?: number; + } - type Options = { + interface Options { /** The destination directory for the uploaded files. */ dest?: string; + /** The storage engine to use for uploaded files. */ + storage?: StorageEngine; /** An object specifying the size limits of the following optional properties. This object is passed to busboy directly, and the details of properties can be found on https://github.com/mscdex/busboy#busboy-methods */ limits?: { /** Max field name size (Default: 100 bytes) */ @@ -64,36 +70,45 @@ declare module "multer" { /** For multipart forms, the max number of header key=> value pairs to parse Default: 2000(same as node's http). */ headerPairs?: number; }; - /** A Boolean value to specify whether empty submitted values should be processed and applied to req.body; defaults to false; */ - includeEmptyFields?: boolean; - /** If this Boolean value is true, the file.buffer property holds the data in-memory that Multer would have written to disk. The dest option is still populated and the path property contains the proposed path to save the file. Defaults to false. */ - inMemory?: boolean; - /** Function to rename the uploaded files. Whatever the function returns will become the new name of the uploaded file (extension is not included). The fieldname and filename of the file will be available in this function, use them if you need to. */ - rename?: (fieldname: string, filename: string, req: Express.Request, res: Express.Response) => string; - /** Function to rename the directory in which to place uploaded files. The dest parameter is the default value originally assigned or passed into multer. The req and res parameters are also passed into the function because they may contain information (eg session data) needed to create the path (eg get userid from the session). */ - changeDest?: (dest: string, req: Express.Request, res: Express.Response) => string; - /** Event handler triggered when a file starts to be uploaded. A file object, with the following properties, is available to this function: fieldname, originalname, name, encoding, mimetype, path, and extension. */ - onFileUploadStart?: (file: Express.Multer.File, req: Express.Request, res: Express.Response) => void; - /** Event handler triggered when a chunk of buffer is received. A buffer object along with a file object is available to the function. */ - onFileUploadData?: (file: Express.Multer.File, data: Buffer, req: Express.Request, res: Express.Response) => void; - /** Event handler trigger when a file is completely uploaded. A file object is available to the function. */ - onFileUploadComplete?: (file: Express.Multer.File, req: Express.Request, res: Express.Response) => void; - /** Event handler triggered when the form parsing starts. */ - onParseStart?: () => void; - /** Event handler triggered when the form parsing completes. The request object and the next objects are are passed to the function. */ - onParseEnd?: (req: Express.Request, next: () => void) => void; - /** Event handler for any errors encountering while processing the form. The error object and the next object is available to the function. If you are handling errors yourself, make sure to terminate the request or call the next() function, else the request will be left hanging. */ - onError?: () => void; - /** Event handler triggered when a file size exceeds the specification in the limit object. No more files will be parsed after the limit is reached. */ - onFileSizeLimit?: (file: Express.Multer.File) => void; - /** Event handler triggered when the number of files exceed the specification in the limit object. No more files will be parsed after the limit is reached. */ - onFilesLimit?: () => void; - /** Event handler triggered when the number of fields exceed the specification in the limit object. No more fields will be parsed after the limit is reached. */ - onFieldsLimit?: () => void; - /** Event handler triggered when the number of parts exceed the specification in the limit object. No more files or fields will be parsed after the limit is reached. */ - onPartsLimit?: () => void; - }; + /** A function to control which files to upload and which to skip. */ + fileFilter?: (req: Express.Request, file: Express.Multer.File, callback: (error: Error, acceptFile: boolean) => void) => void; + } + + interface StorageEngine { + _handleFile(req: express.Request, file: Express.Multer.File, callback: (error?: any, info?: Express.Multer.File) => void): void; + _removeFile(req: express.Request, file: Express.Multer.File, callback: (error: Error) => void): void; + } + + interface DiskStorageOptions { + /** A function used to determine within which folder the uploaded files should be stored. Defaults to the system's default temporary directory. */ + destination?: (req: Express.Request, file: Express.Multer.File, callback: (error: Error, destination: string) => void) => void; + /** A function used to determine what the file should be named inside the folder. Defaults to a random name with no file extension. */ + filename?: (req: Express.Request, file: Express.Multer.File, callback: (error: Error, filename: string) => void) => void; + } + + interface Instance { + /** Accept a single file with the name fieldname. The single file will be stored in req.file. */ + single(fieldame: string): express.RequestHandler; + /** Accept an array of files, all with the name fieldname. Optionally error out if more than maxCount files are uploaded. The array of files will be stored in req.files. */ + array(fieldame: string, maxCount?: number): express.RequestHandler; + /** Accept a mix of files, specified by fields. An object with arrays of files will be stored in req.files. */ + fields(fields: Field[]): express.RequestHandler; + /** Accepts all files that comes over the wire. An array of files will be stored in req.files. */ + any(): express.RequestHandler; + } } + interface Multer { + + (options?: multer.Options): multer.Instance; + + /* The disk storage engine gives you full control on storing files to disk. */ + diskStorage(options: multer.DiskStorageOptions): multer.StorageEngine; + /* The memory storage engine stores the files in memory as Buffer objects. */ + memoryStorage(): multer.StorageEngine; + } + + var multer: Multer; + export = multer; } diff --git a/navigation/navigation-tests.ts b/navigation/navigation-tests.ts index d3676e82e..0d663483a 100644 --- a/navigation/navigation-tests.ts +++ b/navigation/navigation-tests.ts @@ -78,10 +78,20 @@ module NavigationTests { // State Handler class LogStateHandler extends Navigation.StateHandler { + getNavigationLink(state: Navigation.State, data: any): string { + console.log('get navigation link'); + return super.getNavigationLink(state, data, { ids: [] }); + } getNavigationData(state: Navigation.State, url: string): any { console.log('get navigation data'); - super.getNavigationData(state, url); + super.getNavigationData(state, url, {}); } + urlEncode(state: Navigation.State, key: string, val: string, queryString: boolean): string { + return queryString ? val.replace(/\s/g, '+') : super.urlEncode(state, key, val, queryString); + } + urlDecode(state: Navigation.State, key: string, val: string, queryString: boolean): string { + return queryString ? val.replace(/\+/g, ' ') : super.urlDecode(state, key, val, queryString); + } } homePage.stateHandler = new LogStateHandler(); personList.stateHandler = new LogStateHandler(); diff --git a/navigation/navigation.d.ts b/navigation/navigation.d.ts index 418cec8a4..a9f2e1e0e 100644 --- a/navigation/navigation.d.ts +++ b/navigation/navigation.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Navigation 1.2.0 +// Type definitions for Navigation 1.3.0 // Project: http://grahammendick.github.io/navigation/ // Definitions by: Graham Mendick // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -529,6 +529,14 @@ declare module Navigation { * @returns The navigation link */ getNavigationLink(state: State, data: any): string; + /** + * Gets a link that navigates to the state passing the data + * @param state The State to navigate to + * @param data The data to pass when navigating + * @param queryStringData The query string array data + * @returns The navigation link + */ + getNavigationLink(state: State, data: any, queryStringData: { [index: string]: string[]; }): string; /** * Navigates to the url * @param oldState The current State @@ -543,6 +551,30 @@ declare module Navigation { * @returns The navigation data */ getNavigationData(state: State, url: string): any; + /** + * Gets the data parsed from the url + * @param state The State navigated to + * @param url The current url + * @param queryStringData Stores query string keys + * @returns The navigation data + */ + getNavigationData(state: State, url: string, queryStringData: any): any; + /** + * Encodes the Url value + * @param state The State navigated to + * @param key The key of the navigation data item + * @param val The Url value of the navigation data item + * @param queryString A value indicating the Url value's location + */ + urlEncode?(state: State, key: string, val: string, queryString: boolean): string; + /** + * Decodes the Url value + * @param state The State navigated to + * @param key The key of the navigation data item + * @param val The Url value of the navigation data item + * @param queryString A value indicating the Url value's location + */ + urlDecode?(state: State, key: string, val: string, queryString: boolean): string; /** * Truncates the crumb trail * @param The State navigated to @@ -642,6 +674,11 @@ declare module Navigation { * navigating back or refreshing and combineCrumbTrail is false */ trackAllPreviousData: boolean; + /** + * Gets or sets a value indicating whether arrays should be stored in + * a single query string parameter + */ + combineArray: boolean; } /** @@ -919,6 +956,14 @@ declare module Navigation { * @returns The navigation link */ getNavigationLink(state: State, data: any): string; + /** + * Gets a link that navigates to the state passing the data + * @param state The State to navigate to + * @param data The data to pass when navigating + * @param queryStringData The query string array data + * @returns The navigation link + */ + getNavigationLink(state: State, data: any, queryStringData: { [index: string]: string[]; }): string; /** * Navigates to the url * @param oldState The current State @@ -933,6 +978,30 @@ declare module Navigation { * @returns The navigation data */ getNavigationData(state: State, url: string): any; + /** + * Gets the data parsed from the url + * @param state The State navigated to + * @param url The current url + * @param queryStringData Stores query string keys + * @returns The navigation data + */ + getNavigationData(state: State, url: string, queryStringData: any): any; + /** + * Encodes the Url value + * @param state The State navigated to + * @param key The key of the navigation data item + * @param val The Url value of the navigation data item + * @param queryString A value indicating the Url value's location + */ + urlEncode(state: State, key: string, val: string, queryString: boolean): string; + /** + * Decodes the Url value + * @param state The State navigated to + * @param key The key of the navigation data item + * @param val The Url value of the navigation data item + * @param queryString A value indicating the Url value's location + */ + urlDecode(state: State, key: string, val: string, queryString: boolean): string; /** * Truncates the crumb trail whenever a repeated or initial State is * encountered @@ -1043,6 +1112,13 @@ declare module Navigation { * @returns The matched data or null if there's no match */ match(path: string): any; + /** + * Gets the matching data for the path + * @param path The path to match + * @param urlDecode The function that decodes the Url value + * @returns The matched data or null if there's no match + */ + match(path: string, urlDecode: (route: Route, name: string, val: string) => string): any; /** * Gets the route populated with default values * @returns The built route @@ -1050,10 +1126,17 @@ declare module Navigation { build(): string; /** * Gets the route populated with data and default values - * @param The data for the route parameters + * @param data The data for the route parameters * @returns The built route */ build(data: any): string; + /** + * Gets the route populated with data and default values + * @param data The data for the route parameters + * @param urlEncode The function that encodes the Url value + * @returns The built route + */ + build(data: any, urlEncode: (route: Route, name: string, val: string) => string): string; } /** @@ -1075,10 +1158,17 @@ declare module Navigation { addRoute(path: string, defaults: any): Route; /** * Gets the matching route and data for the path - * @param route The path to match + * @param path The path to match * @returns The matched route and data */ match(path: string): { route: Route; data: any; }; + /** + * Gets the matching route and data for the path + * @param path The path to match + * @param urlDecode The function that decodes the Url value + * @returns The matched route and data + */ + match(path: string, urlDecode: (route: Route, name: string, val: string) => string): { route: Route; data: any; }; /** * Sorts the routes by the comparer * @param compare The route comparer function diff --git a/ngwysiwyg/ngwysiwyg-tests.ts b/ngwysiwyg/ngwysiwyg-tests.ts new file mode 100644 index 000000000..c779e918e --- /dev/null +++ b/ngwysiwyg/ngwysiwyg-tests.ts @@ -0,0 +1,20 @@ +/// + +//import ngWYSIWYG = require("ngWYSIWYG"); + +var complete: ngWYSIWYG.Config = { + sanitize: false, + toolbar: [ + { name: "basicStyling", items: ["bold", "italic", "underline", "strikethrough", "subscript", "superscript", "-", "leftAlign", "centerAlign", "rightAlign", "blockJustify", "-"] }, + { name: "paragraph", items: ["orderedList", "unorderedList", "outdent", "indent", "-"] }, + { name: "doers", items: ["removeFormatting", "undo", "redo", "-"] }, + { name: "colors", items: ["fontColor", "backgroundColor", "-"] }, + { name: "links", items: ["image", "hr", "symbols", "link", "unlink", "-"] }, + { name: "tools", items: ["print", "-"] }, + { name: "styling", items: ["font", "size", "format"] }, + ] +}; + +var partial: ngWYSIWYG.Config = { + sanitize: false +}; diff --git a/ngwysiwyg/ngwysiwyg.d.ts b/ngwysiwyg/ngwysiwyg.d.ts new file mode 100644 index 000000000..9f5ba18ca --- /dev/null +++ b/ngwysiwyg/ngwysiwyg.d.ts @@ -0,0 +1,16 @@ +// Type definitions for Marked +// Project: https://github.com/psergus/ngWYSIWYG +// Definitions by: Patrick Mac Kay +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module ngWYSIWYG { + export interface Toolbar { + name: string; + items: string[]; + } + + export interface Config { + sanitize: boolean; + toolbar?: Toolbar[]; + } +} \ No newline at end of file diff --git a/node-dir/node-dir-tests.ts b/node-dir/node-dir-tests.ts new file mode 100644 index 000000000..6cc03ec53 --- /dev/null +++ b/node-dir/node-dir-tests.ts @@ -0,0 +1,90 @@ +/// + +import * as dir from "node-dir"; + +// display contents of files in this script's directory +dir.readFiles("./", + function(err, content, next) { + console.log('content:', content); + next(); + }, + function(err, files) { + console.log('finished reading files:', files); + }); + +// display contents of huge files in this script's directory +dir.readFilesStream("./", + function(err: any, stream: any, next: any) { + var content = ''; + stream.on('data', function(buffer: any) { + content += buffer.toString(); + }); + stream.on('end',function() { + console.log('content:', content); + next(); + }); + }, + function(err, files) { + console.log('finished reading files:', files); + }); + +// match only filenames with a .txt extension and that don't start with a `.´ +dir.readFiles("./", { + match: /.txt$/, + exclude: /^\./ + }, function(err, content, next) { + console.log('content:', content); + next(); + }, + function(err, files){ + console.log('finished reading files:',files); + }); + +// exclude an array of subdirectory names +dir.readFiles("./", { + exclude: ['node_modules', 'test'] + }, function(err, content, next) { + console.log('content:', content); + next(); + }, + function(err, files){ + console.log('finished reading files:',files); + }); + + +// the callback for each file can optionally have a filename argument as its 3rd parameter +// and the finishedCallback argument is optional, e.g. +dir.readFiles("./", function(err: any, content: any, filename: string, next: any) { + console.log('processing content of file', filename); + next(); +}); + +dir.files("./", function(err, files) { + console.log(files); +}); + +dir.files("./", function(err, files) { + // sort descending + files.reverse(); + // include only certain filenames + files = files.filter(function(file: any) { + return ['allowed', 'file', 'names'].indexOf(file) > -1; + }); + // exclude some filenames + files = files.filter(function(file: any) { + return ['exclude', 'these', 'files'].indexOf(file) === -1; + }); +}); + +dir.subdirs("./", function(err, subdirs) { + console.log(subdirs); +}); + +dir.paths("./", function(err, paths) { + console.log('files:\n', paths.files); + console.log('subdirs:\n', paths.dirs); +}); + +dir.paths("./", true, function(err, paths) { + console.log('paths:\n', paths); +}); diff --git a/node-dir/node-dir.d.ts b/node-dir/node-dir.d.ts new file mode 100644 index 000000000..d131f6b9a --- /dev/null +++ b/node-dir/node-dir.d.ts @@ -0,0 +1,65 @@ +// Type definitions for node-dir +// Project: https://github.com/fshost/node-dir +// Definitions by: Panu Horsmalahti +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "node-dir" { + export interface Options { + // file encoding (defaults to 'utf8') + encoding?: string; + + // a regex pattern or array to specify filenames to ignore + exclude?: RegExp | string[]; + + // a regex pattern or array to specify directories to ignore + excludeDir?: RegExp | string[]; + + // a regex pattern or array to specify filenames to operate on + match?: RegExp | string[]; + + // a regex pattern or array to specify directories to recurse + matchDir?: RegExp | string[]; + + // whether to recurse subdirectories when reading files (defaults to true) + recursive?: boolean; + + // sort files in each directory in descending order + reverse?: boolean; + + // whether to aggregate only the base filename rather than the full filepath + shortName?: boolean; + + // sort files in each directory in ascending order (defaults to true) + sort?: boolean; + + // control if done function called on error (defaults to true) + doneOnErr?: boolean; + } + + export interface FileCallback { + (error: any, content: any, next: () => void): void; + } + + export interface FileNamedCallback { + (error: any, content: any, filename: string, next: () => void): void; + } + + export interface StreamCallback { + (error: any, stream: any, next: () => void): void; + } + + export interface FinishedCallback { + (error: any, files: any): void; + } + + export function readFiles(dir: string, fileCallback: FileCallback, finishedCallback?: FinishedCallback): void; + export function readFiles(dir: string, fileCallback: FileNamedCallback, finishedCallback?: FinishedCallback): void; + export function readFiles(dir: string, options: Options, fileCallback: FileCallback, finishedCallback?: FinishedCallback): void; + export function readFiles(dir: string, options: Options, fileCallback: FileNamedCallback, finishedCallback?: FinishedCallback): void; + export function readFilesStream(dir: string, options: Options, streamCallback: StreamCallback, + finishedCallback?: FinishedCallback): void; + export function files(dir: string, callback: (error: any, files: any) => void): void; + export function subdirs(dir: string, callback: (error: any, subdirs: any) => void): void; + export function paths(dir: string, callback: (error: any, paths: any) => void): void; + export function paths(dir: string, combine: boolean, callback: (error: any, paths: any) => void): void; +} diff --git a/node/node-0.10.d.ts b/node/node-0.10.d.ts index a4cd5b1a6..c77c724a6 100644 --- a/node/node-0.10.d.ts +++ b/node/node-0.10.d.ts @@ -176,7 +176,7 @@ declare module NodeJS { visibility: string; }; }; - kill(pid: number, signal?: string): void; + kill(pid:number, signal?: string|number): void; pid: number; title: string; arch: string; @@ -1191,8 +1191,8 @@ declare module "crypto" { setPrivateKey(public_key: string, encoding?: string): void; } export function getDiffieHellman(group_name: string): DiffieHellman; - export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; - export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number) : Buffer; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number) : Buffer; export function randomBytes(size: number): Buffer; export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void; export function pseudoRandomBytes(size: number): Buffer; diff --git a/node/node-0.11.d.ts b/node/node-0.11.d.ts index 05aee911d..e6943e254 100644 --- a/node/node-0.11.d.ts +++ b/node/node-0.11.d.ts @@ -176,7 +176,7 @@ declare module NodeJS { visibility: string; }; }; - kill(pid: number, signal?: string): void; + kill(pid:number, signal?: string|number): void; pid: number; title: string; arch: string; @@ -1099,8 +1099,8 @@ declare module "crypto" { setPrivateKey(public_key: string, encoding?: string): void; } export function getDiffieHellman(group_name: string): DiffieHellman; - export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; - export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number) : Buffer; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number) : Buffer; export function randomBytes(size: number): Buffer; export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void; export function pseudoRandomBytes(size: number): Buffer; diff --git a/node/node-0.12.d.ts b/node/node-0.12.d.ts index 11fd92d24..08564c224 100644 --- a/node/node-0.12.d.ts +++ b/node/node-0.12.d.ts @@ -256,7 +256,7 @@ declare module NodeJS { visibility: string; }; }; - kill(pid: number, signal?: string): void; + kill(pid:number, signal?: string|number): void; pid: number; title: string; arch: string; @@ -1654,8 +1654,8 @@ declare module "crypto" { setPrivateKey(public_key: string, encoding?: string): void; } export function getDiffieHellman(group_name: string): DiffieHellman; - export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; - export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void; export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number) : Buffer; export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number, digest: string) : Buffer; export function randomBytes(size: number): Buffer; diff --git a/node/node-0.8.8.d.ts b/node/node-0.8.8.d.ts index 1972e0cdc..592760360 100644 --- a/node/node-0.8.8.d.ts +++ b/node/node-0.8.8.d.ts @@ -150,7 +150,7 @@ interface NodeProcess extends EventEmitter { visibility: string; }; }; - kill(pid: number, signal?: string): void; + kill(pid:number, signal?: string|number): void; pid: number; title: string; arch: string; @@ -326,7 +326,7 @@ declare module "cluster" { export function disconnect(callback?: Function): void; export var workers: any; - // Event emitter + // Event emitter export function addListener(event: string, listener: Function): void; export function on(event: string, listener: Function): any; export function once(event: string, listener: Function): void; @@ -970,7 +970,7 @@ declare module "crypto" { setPrivateKey(public_key: string, encoding?: string): void; } export function getDiffieHellman(group_name: string): DiffieHellman; - export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: string) => any): void; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: string) => any): void; export function randomBytes(size: number, callback?: (err: Error, buf: Buffer) =>void ); } diff --git a/node/node-tests.ts b/node/node-tests.ts index d4195138d..eaab3c2c8 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -32,6 +32,54 @@ assert.doesNotThrow(() => { if (false) { throw "a hammer at your face"; } }, undefined, "What the...*crunch*"); +//////////////////////////////////////////////////// +/// Events tests : http://nodejs.org/api/events.html +//////////////////////////////////////////////////// + +module events_tests { + let emitter: events.EventEmitter; + let event: string; + let listener: Function; + let any: any; + + { + let result: events.EventEmitter; + + result = emitter.addListener(event, listener); + result = emitter.on(event, listener); + result = emitter.once(event, listener); + result = emitter.removeListener(event, listener); + result = emitter.removeAllListeners(); + result = emitter.removeAllListeners(event); + result = emitter.setMaxListeners(42); + } + + { + let result: number; + + result = events.EventEmitter.defaultMaxListeners; + result = events.EventEmitter.listenerCount(emitter, event); // deprecated + + result = emitter.getMaxListeners(); + result = emitter.listenerCount(event); + } + + { + let result: Function[]; + + result = emitter.listeners(event); + } + + { + let result: boolean; + + result = emitter.emit(event); + result = emitter.emit(event, any); + result = emitter.emit(event, any, any); + result = emitter.emit(event, any, any, any); + } +} + //////////////////////////////////////////////////// /// File system tests : http://nodejs.org/api/fs.html //////////////////////////////////////////////////// @@ -438,21 +486,101 @@ module path_tests { } //////////////////////////////////////////////////// -///ReadLine tests : https://nodejs.org/api/readline.html +/// readline tests : https://nodejs.org/api/readline.html //////////////////////////////////////////////////// -var rl = readline.createInterface({ - input: process.stdin, - output: process.stdout, -}); +module readline_tests { + let rl: readline.ReadLine; -rl.setPrompt("$>"); -rl.prompt(); -rl.prompt(true); + { + let options: readline.ReadLineOptions; + let input: NodeJS.ReadableStream; + let output: NodeJS.WritableStream; + let completer: readline.Completer; + let terminal: boolean; -rl.question("do you like typescript?", function(answer: string) { - rl.close(); -}); + let result: readline.ReadLine; + + result = readline.createInterface(options); + result = readline.createInterface(input); + result = readline.createInterface(input, output); + result = readline.createInterface(input, output, completer); + result = readline.createInterface(input, output, completer, terminal); + } + + { + let prompt: string; + + rl.setPrompt(prompt); + } + + { + let preserveCursor: boolean; + + rl.prompt(); + rl.prompt(preserveCursor); + } + + { + let query: string; + let callback: (answer: string) => void; + + rl.question(query, callback); + } + + { + let result: readline.ReadLine; + + result = rl.pause(); + } + + { + let result: readline.ReadLine; + + result = rl.resume(); + } + + { + rl.close(); + } + + { + let data: string|Buffer; + let key: readline.Key; + + rl.write(data); + rl.write(null, key); + } + + { + let stream: NodeJS.WritableStream; + let x: number; + let y: number; + + readline.cursorTo(stream, x, y); + } + + { + let stream: NodeJS.WritableStream; + let dx: number|string; + let dy: number|string; + + readline.moveCursor(stream, dx, dy); + } + + { + let stream: NodeJS.WritableStream; + let dir: number; + + readline.clearLine(stream, dir); + } + + { + let stream: NodeJS.WritableStream; + + readline.clearScreenDown(stream); + } +} ////////////////////////////////////////////////////////////////////// /// Child Process tests: https://nodejs.org/api/child_process.html /// diff --git a/node/node.d.ts b/node/node.d.ts index 5a6d842e3..450facb4a 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -173,9 +173,11 @@ declare module NodeJS { once(event: string, listener: Function): EventEmitter; removeListener(event: string, listener: Function): EventEmitter; removeAllListeners(event?: string): EventEmitter; - setMaxListeners(n: number): void; + setMaxListeners(n: number): EventEmitter; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; } export interface ReadableStream extends EventEmitter { @@ -256,7 +258,7 @@ declare module NodeJS { visibility: string; }; }; - kill(pid: number, signal?: string): void; + kill(pid:number, signal?: string|number): void; pid: number; title: string; arch: string; @@ -423,17 +425,21 @@ declare module "querystring" { declare module "events" { export class EventEmitter implements NodeJS.EventEmitter { - static listenerCount(emitter: EventEmitter, event: string): number; + static EventEmitter: EventEmitter; + static listenerCount(emitter: EventEmitter, event: string): number; // deprecated + static defaultMaxListeners: number; addListener(event: string, listener: Function): EventEmitter; on(event: string, listener: Function): EventEmitter; once(event: string, listener: Function): EventEmitter; removeListener(event: string, listener: Function): EventEmitter; removeAllListeners(event?: string): EventEmitter; - setMaxListeners(n: number): void; + setMaxListeners(n: number): EventEmitter; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; - } + listenerCount(type: string): number; + } } declare module "http" { @@ -484,6 +490,7 @@ declare module "http" { writeHead(statusCode: number, headers?: any): void; statusCode: number; statusMessage: string; + headersSent: boolean; setHeader(name: string, value: string): void; sendDate: boolean; getHeader(name: string): string; @@ -826,22 +833,49 @@ declare module "readline" { import * as events from "events"; import * as stream from "stream"; + export interface Key { + sequence?: string; + name?: string; + ctrl?: boolean; + meta?: boolean; + shift?: boolean; + } + export interface ReadLine extends events.EventEmitter { setPrompt(prompt: string): void; prompt(preserveCursor?: boolean): void; - question(query: string, callback: Function): void; - pause(): void; - resume(): void; + question(query: string, callback: (answer: string) => void): void; + pause(): ReadLine; + resume(): ReadLine; close(): void; - write(data: any, key?: any): void; + write(data: string|Buffer, key?: Key): void; } + + export interface Completer { + (line: string): CompleterResult; + (line: string, callback: (err: any, result: CompleterResult) => void): any; + } + + export interface CompleterResult { + completions: string[]; + line: string; + } + export interface ReadLineOptions { input: NodeJS.ReadableStream; - output: NodeJS.WritableStream; - completer?: Function; + output?: NodeJS.WritableStream; + completer?: Completer; terminal?: boolean; + historySize?: number; } + + export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer, terminal?: boolean): ReadLine; export function createInterface(options: ReadLineOptions): ReadLine; + + export function cursorTo(stream: NodeJS.WritableStream, x: number, y: number): void; + export function moveCursor(stream: NodeJS.WritableStream, dx: number|string, dy: number|string): void; + export function clearLine(stream: NodeJS.WritableStream, dir: number): void; + export function clearScreenDown(stream: NodeJS.WritableStream): void; } declare module "vm" { @@ -1700,10 +1734,10 @@ declare module "crypto" { setPrivateKey(public_key: string, encoding?: string): void; } export function getDiffieHellman(group_name: string): DiffieHellman; - export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; - export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void; - export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number) : Buffer; - export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number, digest: string) : Buffer; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number) : Buffer; + export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string) : Buffer; export function randomBytes(size: number): Buffer; export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void; export function pseudoRandomBytes(size: number): Buffer; diff --git a/parsimmon/parsimmon-tests.ts b/parsimmon/parsimmon-tests.ts index 3f8019891..569328296 100644 --- a/parsimmon/parsimmon-tests.ts +++ b/parsimmon/parsimmon-tests.ts @@ -110,6 +110,9 @@ fooPar = P.succeed(foo); fooArrPar = P.seq(fooPar, fooPar); anyArrPar = P.seq(barPar, fooPar, numPar); +fooPar = P.custom((success, failure) => (stream, i) => { str = stream; num = i; return success(num, foo); }); +fooPar = P.custom((success, failure) => (stream, i) => failure(num, str)); + fooPar = P.alt(fooPar, fooPar); anyPar = P.alt(barPar, fooPar, numPar); diff --git a/parsimmon/parsimmon.d.ts b/parsimmon/parsimmon.d.ts index 719e9c937..94b1b3be1 100644 --- a/parsimmon/parsimmon.d.ts +++ b/parsimmon/parsimmon.d.ts @@ -1,12 +1,14 @@ // Type definitions for Parsimmon 0.5.0 // Project: https://github.com/jneen/parsimmon -// Definitions by: Bart van der Schoor +// Definitions by: Bart van der Schoor , Mizunashi Mana // Definitions: https://github.com/borisyankov/DefinitelyTyped // TODO convert to generics declare module 'parsimmon' { module Parsimmon { + + export type StreamType = string; export interface Mark { start: number; @@ -103,6 +105,14 @@ declare module 'parsimmon' { export function seq(...parsers: Parser[]): Parser; export function seq(...parsers: Parser[]): Parser; + export type SuccessFunctionType = (index: number, result: U) => Result; + export type FailureFunctionType = (index: number, msg: string) => Result; + export type ParseFunctionType = (stream: StreamType, index: number) => Result; + /* + allows to add custom primitive parsers. + */ + export function custom(parsingFunction: (success: SuccessFunctionType, failure: FailureFunctionType) => ParseFunctionType): Parser; + /* accepts a variable number of parsers, and yields the value of the first one that succeeds, backtracking in between. */ diff --git a/pdf/pdf-tests.ts.tscparams b/pdf/pdf-tests.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/pdf/pdf-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/pdf/pdf.d.ts.tscparams b/pdf/pdf.d.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/pdf/pdf.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/protractor-http-mock/protractor-http-mock-tests.ts b/protractor-http-mock/protractor-http-mock-tests.ts new file mode 100644 index 000000000..6c39f1401 --- /dev/null +++ b/protractor-http-mock/protractor-http-mock-tests.ts @@ -0,0 +1,212 @@ +/// + +function TestConfig() { + mock.config = { + rootDirectory: 'root', + protractorConfig: 'protractor.conf.js' + }; +} + +function TestCtorOverloads() { + let noParam: mock.ProtractorHttpMock = mock(); + let emptyArray: mock.ProtractorHttpMock = mock([]); + let mockFiles: mock.ProtractorHttpMock = mock(['mock1', 'mock2']); + let skipDefaults: mock.ProtractorHttpMock = mock([], true); + + let del: mock.requests.Delete = { + request: { + path: 'path', + method: 'DELETE' + }, + response: { + status: 400, + data: 1 + } + }; + let put: mock.requests.Put = { + request: { + path: 'path', + method: 'PUT' + }, + response: { + status: 400, + data: 1 + } + }; + let mocks: mock.ProtractorHttpMock = mock([del, put]); +} + +function TestTeardown() { + mock.teardown(); +} + +function TestRequestsMade() { + let values: Array; + mock.requestsMade().then(v => values = v); +} + +function TestClearRequests() { + let promiseValue: boolean; + mock.clearRequests().then(value => { + promiseValue = value; + }); +} + +function TestGetRequestDefinitions() { + let getMinium: mock.requests.Get = { + request: { + path: 'path', + method: 'GET' + }, + response: { + data: 1, + status: 500 + } + }; + + let getParams: mock.requests.Get = { + request: { + path: 'path', + method: 'GET', + params: { + param1: 'param1', + param2: 2 + } + }, + response: { + data: 1, + status: 500 + } + }; + + let post: mock.requests.Post = { + request: { + path: 'path', + method: 'POST' + }, + response: { + data: 1, + status: 500 + } + }; + + let getQueryString: mock.requests.Get = { + request: { + path: 'path', + method: 'GET', + queryString: { + query1: 'query1', + query2: 2 + } + }, + response: { + data: 1, + status: 500 + } + }; + + let getHeaders: mock.requests.Get = { + request: { + path: 'path', + method: 'GET', + headers: { + head1: 'head1', + head2: 'head2' + } + }, + response: { + data: 1, + status: 500 + } + }; +} + +function TestPostRequestDefinitions() { + let post: mock.requests.Post = { + request: { + path: 'path', + method: 'POST' + }, + response: { + data: 1, + status: 500 + } + }; + + let postData: mock.requests.PostData = { + request: { + path: 'path', + method: 'POST', + data: 'data' + }, + response: { + data: 1, + status: 500 + } + }; +} + +function TestHeadRequestDefinitions() { + let head: mock.requests.Head = { + request: { + path: 'path', + method: 'HEAD' + }, + response: { + status: 500, + data: 1 + } + }; +} + +function TestDeleteRequestDefinitions() { + let del: mock.requests.Delete = { + request: { + path: 'path', + method: 'DELETE' + }, + response: { + status: 500, + data: 1 + } + }; +} + +function TestPutRequestDefinitions() { + let put: mock.requests.Put = { + request: { + path: 'path', + method: 'PUT' + }, + response: { + status: 500, + data: 1 + } + }; +} + +function TestPatchRequestDefinitions() { + let patch: mock.requests.Patch = { + request: { + path: 'path', + method: 'PATCH' + }, + response: { + status: 500, + data: 1 + } + }; +} + +function TestJsonpRequestDefinitions() { + let jsonp: mock.requests.Jsonp = { + request: { + path: 'path', + method: 'JSONP' + }, + response: { + status: 500, + data: 1 + } + }; +} diff --git a/protractor-http-mock/protractor-http-mock.d.ts b/protractor-http-mock/protractor-http-mock.d.ts new file mode 100644 index 000000000..41c4ef41f --- /dev/null +++ b/protractor-http-mock/protractor-http-mock.d.ts @@ -0,0 +1,209 @@ +// Type definitions for protractor-http-mock +// Project: https://github.com/atecarlos/protractor-http-mock +// Definitions by: Crevil +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module mock { + interface ProtractorHttpMock { + /** + * Instantiate mock module. This must be done before the browser connects. + * + * @param mocks An array of mock modules to load into the application. + * @param skipDefaults Set true to skip loading of default mocks. + */ + (mocks?: Array>, skipDefaults?: boolean): ProtractorHttpMock; + + /** + * Instantiate mock modules from files. This must be done before the browser connects. + * + * @param mocks An array of mock module names relative to the rootDirectory configuration. + */ + (mocks: Array): ProtractorHttpMock; + + /** + * Clean up. + * Typically done in the afterEach call to ensure the teardown + * is executed regardless of what happens in the test execution. + */ + teardown(): void; + + /** + * Returns a promise that will be resolved with an array of + * all matched HTTP requests. + */ + requestsMade(): webdriver.promise.Promise>; + + /** + * Returns a promise that will be resolved with a true boolean + * when all matched HTTP requests are cleared. + */ + clearRequests(): webdriver.promise.Promise; + + /** + * Module configuration to setup + */ + config: { + /** + * Mocks directory where mock files are located. + * Default: process.cwd() + */ + rootDirectory?: string; + + /** + * Path to protractor configuration file. + * Default: protractor.conf + */ + protractorConfig?: string; + }; + } + + /** + * Matched request. + */ + interface ReceivedRequest { + url: string; + method: string; + } + + module requests { + /** + * Base request mock used for all mocks. + */ + interface BaseRequest { + request: { + method: string; + path: string; + }; + response: { + status: number; + data: TResponse; + }; + } + + /** + * GET request mock. + */ + interface Get extends BaseRequest { + request: { + method: string; + path: string; + params?: Object; + queryString?: Object; + headers?: Object; + interceptedRequest?: boolean; + interceptedAnonymousRequest?: boolean; + }; + response: { + status: number; + data: TResponse; + }; + } + + /** + * POST request mock with payload. + */ + interface PostData extends BaseRequest { + request: { + path: string; + method: string; + data: TPayload; + }; + response: { + status: number; + data: TResponse; + }; + } + + /** + * POST request mock. + */ + interface Post extends BaseRequest { + request: { + path: string; + method: string; + }; + response: { + status: number; + data: TResponse; + }; + } + + /** + * HEAD request mock. + */ + interface Head extends BaseRequest { + request: { + path: string; + method: string; + }; + response: { + status: number; + data: TResponse; + }; + } + + /** + * HTTP Delete request mock. + */ + interface Delete extends BaseRequest { + request: { + path: string; + method: string; + }; + response: { + status: number; + data: TResponse; + }; + } + + /** + * PUT request mock. + */ + interface Put extends BaseRequest { + request: { + path: string; + method: string; + }; + response: { + status: number; + data: TResponse; + }; + } + + /** + * PATCH request mock. + */ + interface Patch extends BaseRequest { + request: { + path: string; + method: string; + }; + response: { + status: number; + data: TResponse; + }; + } + + /** + * JSONP request mock. + */ + interface Jsonp extends BaseRequest { + request: { + path: string; + method: string; + }; + response: { + status: number; + data: TResponse; + }; + } + } +} + +declare var mock: mock.ProtractorHttpMock; + +declare module 'protractor-http-mock' { + export = mock; +} diff --git a/pty.js/pty.js.d.ts b/pty.js/pty.js.d.ts index 937dff0c0..ab874a574 100644 --- a/pty.js/pty.js.d.ts +++ b/pty.js/pty.js.d.ts @@ -85,9 +85,11 @@ declare module 'pty.js' { removeListener(event: string, listener: Function): NodeJS.EventEmitter; removeAllListeners(event?: string): NodeJS.EventEmitter; // NOTE: this method is not actually defined in pty.js - setMaxListeners(n: number): void; + setMaxListeners(n: number): NodeJS.EventEmitter; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; } /** diff --git a/raty/raty-tests.ts b/raty/raty-tests.ts new file mode 100644 index 000000000..89efb79c3 --- /dev/null +++ b/raty/raty-tests.ts @@ -0,0 +1,54 @@ +/// +/// + + +var $element: JQuery = $('
        '); + +$element.raty(); + +$element.raty({ + cancel: false, + cancelClass: 'raty-cancel', + cancelHint: 'Cancel this rating!', + cancelOff: 'cancel-off.png', + cancelOn: 'cancel-on.png', + cancelPlace: 'left', + click: undefined, + half: false, + halfShow: true, + hints: ['bad', 'poor', 'regular', 'good', 'gorgeous'], + iconRange: undefined, + mouseout: undefined, + mouseover: undefined, + noRatedMsg: 'Not rated yet!', + number: 5, + numberMax: 20, + path: undefined, + precision: false, + readOnly: false, + round: { down: .25, full: .6, up: .76 }, + score: undefined, + scoreName: 'score', + single: false, + space: true, + starHalf: 'star-half.png', + starOff: 'star-off.png', + starOn: 'star-on.png', + target: undefined, + targetFormat: '{score}', + targetKeep: false, + targetScore: undefined, + targetText: '', + targetType: 'hint', + starType: 'img', +}); + +var score: number = $element.raty('score'); +$element.raty('score', 4); +$element.raty('click', 2); +$element.raty('readOnly', true); +$element.raty('cancel', true); +$element.raty('reload'); +$element.raty('set', { space: false }); +$element.raty('destroy'); +$element.raty('move', 3); diff --git a/raty/raty.d.ts b/raty/raty.d.ts new file mode 100644 index 000000000..bb02d9475 --- /dev/null +++ b/raty/raty.d.ts @@ -0,0 +1,64 @@ +// Type definitions for jQuery.raty 2.7.0 +// Project: https://github.com/wbotelhos/raty +// Definitions by: Matt Wheatley +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +interface JQuery { + raty(): JQuery; + raty(options: JQueryRatyOptions): JQuery; + raty(method: string, parameter: any): any; + raty(method: 'score'): number; + raty(method: 'score', score: number): void; + raty(method: 'click', star: number): void; + raty(method: 'readonly', on: boolean): void; + raty(method: 'cancel', on: boolean): void; + raty(method: 'reload'): void; + raty(method: 'set', options: JQueryRatyOptions): void; + raty(method: 'destroy'): JQuery; + raty(method: 'move', number: number): void; +} + +interface JQueryRatyOptions { + cancel?: boolean, + cancelClass?: string, + cancelHint?: string, + cancelOff?: string, + cancelOn?: string, + cancelPlace?: string, + click?: (score: number, event: JQueryEventObject) => void, + half?: boolean, + halfShow?: boolean, + hints?: string[], + iconRange?: any[][], + mouseout?: (score: number, event: JQueryEventObject) => void, + mouseover?: (score: number, event: JQueryEventObject) => void, + noRatedMsg?: string, + number?: number, + numberMax?: number, + path?: string, + precision?: boolean, + readOnly?: boolean, + round?: JQueryRatyRoundingOptions, + score?: number, + scoreName?: string, + single?: boolean, + space?: boolean, + starHalf?: string, + starOff?: string, + starOn?: string, + target?: string, + targetFormat?: string, + targetKeep?: boolean, + targetScore?: string, + targetText?: string, + targetType?: string, + starType?: string, +} + +interface JQueryRatyRoundingOptions { + down: number, + full: number, + up: number, +} diff --git a/rcloader/rcloader-tests.ts b/rcloader/rcloader-tests.ts new file mode 100644 index 000000000..16ade8c55 --- /dev/null +++ b/rcloader/rcloader-tests.ts @@ -0,0 +1,11 @@ +/// + +import RcLoader = require("rcloader"); + +const rcLoader = new RcLoader(".configfilename", { + lookup: true +}); + +rcLoader.for("foo.json", (err, fileOpts) => { + // send the file along +}); diff --git a/rcloader/rcloader.d.ts b/rcloader/rcloader.d.ts new file mode 100644 index 000000000..e06ac5905 --- /dev/null +++ b/rcloader/rcloader.d.ts @@ -0,0 +1,18 @@ +// Type definitions for rcloader +// Project: https://github.com/spalger/rcloader +// Definitions by: Panu Horsmalahti +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "rcloader" { + interface Options { + [property: string]: any; + lookup?: boolean; + } + + class RcLoader { + constructor(configfilename: string, options: string | Options); + for(path: string, callback?: (error: any, fileOpts: any) => void): void; + } + + export = RcLoader; +} diff --git a/react-day-picker/react-day-picker-tests.tsx.tscparams b/react-day-picker/react-day-picker-tests.tsx.tscparams deleted file mode 100644 index 0fa3ed717..000000000 --- a/react-day-picker/react-day-picker-tests.tsx.tscparams +++ /dev/null @@ -1 +0,0 @@ ---target es5 --noImplicitAny --jsx react diff --git a/react-dropzone/react-dropzone-tests.tsx.tscparams b/react-dropzone/react-dropzone-tests.tsx.tscparams deleted file mode 100644 index c90abf04f..000000000 --- a/react-dropzone/react-dropzone-tests.tsx.tscparams +++ /dev/null @@ -1 +0,0 @@ ---target es5 --noImplicitAny --experimentalDecorators --jsx react diff --git a/react-intl/react-intl-tests.tsx.tscparams b/react-intl/react-intl-tests.tsx.tscparams deleted file mode 100644 index 7cf88bb1b..000000000 --- a/react-intl/react-intl-tests.tsx.tscparams +++ /dev/null @@ -1 +0,0 @@ ---target es5 --noImplicitAny --experimentalDecorators --jsx react --module commonjs diff --git a/react-native/react-native-tests.tsx.tscparams b/react-native/react-native-tests.tsx.tscparams deleted file mode 100644 index 7cf88bb1b..000000000 --- a/react-native/react-native-tests.tsx.tscparams +++ /dev/null @@ -1 +0,0 @@ ---target es5 --noImplicitAny --experimentalDecorators --jsx react --module commonjs diff --git a/react-router/react-router-tests.tsx.tscparams b/react-router/react-router-tests.tsx.tscparams deleted file mode 100644 index f47983778..000000000 --- a/react-router/react-router-tests.tsx.tscparams +++ /dev/null @@ -1 +0,0 @@ ---noImplicitAny -jsx react --target es5 \ No newline at end of file diff --git a/react-select/react-select-tests.ts b/react-select/react-select-tests.ts new file mode 100644 index 000000000..e69de29bb diff --git a/react-select/react-select.d.ts b/react-select/react-select.d.ts new file mode 100644 index 000000000..ee365fe9b --- /dev/null +++ b/react-select/react-select.d.ts @@ -0,0 +1,67 @@ +// Type definitions for react-select v0.9.10 +// Project: https://github.com/JedWatson/react-select +// Definitions by: ESQUIBET Hugo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +// Typings for https://github.com/JedWatson/react-select +//***Usage*** +// import ReactSelect = require('react-select'); +// + +declare module "react-select" { + // Import React + import React = require("react"); + + interface Option{ + label : string; + value : string; + } + + interface ReactSelectProps extends React.Props{ + addLabelText? : string; + allowCreate? : boolean; + autoload? : boolean; + backspaceRemoves? : boolean; + cacheAsyncResults? : boolean; + className? : string; + clearable? : boolean; + clearAllText? : string; + clearValueText? : string; + delimiter? : string; + disabled? : boolean; + filterOption? : (option : Option,filterString : string)=>Option; + filterOptions? : (options:Array